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

Version not incrementing correctly in mode ContinuousDeployment for the branch #2628

Closed
brvaland opened this issue Mar 19, 2021 · 2 comments
Closed
Labels

Comments

@brvaland
Copy link

brvaland commented Mar 19, 2021

Describe the bug
I have an issue where version is not incrementing correctly on every commit on release branch. The below method we are trying to implement:-

The master branch (v1.0.0) we create a new branch for the bug and it is merged back to master. Gitversion generate new version v.1.0.0-beta.1. Once we are ready to release i create a release branch (release/v1.0.0)

The build is triggered and with v1.0.0 for the release and if we are go around and fix any bugs on release branch we increment minor version and it only works fine for first commit i.e. pull request merge but later once it is stuck on the same version.

master              -- v1.0.0
release/v1.0        -- v1.0.0 (Build is triggered and last commit is tagged to v1.0.0) 
  -- 1st PR Merged  -- v1.0.1 (Build is triggered but not tagged)
  -- 2nd PR Merged  -- v1.0.1 ( Expected it to be v1.0.2)
mode: Mainline
continuous-delivery-fallback-tag: ""
major-version-bump-message: '\+semver:\s?(breaking|major)'
minor-version-bump-message: '\+semver:\s?(feature|minor)'
patch-version-bump-message: '\+semver:\s?(fix|patch)'
commit-message-incrementing: MergeMessageOnly

branches:
  master:
    increment: None
    tag: "dev"
  release:
    mode: ContinuousDeployment
    regex: release?[/]
    increment: Patch
    tag: ''
    is-release-branch: true
    prevent-increment-of-merged-branch-version: true
  pull-request:
    mode: ContinuousDeployment
    tag: "pr"
    increment: None
    prevent-increment-of-merged-branch-version: false
    tag-number-pattern: '[/-](?<number>\d+)[-/]'
    track-merge-target: false
    regex: (pull|pull\-requests|pr|[0-9]+)[/-]
    tracks-release-branches: false
    is-release-branch: false

ignore:
  sha: []
merge-message-formats: {}
  • Version Used:
    Windows 10
    dotnet-gitversion - v5.6.6
@brvaland brvaland added the bug label Mar 19, 2021
@asbjornu
Copy link
Member

asbjornu commented Apr 8, 2021

Release branches are special since their version number is sourced from the branch name. You can see some of the logic involved in #1541. Please have a look through the existing tests and whether your use-case is covered or not. If it isn't and can be fixed without breaking existing tests, a PR is welcome.

@HHobeck
Copy link
Contributor

HHobeck commented Mar 21, 2023

It seems to me that this is not a bug report rather then a question. Please have a look to the following integration tests which has been executed succesfully on main:

[Test]
public void ActualBehaviorFor2628()
{
    var configuration = GitFlowConfigurationBuilder.New
        .WithBranch("main", _ => _
            .WithVersioningMode(VersioningMode.Mainline)
            .WithIncrement(IncrementStrategy.Minor)
        ).WithBranch("release", _ => _
            .WithVersioningMode(VersioningMode.Mainline)
            .WithIncrement(IncrementStrategy.Patch)
            .WithLabel("").WithIsMainline(true)
        ).Build();

    using var fixture = new EmptyRepositoryFixture("main");

    fixture.MakeATaggedCommit("1.0.0");

    // ✅ succeeds as expected
    fixture.AssertFullSemver("1.0.0", configuration);

    fixture.BranchTo("release/just-a-release");
    fixture.MakeACommit();

    // ✅ succeeds as expected
    fixture.AssertFullSemver("1.0.1", configuration);

    fixture.MakeACommit();

    // ✅ succeeds as expected
    fixture.AssertFullSemver("1.0.2", configuration);
}

@HHobeck HHobeck closed this as completed Mar 21, 2023
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

3 participants