Merge "Chore: Remove daily cron on stage jobs" v0.85.0
authorJessica Wagantall <jwagantall@linuxfoundation.org>
Mon, 3 Apr 2023 16:52:07 +0000 (16:52 +0000)
committerGerrit Code Review <gerrit@linuxfoundation.org>
Mon, 3 Apr 2023 16:52:07 +0000 (16:52 +0000)
releasenotes/notes/fix-condition-before-pushing-object-97add454bc88ee31.yaml [new file with mode: 0644]
releasenotes/notes/fix-missing-tag-221e3263494b952a.yaml [new file with mode: 0644]
shell/release-job.sh

diff --git a/releasenotes/notes/fix-condition-before-pushing-object-97add454bc88ee31.yaml b/releasenotes/notes/fix-condition-before-pushing-object-97add454bc88ee31.yaml
new file mode 100644 (file)
index 0000000..54aafbe
--- /dev/null
@@ -0,0 +1,4 @@
+---
+fixes:
+  - |
+    Fix condition before pushing the object.
diff --git a/releasenotes/notes/fix-missing-tag-221e3263494b952a.yaml b/releasenotes/notes/fix-missing-tag-221e3263494b952a.yaml
new file mode 100644 (file)
index 0000000..d22a3e1
--- /dev/null
@@ -0,0 +1,11 @@
+---
+fixes:
+  - |
+    Address the problem where the tag is not pushed to the mainline
+    branch therefore causing the tag missing in the git history.
+
+    To fix this check commit count between the HEAD and
+    origin/${GERRIT_BRANCH} before the fetch and merge operation.
+    This is done to ensure that the tag lands on the target branch.
+    If the branch has already moved forward from the tagging point,
+    then a spur commit is created for the tag.
index a419438..24bb0d6 100644 (file)
@@ -365,7 +365,12 @@ tag-git-repo(){
             fi
             git config user.name "$RELEASE_USERNAME"
             git config user.email "$RELEASE_EMAIL"
-            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"
+            fi
         fi
     fi
 }
@@ -458,7 +463,20 @@ maven_release_file(){
         gunzip taglist.log.gz
         cat "$PATCH_DIR"/taglist.log
     popd
-    git checkout "$(awk '{print $NF}' "$PATCH_DIR/taglist.log")"
+
+    # compare if the commit sha1 from taglist is the same origin/${GERRIT_BRANCH}
+    # ensure that the tag lands on the target branch
+    # forward from the tagging point, then a spur commit is created
+    # for the tag
+    taghash="$(awk '{print $NF}' "$PATCH_DIR/taglist.log")"
+    if [ "${taghash}" = $(git rev-parse origin/${GERRIT_BRANCH}) ]; then
+        git checkout "origin/${GERRIT_BRANCH}"
+        # sentinal file
+        touch .testhash
+    else
+        git checkout "${taghash}"
+    fi
+
     git fetch "$PATCH_DIR/${PROJECT//\//-}.bundle"
     git merge --ff-only FETCH_HEAD
     nexus_release