From: Thanh Ha Date: Tue, 27 Feb 2018 05:29:49 +0000 (-0500) Subject: GIT_URL variable corruption in script X-Git-Tag: v0.17.0~9 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=022a0b99601fef4a8bd271b79af64e539e5f62dc;p=releng%2Fglobal-jjb.git GIT_URL variable corruption in script Not sure why but GIT_URL seems to get corrupt inside of this script. Use GERRIT_URL instead to clone patches. Additionally also ignore a patch if a patch that matches the Gerrit that triggered it is passed in. Issue: RELENG-784 Change-Id: I85de941ad64d64597f69c1c924295b26e1dc1bec Signed-off-by: Thanh Ha --- diff --git a/jjb/lf-maven-jobs.yaml b/jjb/lf-maven-jobs.yaml index cd3172b1..b2482c12 100644 --- a/jjb/lf-maven-jobs.yaml +++ b/jjb/lf-maven-jobs.yaml @@ -80,7 +80,11 @@ name: lf-update-java-alternatives builders: - inject: - properties-content: 'SET_JDK_VERSION={java-version}' + # Work around inject plugin overriding our GIT_URL variable incorrectly + # https://issues.jenkins-ci.org/browse/JENKINS-49775 + properties-content: | + SET_JDK_VERSION={java-version} + GIT_URL="$GIT_URL" - shell: !include-raw-escape: ../shell/update-java-alternatives.sh - inject: properties-file: '/tmp/java.env' diff --git a/shell/gerrit-fetch-dependencies.sh b/shell/gerrit-fetch-dependencies.sh index 99a71f02..55c0cf1c 100644 --- a/shell/gerrit-fetch-dependencies.sh +++ b/shell/gerrit-fetch-dependencies.sh @@ -41,6 +41,11 @@ for patch in $(echo "${PATCHES[@]}"); do project=$(echo "$json" | jq -r '.project') branch=$(echo "$json" | jq -r '.branch') + if [ "$GERRIT_CHANGE_NUMBER" == "$patch" ]; then + echo "WARN: GERRIT_CHANGE and $patch are one and the same. Ignoring patch..." + continue + fi + if [ ! -d "$REPOS_DIR/$project" ]; then git clone -q --depth 1 -b "$branch" "$GIT_URL/$project" "$REPOS_DIR/$project"