Skip to content

[Docs] Understanding commit count source  #3589

@carmine-ianniello-deltatre

Description

Hello,

we are working with Azure DevOps on-premise agent and with a mono branch repository.
That means that we have our repo with the main branch and create a new branch from there with a feature/fix/whatever branch name, we create a PR and then we merge this feature into the main. So, we don't have any develop branch, or another branch either

At the end of the story, we basically have the main branch always upgraded.
With this scenario, we are continuous delivery code on the DEV environment, and we are using the GitVersion tool (5.11.1) with an alpha tag.
All our images are so tagged with 0.1.0-alpha0001 and so on.

When we are ready to go in the upper environments, we are going to manually tag our main branch (generally at the end of a sprint).
So let's say we created the 1.0.0-rc tag on our main branch.
We now release our new image into the upper env, which is going to take only images with -rc tag.

After that, we keep working on the main branch as always (new branch, PR, merge), if we need to fix something on a specific version, we checkout onto a specific tag, fix that version, and merge that fix again onto main to have the next release with the fix too.

So far so good.

From what I noticed, after we manually tag the main branch, the commit count source from git version, starts again from zero, taking into consideration that the manual tag applied.
What I mean is that, after our release candidate (1.0.1-rc), the next alpha version is going to start from 1.0.1 and not from 0.1.0.
So now all our next images for the dev env will be tagged as 1.0.1-alpha0001, 0002 and so on.

But after a while, we are going to tag our main branch again, with another tag but with the same semantic version.
So our main branch is going to have:

  • 1 tag for rc like: 1.0.0-rc
  • and another one like: 1.0.0-stable.

We are using this method because is the way we are going to "separate" the image for each environment:
one env is going to have only rc tag, and another is only stable tag, the dev env is always going to have only the alpha tag autogenerate from the GitVersion.

The problem is that each time we are going to tag our main branch, the counting start from zero, leading to a have again the same 1.0.0-alpha0001, 0002 for the dev env.
Is there a way to tell to GitVersion to keep in consideration also the tag that we are putting after the semantic version?
Or a way to tell to keep incrementing the alpha tag?

Thanks!

This is our gitversion file:

     branches:
        main:
          regex: ^master$|^main$
          mode: ContinuousDeployment
          tag: alpha
          increment: Minor
          prevent-increment-of-merged-branch-version: false
          track-merge-target: true
          source-branches: [ ]
          tracks-release-branches: true
          is-release-branch: false
          is-mainline: true
          pre-release-weight: 0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions