Skip to content

Commit

Permalink
Fix script to get next eksa version (#7632)
Browse files Browse the repository at this point in the history
Just before we release a new minor version, we cut a release branch that
we use to run tests and stabilize the release. At this point, there
isn't yet any tag for the minor release. The old code was assuming there
was one at thus picking the wrong tag. This solves the issue by running
the same logic as for main where there are no tags that match the
release branch minor version.
  • Loading branch information
g-gaston authored Feb 19, 2024
1 parent a8ec931 commit 8a19707
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions scripts/eksa_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,16 @@ function eksa-version::get_next_eksa_version_for_ancestor() {

release_version=$(echo "${latest_tag}" | awk -F. -v OFS=. '{$2++; $3=0; print}')
else
# For release branhc, get the latest tag that matches current commit
# and bump the patch version
latest_tag=$(git describe --tags --abbrev=0)
release_version=$(echo "${latest_tag}" | awk -F. -v OFS=. '{$3++; print}')
# For a release branch, get the latest tag for the release minor version and bump the patch version
# If there is not tag yet, use latest tag by date but bumping the minor version and using 0 as the patch
# Silence stdeer as the command will fail if there are no tags
latest_tag=$(git describe --tags --match "v$(echo "$ancestor_branch" | sed 's/release-//').*" "$(git rev-list --tags --max-count=1)" 2>/dev/null)
if [[ -z "$latest_tag" ]]; then
latest_tag=$(git describe --tags "$(git rev-list --tags --max-count=1)")
release_version=$(echo "${latest_tag}" | awk -F. -v OFS=. '{$2++; $3=0; print}')
else
release_version=$(echo "${latest_tag}" | awk -F. -v OFS=. '{$3++; print}')
fi
fi

echo "$release_version"
Expand Down

0 comments on commit 8a19707

Please sign in to comment.