CSIT-311 New Nightly CSIT perf job
[ci-management.git] / jjb / csit / include-raw-csit-vpp-perf-nightly.sh
1 #!/bin/bash
2 set -xeu -o pipefail
3
4 # check BRANCH_ID value
5 if [ "$BRANCH_ID" == "" ]; then
6     echo "branch_id not provided => 'master' will be used"
7     BRANCH_ID="master"
8 fi
9
10 # clone csit
11 git clone --depth 1 --no-single-branch https://gerrit.fd.io/r/csit
12
13 # if the git clone fails, complain clearly and exit
14 if [ $? != 0 ]; then
15     echo "Failed to run: git clone --depth 1 --no-single-branch https://gerrit.fd.io/r/csit"
16     exit 1
17 fi
18
19 cd csit
20
21 # get the latest verified version of the required branch
22 BRANCH_NAME=$(echo $(git branch -r | grep -E "${BRANCH_ID}-[0-9]+" | tail -n 1))
23
24 if [ "${BRANCH_NAME}" == "" ]; then
25     echo "No verified version found for requested branch - exiting"
26     exit 1
27 fi
28
29 # remove 'origin/' from the branch name
30 BRANCH_NAME=$(echo ${BRANCH_NAME#origin/})
31
32 # checkout to the required branch
33 git checkout ${BRANCH_NAME}
34
35 export TEST_TAG="PERFTEST_NIGHTLY"
36
37 # execute csit bootstrap script if it exists
38 if [ -e bootstrap-verify-perf.sh ]
39 then
40     # make sure that bootstrap.sh is executable
41     chmod +x bootstrap-verify-perf.sh
42     # run the script
43     ./bootstrap-verify-perf.sh
44 else
45     echo 'ERROR: No bootstrap-verify-perf.sh found'
46     exit 1
47 fi
48
49 # vim: ts=4 ts=4 sts=4 et :