Implement "absolute versioning" option #25
Draft
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.
Description
Because github does not guarantee workflow run order in any way, having multiple merges pushed very close together can cause tagging workflows to run out-of-order. If both merges are intended receive a tag, this can result in a scenario where, eg. v1 comes after v2 in history. In this scenario, compute-tag will compute v2 again for the next tag, which will likely cause issues for that workflow, as v2 already exists.
To mitigate this type of race condition, this PR implements what I've come to call "absolute versioning". This scheme counts the number of merge commits between the current commit and the most recent tag in history after the current commit, and then increments the version by that number. This results in state where each tag's value will be some absolute distance from whatever point in history this scheme is implemented, and should always calculate the same version for itself every time it is run.
For example if history looks like
(v1) --> ( ) --> ( ) --> ( )
, where each( )
is a merge commit, the rightmost one should calculatev4
. If compute-tag is then run for the commit immediately beforev4
, the computed tag will bev3
, since it only looks for tags before it in history when calculating. Thus, we construct a tag history where every tag is at a fixed ("absolute") distance fromv1
, and guarantee that a unique tag can be calculated for any merge commit, no matter when or in what order the workflow runs.The caveats of using this scheme are:
TODO: