Fix: Use refspec to push tag and code 06/71606/7 v0.86.1
authorAnil Belur <abelur@linuxfoundation.org>
Wed, 19 Apr 2023 22:35:51 +0000 (08:35 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Fri, 21 Apr 2023 07:23:53 +0000 (17:23 +1000)
The CR 365d0c0fe65 for the ODL release custom bits
uses the GERRIT_BRANCH while pushing the tag and code,
however that does not work returns an error.

error: src refspec stable/chlorine does not match any

Push the code bundle and tag as separate operations.

Issue: RELENG-4696
Change-Id: I62d472b998a2d799990605482e5433fb7c721e5f
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
releasenotes/notes/use-gerrit-refspec-3955912de1d9c94f.yaml [new file with mode: 0644]
shell/release-job.sh

diff --git a/releasenotes/notes/use-gerrit-refspec-3955912de1d9c94f.yaml b/releasenotes/notes/use-gerrit-refspec-3955912de1d9c94f.yaml
new file mode 100644 (file)
index 0000000..66e3d9c
--- /dev/null
@@ -0,0 +1,5 @@
+---
+fixes:
+  - |
+    Use the GERRIT_REFSPEC while pushing code and tags
+    separately.
index 792cbdd..6c280d2 100644 (file)
@@ -365,11 +365,12 @@ tag-git-repo(){
             fi
             git config user.name "$RELEASE_USERNAME"
             git config user.email "$RELEASE_EMAIL"
+            echo "INFO: push tag: $GIT_TAG"
+            git push origin "$GIT_TAG"
             # Check if sentinal file exists
             if [[ -f .testhash ]]; then
-                git push origin "${GERRIT_BRANCH}" "$GIT_TAG"
-            else
-                git push origin "$GIT_TAG"
+                echo "INFO: push code bundle"
+                git push origin "HEAD:${GERRIT_REFSPEC}"
             fi
         fi
     fi
@@ -481,6 +482,8 @@ maven_release_file(){
 
     git fetch "$PATCH_DIR/${PROJECT//\//-}.bundle"
     git merge --ff-only FETCH_HEAD
+    # print last few changes to see how the bundle is applied
+    git log --graph --all --decorate --pretty=oneline -n10
     nexus_release
     tag-git-repo
 }