summaryrefslogtreecommitdiffstats
path: root/jjb/hc2vpp/include-raw-hc2vpp-csit-verify-prebuild.sh
blob: cfde5eacb76e0736d44005c58a7614409e12867e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
set -xeu -o pipefail

# Parse optional arguments from gerrit comment trigger
for i in ${GERRIT_EVENT_COMMENT_TEXT}; do
    case ${i} in
        *honeycomb=*)
            hc_commit_id=`echo "${i}" | cut -d = -f2-`
        ;;
        *vpp=*)
            vpp_commit_id=`echo "${i}" | cut -d = -f2-`
        ;;
        *nsh_sfc=*)
            nsh_commit_id=`echo "${i}" | cut -d = -f2-`
        ;;
        *)
        ;;
    esac
done

# If HC variable is set, clone and build Honeycomb infra from the specified commit
# Otherwise skip this step, hc2vpp will use Honeycomb snapshots from Nexus
if [ -n "${hc_commit_id}" ]; then
    git clone https://gerrit.fd.io/r/honeycomb
    cd honeycomb
    ref=`git ls-remote -q | grep ${hc_commit_id} | awk '{print $2}'`
    git fetch origin ${ref} && git checkout FETCH_HEAD
    mvn clean install -DskipTests -Dcheckstyle.skip -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
    if [ $? != 0 ]; then
        echo "Honeycomb infra build failed."
        exit 1
    fi
    cd ${WORKSPACE}
fi

# TODO: Add option to build custom VPP and NSH packages

# Get CSIT branch from which to test from
if [ -f csit-test-branch ]; then
    chmod +x csit-test-branch
    CSIT_BRANCH=`./csit-test-branch`
else
    CSIT_BRANCH='master'
fi

# Clone csit
git clone https://gerrit.fd.io/r/csit --branch ${CSIT_BRANCH}

# If the git clone fails, complain clearly and exit
if [ $? != 0 ]; then
    echo "Failed to run: git clone https://gerrit.fd.io/r/csit --branch ${CSIT_BRANCH}"
    exit 1
fi

cd csit

# Download VPP packages
if [ ${STREAM} == 'master' ]; then
    ./resources/tools/scripts/download_hc_build_pkgs.sh ${STREAM} ${OS}
else
    ./resources/tools/scripts/download_hc_build_pkgs.sh 'stable.'${STREAM} ${OS}
fi

cd ${WORKSPACE}