This allows users to trigger the jjb-deploy job from any Gerrit
patch. It works in 2 different ways:
1. Triggered from ci-management patch
2. Triggered from non-ci-management patch
In case 1) it will deploy whatever is from the ci-management patch.
In case 2) it will instead deploy from HEAD of master in the
ci-management repo.
Change-Id: I414b053a68a105aa4cdc1ab99df9cd9962a080b9
Signed-off-by: Luis Gomez <ecelgp@gmail.com>
trigger-on: '{obj:gerrit_jjb_deploy_job_triggers}'
projects:
- project-compare-type: ANT
- project-pattern: '{project}'
+ project-pattern: '**'
branches:
- branch-compare-type: ANT
- branch-pattern: '**/{branch}'
+ branch-pattern: '**'
skip-vote:
success: true
failed: true
# shellcheck source=/tmp/v/jenkins-job-builder/bin/activate disable=SC1091
source "/tmp/v/jenkins-job-builder/bin/activate"
-echo "-----> Fetching project"
-git fetch origin "$GERRIT_REFSPEC" && git checkout FETCH_HEAD
+# 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}"