Skip to content

[Feature] Same version computed on different branches #3453

Closed

Description

@xpicio

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

Activity

  1. lcaiffa commented on Mar 30, 2023

    @lcaiffa

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

  2. HHobeck commented on Mar 30, 2023

    @HHobeck
    Contributor

    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.

  3. HHobeck commented on Mar 30, 2023

    @HHobeck
    Contributor

    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 ;)

  4. xpicio commented on Mar 30, 2023

    @xpicio
    Author

    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.

  5. HHobeck commented on Mar 30, 2023

    @HHobeck
    Contributor

    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?

  6. xpicio commented on Mar 30, 2023

    @xpicio
    Author

    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).

  7. added this to the 6.x milestone on Mar 30, 2023
  8. changed the title [-]Same version computed on different branches[/-] [+][Feature] Same version computed on different branches[/+] on Jun 9, 2023
  9. github-actions commented on Sep 29, 2023

    @github-actions

    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.

  10. modified the milestones: 6.x, 6.0.0-beta.6 on Mar 9, 2024
  11. arturcic commented on Mar 9, 2024

    @arturcic
    Member

    🎉 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions