Enable concurency for csit-vpp-perf-mrr-daily-master
[ci-management.git] / jjb / vpp / include-raw-vpp-csit-verify-perf.sh
1 #!/bin/bash
2 set -xeu -o pipefail
3
4 TRIGGER=`echo ${GERRIT_EVENT_COMMENT_TEXT} \
5     | grep -oE 'vpp-verify-perf-(l2|ip4|ip6|lisp|vxlan|vhost|acl|memif|ipsechw)' \
6     | awk '{print toupper($0)}'`
7 export TEST_TAG=${TRIGGER}
8
9 # Get CSIT branch from which to test from
10 # running build-root/scripts/csit-test-branch
11 if [ -x build-root/scripts/csit-test-branch ]; then
12     CSIT_BRANCH=`build-root/scripts/csit-test-branch`;
13 fi
14
15 # check CSIT_BRANCH value
16 if [ "$CSIT_BRANCH" == "" ]; then
17     echo "CSIT_BRANCH not provided => 'latest' will be used"
18     CSIT_BRANCH="latest"
19 fi
20
21 # clone csit
22 git clone --depth 1 --no-single-branch https://gerrit.fd.io/r/csit
23
24 # if the git clone fails, complain clearly and exit
25 if [ $? != 0 ]; then
26     echo "Failed to run: git clone --depth 1 --no-single-branch https://gerrit.fd.io/r/csit"
27     exit 1
28 fi
29
30 cp build-root/*.deb csit/
31 if [ -e dpdk/vpp-dpdk-dkms*.deb ]
32 then
33     cp dpdk/vpp-dpdk-dkms*.deb csit/
34 else
35     cp /w/dpdk/vpp-dpdk-dkms*.deb csit/ 2>/dev/null || :
36     cp /var/cache/apt/archives/vpp-dpdk-dkms*.deb csit/ 2>/dev/null || :
37 fi
38
39 cd csit
40
41 if [ "$CSIT_BRANCH" == "latest" ]; then
42     # set required CSIT branch_id based on VPP master branch; by default use 'oper'
43     case "$VPP_BRANCH" in
44         master )
45             BRANCH_ID="oper"
46             ;;
47         stable/1710 )
48             BRANCH_ID="oper-rls1710"
49             ;;
50         stable/1801 )
51             BRANCH_ID="oper-rls1801"
52             ;;
53         * )
54             BRANCH_ID="oper"
55     esac
56
57     # get the latest verified version of the required branch
58     CSIT_BRANCH=$(echo $(git branch -r | grep -E "${BRANCH_ID}-[0-9]+" | tail -n 1))
59
60     if [ "${CSIT_BRANCH}" == "" ]; then
61         echo "No verified CSIT branch found - exiting"
62         exit 1
63     fi
64
65     # remove 'origin/' from the branch name
66     CSIT_BRANCH=$(echo ${CSIT_BRANCH#origin/})
67 fi
68
69 # checkout the required csit branch
70 git checkout ${CSIT_BRANCH}
71
72 if [ $? != 0 ]; then
73     echo "Failed to checkout the required CSIT branch: ${CSIT_BRANCH}"
74     exit 1
75 fi
76
77 # execute csit bootstrap script if it exists
78 if [ ! -e bootstrap-verify-perf.sh ]
79 then
80     echo 'ERROR: No bootstrap-verify-perf.sh found'
81     exit 1
82 fi
83
84 # make sure that bootstrap-verify-perf.sh is executable
85 chmod +x bootstrap-verify-perf.sh
86 # run the script
87 ./bootstrap-verify-perf.sh *.deb
88
89 # vim: ts=4 ts=4 sts=4 et :