X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fjjb-deploy-job.sh;h=f62b7df0ae9953efff39f6511c4eff8bb115af13;hb=7c8c0136203f61317e6904030f86dfbd5a6c402e;hp=771f17b4bd2cddbb3151b866fd4446502a4f170b;hpb=334d6e2906736244da93122c82e8beda632c6234;p=releng%2Fglobal-jjb.git diff --git a/shell/jjb-deploy-job.sh b/shell/jjb-deploy-job.sh index 771f17b4..f62b7df0 100644 --- a/shell/jjb-deploy-job.sh +++ b/shell/jjb-deploy-job.sh @@ -14,13 +14,19 @@ echo "---> jjb-deploy-job.sh" # Ensure we fail the job if any steps fail. -set -e -o pipefail +set -uef -o pipefail -# shellcheck source=/tmp/v/jenkins-job-builder/bin/activate disable=SC1091 -source "/tmp/v/jenkins-job-builder/bin/activate" +# shellcheck disable=SC1090 +source ~/lf-env.sh -echo "-----> Fetching project" -git fetch origin "$GERRIT_REFSPEC" && git checkout FETCH_HEAD +# Version controlled by JJB_VERSION +lf-activate-venv --python python3 --venv-file /tmp/.jjb_venv jenkins-job-builder setuptools==65.7.0 + +# Fetch patch if gerrit project matches the jjb-deploy project +if [ "${GERRIT_PROJECT}" == "${PROJECT}" ]; then + echo "-----> Fetching ${PROJECT} patch" + git fetch origin "$GERRIT_REFSPEC" && git checkout FETCH_HEAD +fi # If not Gerrit Trigger than assume GitHub COMMENT="${GERRIT_EVENT_COMMENT_TEXT:-$ghprbCommentBody}" @@ -32,4 +38,5 @@ if [ -z "${JOB_NAME//\*/}" ]; then exit 1 fi -jenkins-jobs update --jobs-only --recursive --workers 4 jjb/ "$JOB_NAME" +echo "Deploying Job $JOB_NAME to sandbox" +jenkins-jobs -s sandbox update --jobs-only --recursive --workers 4 jjb/ "$JOB_NAME"