X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=jjb%2Fhc2vpp%2Finclude-raw-hc2vpp-csit-verify-prebuild.sh;h=ac33627cd0be4d67df9b057084a79e8e0ef510a6;hb=eee286749177282b838ccf24e1fb83c27c40d56e;hp=0384a467c60dbedd1235cba784ac915119516fe0;hpb=d72cae1f406002624b2e8b2e569206d95d582082;p=ci-management.git diff --git a/jjb/hc2vpp/include-raw-hc2vpp-csit-verify-prebuild.sh b/jjb/hc2vpp/include-raw-hc2vpp-csit-verify-prebuild.sh index 0384a467c..ac33627cd 100644 --- a/jjb/hc2vpp/include-raw-hc2vpp-csit-verify-prebuild.sh +++ b/jjb/hc2vpp/include-raw-hc2vpp-csit-verify-prebuild.sh @@ -1,31 +1,79 @@ #!/bin/bash -set -xeu -o pipefail +set -xe -o pipefail -current_dir=`pwd` -cd ${WORKSPACE} +# 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-` + ;; + *csit=*) + csit_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 -gs "${GLOBAL_SETTINGS_FILE}" -s "${SETTINGS_FILE}" + if [ $? != 0 ]; then + echo "Honeycomb infra build failed." + exit 1 + fi + cd ${WORKSPACE} + # Clean up when done. Leftover build files interfere with building hc2vpp. + rm -rf honeycomb +fi + +# TODO: Add option to build custom VPP and NSH packages # Get CSIT branch from which to test from -# running build-root/scripts/csit-test-branch if [ -f csit-test-branch ]; then chmod +x csit-test-branch CSIT_BRANCH=`./csit-test-branch` +else + CSIT_BRANCH='master' fi -# Clone csit and download VPP packages +# 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 + exit 1 fi cd csit +# If CSIT commit ID is given, checkout the specified commit +if [ -n "${csit_commit_id}" ]; then + # Example: + # ... + # e8f326efebb58e28dacb9ebb653baf95aad1448c refs/changes/08/11808/1 + # ... + ref=`git ls-remote -q | grep ${csit_commit_id} | awk '{print $2}'` + git fetch origin ${ref} && git checkout FETCH_HEAD +fi + +# Download VPP packages if [ ${STREAM} == 'master' ]; then - ./csit/resources/tools/download_hc_build_pkgs.sh ${STREAM} ${OS} + ./resources/tools/scripts/download_hc_build_pkgs.sh ${STREAM} ${OS} else - ./csit/resources/tools/download_hc_build_pkgs.sh 'stable.'${STREAM} ${OS} + ./resources/tools/scripts/download_hc_build_pkgs.sh 'stable.'${STREAM} ${OS} fi -cd ${current_dir} +cd ${WORKSPACE}