GIT_URL variable corruption in script 57/9057/2
authorThanh Ha <thanh.ha@linuxfoundation.org>
Tue, 27 Feb 2018 05:29:49 +0000 (00:29 -0500)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Tue, 27 Feb 2018 15:37:13 +0000 (10:37 -0500)
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 <thanh.ha@linuxfoundation.org>
jjb/lf-maven-jobs.yaml
shell/gerrit-fetch-dependencies.sh

index cd3172b..b2482c1 100644 (file)
     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'
index 99a71f0..55c0cf1 100644 (file)
@@ -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"