build: fix github checkout tag handling #12417
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.
The github actions/checkout action tries to smoothly handle tag changes by converting annotated tags to lightweight tags when you specify an annotated tag to checkout:
actions/checkout#290
This breaks our version-gathering infrastructure in the case where multiple annotated tags point to a single commit. The one that's checked out - which is usually the most recent one, that we want the git describe command to return - won't be returned properly because (a) it isn't annotated and we're not passing --tags and we don't want to because we really like having tag annotations and (b) the history is slightly wrong since now it's a lightweight tag on the specific commit and for that we need --contains, and we don't want to do that because we don't want containing tags.
We can fix this by undoing the tag rewriting by forcing an update back to the original annotated tag from the server and then checking it out.
This should be testable by pushing a couple tags to this branch on the same commit and inspecting the resultant build logs.
Closes RQA-602