Add CSIT rls1804 branch
[ci-management.git] / jjb / vpp / include-raw-vpp-csit-functional.sh
1 #!/bin/bash
2 set -xeu -o pipefail
3
4 # Get CSIT branch from which to test from
5 # running build-root/scripts/csit-test-branch
6 if [ -x build-root/scripts/csit-test-branch ]; then
7     CSIT_BRANCH=`build-root/scripts/csit-test-branch`;
8 fi
9
10 # check CSIT_BRANCH value
11 if [ "$CSIT_BRANCH" == "" ]; then
12     echo "CSIT_BRANCH not provided => 'latest' will be used"
13     CSIT_BRANCH="latest"
14 fi
15
16 # clone csit
17 git clone --depth 1 --no-single-branch https://gerrit.fd.io/r/csit
18
19 # if the git clone fails, complain clearly and exit
20 if [ $? != 0 ]; then
21     echo "Failed to run: git clone --depth 1 --no-single-branch https://gerrit.fd.io/r/csit"
22     exit 1
23 fi
24
25 cp build-root/*.deb csit/
26 if [ -e dpdk/vpp-dpdk-dkms*.deb ]
27 then
28     cp dpdk/vpp-dpdk-dkms*.deb csit/
29 else
30     cp /w/dpdk/vpp-dpdk-dkms*.deb csit/
31 fi
32
33 # Check for CSIT_REF test file
34 if [ -e CSIT_REF ]; then
35     source CSIT_REF
36 fi
37
38 # If also testing a specific csit refpoint look for CSIT_REF
39 if [[ -v CSIT_REF ]]; then
40     (cd csit ; git fetch ssh://rotterdam-jobbuilder@gerrit.fd.io:29418/csit $CSIT_REF && git checkout FETCH_HEAD)
41 else
42     cd csit
43     if [ "$CSIT_BRANCH" == "latest" ]; then
44         # set required CSIT branch_id based on VPP master branch; by default use 'oper'
45         case "$VPP_BRANCH" in
46             master )
47                 BRANCH_ID="oper"
48                 ;;
49             stable/1710 )
50                 BRANCH_ID="oper-rls1710"
51                 ;;
52             stable/1801 )
53                 BRANCH_ID="oper-rls1801"
54                 ;;
55             stable/1804 )
56                 BRANCH_ID="oper-rls1804"
57                 ;;
58             * )
59                 BRANCH_ID="oper"
60         esac
61
62         # get the latest verified version of the required branch
63         CSIT_BRANCH=$(echo $(git branch -r | grep -E "${BRANCH_ID}-[0-9]+" | tail -n 1))
64
65         if [ "${CSIT_BRANCH}" == "" ]; then
66             echo "No verified CSIT branch found - exiting"
67             exit 1
68         fi
69
70         # remove 'origin/' from the branch name
71         CSIT_BRANCH=$(echo ${CSIT_BRANCH#origin/})
72     fi
73     # checkout the required csit branch
74     git checkout ${CSIT_BRANCH}
75
76     if [ $? != 0 ]; then
77         echo "Failed to checkout the required CSIT branch: ${CSIT_BRANCH}"
78         exit 1
79     fi
80 fi
81
82 # execute csit bootstrap script if it exists
83 if [ -e bootstrap.sh ]
84 then
85     # make sure that bootstrap.sh is executable
86     chmod +x bootstrap.sh
87     # run the script
88     ./bootstrap.sh *.deb
89 else
90     echo 'ERROR: No bootstrap.sh found'
91     exit 1
92 fi
93
94 # vim: ts=4 ts=4 sts=4 et :