Update release note generation command #12920
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
Closes #12751
The release process owned by HashiCorp expects there to be an artifact, containing the release notes for a given release, uploaded to the repo containing the provider. This is the section of the GHA workflow for this repo that defines how the release notes are generated and then uploaded.
The
sed
command used to pull out the section of CHANGELOG.md relevant to the latest release is something made by HashiCorp : see it here in the release tooling's READMEThe
sed
command usesgit describe
to pull in the latest tag and then uses that output to identify the previous tag. This is used to prevent lines in the changelog from previous releases being streamed into the outputrelease-notes.txt
file. So if you tag v4.50.0 and the previous tag is v4.49.0 then you should see all of your changelog file above the entry for v4.49.0 being put intorelease-notes.txt
.The problem
Sometimes when we make a release we get lots of extra text in the release notes- changelog entries for multiple releases instead of just the latest release.
This is because the
sed
command that generates the release notes needs to identify the tag for the current release we're making and also the tag for the previous release. The previous release's tag/version is used to prevent those entries and older entries from being added to release notes.For this to work, all the tags need to be reachable from the specified commit that the release is running from (i.e. where the latest tag was added), but because we tag release branches not all tags are accessible from main or branches coming off of main. This problem can be seen by checking out a tag and running the following command to see all the tags that are accessible from the tagged commit:
Possible solution
The core issue we need to solve is how we can access the the previous release tag when we check out the most recent release tag.
This command returns all the tags in their release order (not just lexical order)
You can pull the 2 most recent tags and then the bottom tag from that list of 2 to get the previous version:
What's in this PR
I've used the above approach to update the
sed
command. Specifically I've replacedwith
Where this ENV contains a value that is the previous version tag, minus the
v
at the start. E.g.4.42.0