Skip to content
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

[Feature] Same version computed on different branches #3453

Closed
xpicio opened this issue Mar 29, 2023 · 8 comments · Fixed by #3898
Closed

[Feature] Same version computed on different branches #3453

xpicio opened this issue Mar 29, 2023 · 8 comments · Fixed by #3898
Labels
Milestone

Comments

@xpicio
Copy link

xpicio commented Mar 29, 2023

Describe the bug
Hello, to be honest i'm not sure if it is a gitversion issue or i'm not using gitflow right. But i hope you could help me.

I created this repository https://github.com/xpicio/compute-version to test incremental version using conventional commits, the repo is based on gitflow model and i'm using git tower with the gitflow plugin.

In the actual state (after i closed an hotfix, pushed both branches develop and main, and finally added a tag) when i compute the version on develop or main branch, the version is the same: 0.2.4. This behaviour is causing an issue in CI/CD pipelines, when i need to restart a pipeline (should happen to fix a bug on the pipeline) the artifacts tagged from the develop branch will assume the same version of the artifacts from the main branch.

Expected Behavior

action branch commit message sha version
close hotfix (random)
develop 53720f5d878cbc9eab27fbb127615c3e85971409 0.3.0-alpha.9
main 53720f5d878cbc9eab27fbb127615c3e85971409 0.2.4
new tag v0.2.4 53720f5d878cbc9eab27fbb127615c3e85971409
develop 53720f5d878cbc9eab27fbb127615c3e85971409 0.x.x-alpha.x
main 53720f5d878cbc9eab27fbb127615c3e85971409 0.2.4

The version on develop branch is different to main

Actual Behavior

action branch commit message sha version
close hotfix (random)
develop 53720f5d878cbc9eab27fbb127615c3e85971409 0.3.0-alpha.9
main 53720f5d878cbc9eab27fbb127615c3e85971409 0.2.4
new tag v0.2.4 53720f5d878cbc9eab27fbb127615c3e85971409
develop 53720f5d878cbc9eab27fbb127615c3e85971409 0.2.4
main 53720f5d878cbc9eab27fbb127615c3e85971409 0.2.4

The version on develop branch is equal to main

Steps to Reproduce

docker run --rm gittools/gitversion:6.0.0-beta.1 \
    /url https://github.com/xpicio/compute-version.git \
    /b develop
docker run --rm gittools/gitversion:6.0.0-beta.1 \
    /url https://github.com/xpicio/compute-version.git \
    /b main

Your Environment

@xpicio xpicio added the bug label Mar 29, 2023
@lcaiffa
Copy link

lcaiffa commented Mar 30, 2023

I follow the tread with interest, I also have the exact same problem

@HHobeck
Copy link
Contributor

HHobeck commented Mar 30, 2023

If you take a look to the following figure you see that the main and the develop branch points to the same commit which has been tagged with v0.2.4:

image

At this moment in GitVersion a commit which has been tagged will be used as the semantic version independent if a higher version exists. I have already thought about this scenario very often and think we need to introduce a new branch configuration to control the behavior whether or not to output the previous released version (in this case the tagged version) or the up-coming version. In this case you can configure it on the main branch and on the develop to get different results. To answer your question it's not a bug.

@HHobeck HHobeck added feature and removed bug labels Mar 30, 2023
@HHobeck
Copy link
Contributor

HHobeck commented Mar 30, 2023

May I ask you why would you create a new build artifact without any code change? You could take the released version v0.2.4 ;)

@xpicio
Copy link
Author

xpicio commented Mar 30, 2023

Usually i have 2 pipelines (or the same that work conditionally), 1 bounded to the main branch (where i have production release x.x.x), 1 bounded to develop branch (where i have alpha release x.x.x-alpha.x). When i'm working on pipeline should happen that something is wrong and i need to run again the pipeline, and the project repositories does not change.

@HHobeck
Copy link
Contributor

HHobeck commented Mar 30, 2023

Usually i have 2 pipelines (or the same that work conditionally), 1 bounded to the main branch (where i have production release x.x.x), 1 bounded to develop branch (where i have alpha release x.x.x-alpha.x). When i'm working on pipeline should happen that something is wrong and i need to run again the pipeline, and the project repositories does not change.

I'm not sure if I understood your scenario right: You have done a release and you start to make changes on your build pipeline (without any code change in git) and want to test the pipeline on develop?

@xpicio
Copy link
Author

xpicio commented Mar 30, 2023

I'm not sure if I understood your scenario right: You have done a release and you start to make changes on your build pipeline (without any code change in git) and want to test the pipeline on develop?

Yes. With the repo at commit 53720f5d878cbc9eab27fbb127615c3e85971409 if i run the pipeline on main branch i will get 0.2.4-BUILD_NUMBER_MAIN (and it's ok), if i run the pipeline on develop branch i will obtain again 0.2.4-BUILD_NUMBER_DEVELOP (and it's wrong).

@HHobeck HHobeck added this to the 6.x milestone Mar 30, 2023
@HHobeck HHobeck changed the title Same version computed on different branches [Feature] Same version computed on different branches Jun 9, 2023
@arturcic arturcic added stale and removed stale labels Jun 30, 2023
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs.

@arturcic
Copy link
Member

arturcic commented Mar 9, 2024

🎉 This issue has been resolved in version 6.0.0-beta.6 🎉
The release is available on:

Your GitReleaseManager bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants