From 24841a2cd51681e9d066c9e3347970c78e092800 Mon Sep 17 00:00:00 2001 From: Anil Belur Date: Thu, 20 Apr 2023 08:35:51 +1000 Subject: [PATCH] Fix: Use refspec to push tag and code 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 --- releasenotes/notes/use-gerrit-refspec-3955912de1d9c94f.yaml | 5 +++++ shell/release-job.sh | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/use-gerrit-refspec-3955912de1d9c94f.yaml diff --git a/releasenotes/notes/use-gerrit-refspec-3955912de1d9c94f.yaml b/releasenotes/notes/use-gerrit-refspec-3955912de1d9c94f.yaml new file mode 100644 index 00000000..66e3d9c7 --- /dev/null +++ b/releasenotes/notes/use-gerrit-refspec-3955912de1d9c94f.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Use the GERRIT_REFSPEC while pushing code and tags + separately. diff --git a/shell/release-job.sh b/shell/release-job.sh index 792cbdd3..6c280d20 100644 --- a/shell/release-job.sh +++ b/shell/release-job.sh @@ -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 } -- 2.16.6