-
Notifications
You must be signed in to change notification settings - Fork 652
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
(GH-2456) Correctly assert version number for tagged commit #2577
Conversation
Ensure that an increment of the version number only occurs when the sha of the commit is different from the base version sha.
Without the code change, this test fails with an incorrectly asserted version number, similar to 0.3.0-tags-01, when it should be 0.2.0.
@gep13 I wonder if we need to add a similar test for AzurePipelines |
I actually had the same thought. I can break the test up in a similar way to the PullRequestBuildAgentTewt class. Just away to make the kids supper just now, but should be able to get this updated later tonight. Does the single test, and code change make sense? |
In general I mean? Is this a sensible change? |
I think it makes sense. Would be great to add an additional test in the This one is more like an integration test. |
in |
I started looking there, but the problem only occurs when the environment variables come into play, which only seemed to be in the integration tests. If the environment variables aren't passed in, the correct version number is asserted without the code change. |
But is the environment variable is the issue or it's value? I tend to think it's the value, so in that case we might be able to reproduce the value in a test |
I am not sure that I follow 😢 This test: GitVersion/src/GitVersion.Core.Tests/IntegrationTests/TagCheckoutScenarios.cs Lines 34 to 49 in 6c8e199
As soon as you add a CI into the mix, the wrong version number is asserted. I believe this is due to the addition work that it done to normalize the repository prior to asserting the version number. |
Ok, you're right. Will you add the AzurePipelines test as well? |
Yip, I can do that, but it won't be until later this evening at the earliest. |
Since this is where the original issue was reported.
@arturcic an additional test has been added to cover Azure Pipelines. |
@gep13 thank you so much for your contributions 👍 |
🎉 This issue has been resolved in version 5.6.5 🎉 Your GitReleaseManager bot 📦🚀 |
Description
When running on a CI system, like GitHub Actions, when building a tagged commit, rather than asserting something like
0.2.0
, which is expected, GitVersion asserts a version number like0.3.0-tags-0-2-0-0001
. An example of this can be seen here:https://github.com/cake-contrib/Cake.StrongNameSigner/runs/1779759425?check_suite_focus=true#step:5:217
A fix has been made to the code to only increment the semantic version number when on a tagged commit, if the current sha of the repository is different to the sha of the tagged semantic version.
This was discussed on a Twitch stream with @arturcic
Related Issue
#2456
Motivation and Context
How Has This Been Tested?
I have tested this code locally on my machine, and added unit tests to cover the code that has been changed.
Screenshots (if appropriate):
Checklist: