Skip to content

Fix --version for new branch structure#2407

Merged
rv-jenkins merged 4 commits intomasterfrom
version-flag-fix
Jan 24, 2022
Merged

Fix --version for new branch structure#2407
rv-jenkins merged 4 commits intomasterfrom
version-flag-fix

Conversation

@Baltoli
Copy link
Copy Markdown
Contributor

@Baltoli Baltoli commented Jan 21, 2022

To get the correct version tag from the release branch under the new structure, the following steps are followed:

  1. Find the common ancestor of master and the current commit using git merge-base.
  2. Identify the first tag that contains that common ancestor using git describe --contains.
  3. Use various other git invocations to parse out the SHA, distance from merge base, and dirty status.

Fixes #2391.

@Baltoli Baltoli requested a review from ehildenb January 21, 2022 13:47
@radumereuta
Copy link
Copy Markdown
Contributor

I checked out your branch,

$ mvn clean
$ mvn package -DskipTests
$ kompile --version
K version:    v5.2.62
Build date:   Fri Jan 21 17:38:47 EET 2022

This branch is two commits ahead of master, but that's not reflected in the reported version.

@Baltoli
Copy link
Copy Markdown
Contributor Author

Baltoli commented Jan 21, 2022

Oh, good catch - --contains changes the behaviour of git describe, so I'll have to use another command to get the distance the current commit is ahead of the merge base.

@Baltoli Baltoli requested a review from radumereuta January 21, 2022 16:46
Copy link
Copy Markdown
Contributor

@radumereuta radumereuta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested, lgtm

@rv-jenkins rv-jenkins merged commit d3f5f62 into master Jan 24, 2022
@rv-jenkins rv-jenkins deleted the version-flag-fix branch January 24, 2022 10:39
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.

[Bug] - Incorrect version reported on master checkouts of K

3 participants