From 2e21b966c9e8e46d2ef73a63393bab0d843134d8 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Tue, 18 Mar 2014 15:37:58 +0000 Subject: [PATCH] Allow BRANCH instead of ZUUL_REF in ggp * modules/jenkins/files/slave_scripts/gerrit-git-prep.sh: Allow callers to supply BRANCH in the environment for cases where there will be no ZUUL_REF environment variable. This is mainly to support use in periodic jobs, so that we can transition away from the Jenkins SCM plug-in. Change-Id: I86c77695d8c374c94932664026ab7a541686ae74 --- .../jenkins/files/slave_scripts/gerrit-git-prep.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/jenkins/files/slave_scripts/gerrit-git-prep.sh b/modules/jenkins/files/slave_scripts/gerrit-git-prep.sh index 2289db3db1..43318671c6 100755 --- a/modules/jenkins/files/slave_scripts/gerrit-git-prep.sh +++ b/modules/jenkins/files/slave_scripts/gerrit-git-prep.sh @@ -24,8 +24,16 @@ fi if [ -z "$ZUUL_REF" ] then - echo "This job may only be triggered by Zuul." - exit 1 + if [ -n "$BRANCH" ] + then + echo "No ZUUL_REF so using requested branch $BRANCH from origin." + ZUUL_REF=$BRANCH + # use the origin since zuul mergers have outdated branches + ZUUL_URL=$GIT_ORIGIN + else + echo "Provide either ZUUL_REF or BRANCH in the calling enviromnent." + exit 1 + fi fi if [ ! -z "$ZUUL_CHANGE" ]