Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: INFENG-938: Update version format in Makefiles #10142

Merged
merged 1 commit into from
Oct 28, 2024

Conversation

davidfluck-hpe
Copy link
Contributor

@davidfluck-hpe davidfluck-hpe commented Oct 27, 2024

Ticket

INFENG-938

Description

Add an optional v in the grep regular expression that computes previous version tags in GoReleaser Makefile targets for master, agent, and helm. This ensures continuity between the previous tag format, which used bare version strings, and the new tag format, all of which begin with a literal v. Otherwise, when trying to derive a previous tag that begins with a v, the grep would fail.

Note that things would still otherwise work fine for the next release, because previous tags would still satisfy the format. Subsequent releases, however, would be incorrect, because the tag would begin with a v and thus not match. GORELEASER_PREVIOUS_TAG is used for determining which release notes to include, and having it set incorrectly would cause problems for the GitHub release.

Test Plan

There are a few different cases to test. First, we'll test the upcoming case, which is: an rc release with the new tag style, against an existing minor release with the old tag style.

  1. Check out this branch.
  2. Tag HEAD: git tag v0.38.0-rc0.
  3. Run export VERSION='v0.38.0-rc0. Note: it must match the tag. This is necessary to mimic the make target command that sets GORELEASER_PREVIOUS_TAG, although it does require that the tag actually exists.
  4. Run git tag --sort=-creatordate | grep "${VERSION}" -A1 | sed -n '2 p', to test the behavior of GORELEASER_PREVIOUS_TAG for the release-gh-rc make target.
  5. The output should be 0.37.0, which is the correct previous tag for a release candidate build.
  6. Delete the new tag: git tag -d v0.38.0-rc0.

Next, test the case where we have a new rc tag, after a previous rc tag.

  1. Tag HEAD~1: git tag v0.38.0-rc0 HEAD~1.
  2. Tag HEAD: git tag v0.38.0-rc1.
  3. Run export VERSION='v0.38.0-rc1'.
  4. Run git tag --sort=-creatordate | grep "${VERSION}" -A1 | sed -n '2 p', to test the behavior of GORELEASER_PREVIOUS_TAG for the release-gh-rc make target.
  5. The output should be v0.38.0-rc0, as that is, indeed, the previous tag.
  6. Delete the new tags: git tag -d v0.38.0-rc0 v0.38.0-rc1.

Next, test the case where we have a new minor tag, while the previous tag is using the old tag format. The output should be the previous non-rc tag (in our case, a minor release tag).

  1. Tag HEAD~2: git tag v0.38.0-rc0 HEAD~2.
  2. Tag HEAD~1: git tag v0.38.0-rc1 HEAD~1.
  3. Tag HEAD: git tag v0.38.0.
  4. Run export VERSION='v0.38.0'.
  5. Run git tag --sort=-creatordate | grep -E '^v?[0-9.]+$$' | grep "${VERSION}" -A1 | sed -n '2 p', to simulate the release-gh make target.
  6. The output should be 0.37.0, which is the correct previous non-rc tag.
  7. Delete the new tags: git tag -d v0.38.0-rc0 v0.38.0-rc1 v0.38.0.

Finally, test the case where we have a new minor release tag, with the previous tag also using the new tag format. The output should be the previous non-rc tag using the new format.

  1. Tag HEAD~2: git tag v0.38.0 HEAD~2.
  2. Tag HEAD~1: git tag v0.39.0-rc0 HEAD~1.
  3. Tag HEAD: git tag v0.39.0.
  4. Run export VERSION='v0.39.0'.
  5. Run git tag --sort=-creatordate | grep -E '^v?[0-9.]+$$' | grep "${VERSION}" -A1 | sed -n '2 p', to simulate the release-gh make target.
  6. The output should be v0.38.0, which is the correct previous non-rc tag with the new format.
  7. Delete the new tags: git tag -d v0.38.0 v0.39.0-rc0 v0.39.0.

Note: please ensure that all of your local testing tags are cleaned up!

Checklist

  • Changes have been manually QA'd
  • New features have been approved by the corresponding PM
  • User-facing API changes have the "User-facing API Change" label
  • Release notes have been added as a separate file under docs/release-notes/
    See Release Note for details.
  • Licenses have been included for new code which was copied and/or modified from any external code

Add an optional 'v' in the grep regular expression that computes
previous version tags in GoReleaser Makefile targets for master, agent,
and helm. This ensures continuity between the previous tag format, which
used bare version strings, and the new tag format, all of which begin
with a literal 'v'. Otherwise, when trying to derive a previous tag that
begins with a 'v', the grep would fail.

Note that this would work for the next release, because previous tags
would still satisfy the format. Subsequent releases, however, would be
incorrect. GORELEASER_PREVIOUS_TAG is used for determining which release
notes to include, and having it set incorrectly would cause problems for
the GitHub release.
Copy link

codecov bot commented Oct 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 54.26%. Comparing base (00870f5) to head (500a23c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10142   +/-   ##
=======================================
  Coverage   54.25%   54.26%           
=======================================
  Files        1259     1259           
  Lines      157257   157257           
  Branches     3642     3642           
=======================================
+ Hits        85323    85328    +5     
+ Misses      71801    71796    -5     
  Partials      133      133           
Flag Coverage Δ
backend 45.89% <ø> (+<0.01%) ⬆️
harness 71.15% <ø> (ø)
web 54.29% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 2 files with indirect coverage changes

Copy link

netlify bot commented Oct 27, 2024

Deploy Preview for determined-ui canceled.

Name Link
🔨 Latest commit 500a23c
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/671e6b8075e8b4000876083d

@davidfluck-hpe davidfluck-hpe requested review from a team and dannysauer October 27, 2024 16:38
@davidfluck-hpe davidfluck-hpe merged commit 3be954b into main Oct 28, 2024
88 of 100 checks passed
@davidfluck-hpe davidfluck-hpe deleted the INFENG-938-tweak-version-format branch October 28, 2024 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants