X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Frelease-job.sh;h=24bb0d6c245a9dcb107ef8e526ebcf883ecef2ec;hb=refs%2Ftags%2Fv0.85.0;hp=3a732e0be2801217d80875b0270137f5ccd34814;hpb=5beb45586451cb772982de881cd09fd97360be87;p=releng%2Fglobal-jjb.git diff --git a/shell/release-job.sh b/shell/release-job.sh index 3a732e0b..24bb0d6c 100644 --- a/shell/release-job.sh +++ b/shell/release-job.sh @@ -280,7 +280,10 @@ verify_version(){ OVERRIDE_SEMVER_REGEX="${OVERRIDE_SEMVER_REGEX:-None}" if [[ $OVERRIDE_SEMVER_REGEX == "None" ]]; then # Use the semver regex taken from https://github.com/fsaintjacques/semver-tool - semver_regex="^[vV]?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\-(0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*)(\.(0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*))*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$" + pat1="(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)" + pat2="(0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*)" + pat3="(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)" + semver_regex="^[vV]?${pat1}(\-${pat2}(\.${pat2})*)?${pat3}?$" else semver_regex="${OVERRIDE_SEMVER_REGEX}" fi @@ -362,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 } @@ -396,7 +404,8 @@ artifact_release_file(){ wget "${path}"/"${name}" -o artifacts/"${name}" if [[ "$JOB_NAME" =~ "merge" ]] && [[ "$DRY_RUN" = false ]]; then #lftools sign sigul artifacts - curl -v -u : --upload-file "${NEXUS_URL}"/content/repositories/releases/org/"${ORG}"/"${VERSION}"/"${name}" \; + curl -v -u : --upload-file \ + "${NEXUS_URL}"/content/repositories/releases/org/"${ORG}"/"${VERSION}"/"${name}" \; fi echo "#########################" fi @@ -454,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