summaryrefslogtreecommitdiffstats
path: root/jjb/csit
diff options
context:
space:
mode:
authorJan Gelety <jgelety@cisco.com>2019-01-24 16:41:20 +0100
committerJan Gelety <jgelety@cisco.com>2019-01-24 16:41:20 +0100
commit889b887ebdc7612797f1f0fdcd9d0c87cbfe29b0 (patch)
tree77dfb476213bc85c24ac9651706ece836b91599e /jjb/csit
parentef1dfa2d7ed3b66839d6f93765f9abd80b5e0cb7 (diff)
FIX: Checkout csit branch based on BRANCH_ID in vpp-device semiweekly job
Change-Id: If5f89f82020c0009d6d2f764526e7006126c2fe9 Signed-off-by: Jan Gelety <jgelety@cisco.com>
Diffstat (limited to 'jjb/csit')
-rw-r--r--jjb/csit/include-raw-csit-device-semiweekly.sh30
1 files changed, 24 insertions, 6 deletions
diff --git a/jjb/csit/include-raw-csit-device-semiweekly.sh b/jjb/csit/include-raw-csit-device-semiweekly.sh
index 0871af69a..b45f7688a 100644
--- a/jjb/csit/include-raw-csit-device-semiweekly.sh
+++ b/jjb/csit/include-raw-csit-device-semiweekly.sh
@@ -15,15 +15,33 @@
set -exuo pipefail
+# Clone CSIT git repository and proceed with entry script located there.
+#
+# Variables read:
+# - WORKSPACE - Jenkins workspace to create csit subdirectory in.
+# - BRANCH_ID - CSIT operational branch to be used for test.
+# Directories updated:
+# - ${WORKSPACE}/csit - Created, holding a checked out CSIT repository.
+# - Multiple other side effects by entry script(s), see CSIT repository.
+
cd "${WORKSPACE}"
git clone https://gerrit.fd.io/r/csit --depth=1 --no-single-branch --no-checkout
+# Check BRANCH_ID value.
+if [[ -z "${BRANCH_ID-}" ]]; then
+ echo "BRANCH_ID not provided => 'oper' belonging to master will be used."
+ BRANCH_ID="oper"
+fi
pushd "${WORKSPACE}/csit"
-if [[ -n "${CSIT_REF-}" ]]; then
- git fetch --depth=1 https://gerrit.fd.io/r/csit "${CSIT_REF}"
- git checkout FETCH_HEAD
-else
- git checkout HEAD
+# Get the latest verified version of the required branch.
+BRANCH_NAME=$(echo $(git branch -r | grep -E "${BRANCH_ID}-[0-9]+" | tail -n 1))
+if [[ -z "${BRANCH_NAME-}" ]]; then
+ echo "No verified CSIT branch found - exiting!"
+ exit 1
fi
+# Remove 'origin/' from the branch name.
+BRANCH_NAME=$(echo ${BRANCH_NAME#origin/})
+# Checkout the required csit branch.
+git checkout "${BRANCH_NAME}"
popd
csit_entry_dir="${WORKSPACE}/csit/resources/libraries/bash/entry"
-source "${csit_entry_dir}/with_oper_for_vpp.sh" "bootstrap_vpp_device.sh"
+source "${csit_entry_dir}/bootstrap_vpp_device.sh"