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

[Bug] Version isn't incremented because of "Mainline" mode #2940

Closed
taodongl opened this issue Dec 10, 2021 · 1 comment
Closed

[Bug] Version isn't incremented because of "Mainline" mode #2940

taodongl opened this issue Dec 10, 2021 · 1 comment
Labels

Comments

@taodongl
Copy link

taodongl commented Dec 10, 2021

We are using GitVersion.yml

mode: Mainline
next-version: 1.0
major-version-bump-message: 'BREAKING CHANGE:? *(\(.*\))?: '
minor-version-bump-message: '(feature|feat):? *(\(.*\))?: '
patch-version-bump-message: '.*:? *(\(.*\))?: '

5.2.4 is the latest workable version. From 5.3.0 to current release, the version calculated by gitversion can't get a newer value.


We know branch can't be configured as "Mainline", because:

    private static void VerifyReadConfig(Config config)
    {
        // Verify no branches are set to mainline mode
        if (config.Branches.Any(b => b.Value?.VersioningMode == VersioningMode.Mainline))
        {
            throw new ConfigurationException(@"Mainline mode only works at the repository level, a single branch cannot be put into mainline mode

This is because mainline mode treats your entire git repository as an event source with each merge into the 'mainline' incrementing the version.

If the docs do not help you decide on the mode open an issue to discuss what you are trying to do.");
        }
    }

Thought the document said By default, GitVersion is set up to do Continuous Delivery on all branches but develop,
But when general mode is "Mainline", and mode of branch is null, mode of branch would be set to "Mainline"

Gitversion Code

    private static void FinalizeBranchConfiguration(Config config, string name, BranchConfig? branchConfig)
    {
        ......

        if (branchConfig.VersioningMode == null)
        {
            if (name == Config.DevelopBranchKey)
            {
                branchConfig.VersioningMode = config.VersioningMode == VersioningMode.Mainline ? VersioningMode.Mainline : VersioningMode.ContinuousDeployment;
            }
            else
            {
                branchConfig.VersioningMode = config.VersioningMode; // ---> mode of branch become "Mainline"
            }
        }
        ... ...
    }

I think the above code causes the issue.

@taodongl taodongl added the bug label Dec 10, 2021
@asbjornu
Copy link
Member

See #2441. Remove next-version from GitVersion.yml and add a git tag 1.0 on the appropriate commit instead.

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

No branches or pull requests

2 participants