Skip to content

[Bug] Problem with git flow and Microsoft Azure Pipelines #2206

@black-snake

Description

@black-snake

Hi there,
thanks for your great project -- it eases configuration management.

Describe the bug

I'm trying to use GitVersion on Microsoft Azure Pipelines together with git flow but I'm experiencing some difficulties that may be related to a bug or the problem is simply sitting in front of the monitor: hotfixes get the wrong version.

Expected Behavior

The build of the commit with tag 0.5.12 should produce version 0.5.12.

Actual Behavior

The build of the commit with tag 0.5.12 produces version 0.6.0-tags-0-5-12.1+13.

Possible Fix

What I found out is that when I am quickly enough with pushing the branches master and develop (including tags), the CI build of the (last commit of) hotfix/0.5.12 branch will produce a version 0.5.12. This, of course, is due to the fact that git flow tags the last commit of the hotfix branch and then merges into the branches master and develop.

However, when I'm slower with pushing the branches master and develop, the actual behavior is observed (see above).

IMHO, the stable version should not be built on the hotfix branch but on the master branch by the merge into it.

Steps to Reproduce

I use git flow to create a new hotfix by typing git flow hotfix start 0.5.12 and then commit and push on the hotfix branch. After finishing my changes I close the hotfix with git flow hotfix finish 0.5.12. Some minutes later, I push the branches master and develop to the remote (Microsoft Azure DevOps).

Context

I'm trying establish a hotfix release process with proper versioning.

Your Environment

  • Version Used: 5.2.4
  • Operating System and version: Ubuntu 18.04

GitVersion.yml

assembly-versioning-scheme: MajorMinorPatch
mode: ContinuousDeployment
branches: {}
ignore:
  sha: []
merge-message-formats: {}

azure-pipelines.yml

trigger:
  branches:
    include:
      - '*'
    exclude:
      - master
  tags:
    include:
      - '*'

pool:
  vmImage: 'ubuntu-latest'

jobs:
- job: pack_and_publish
  variables:
  - group: Release Configuration
  displayName: Packing and Publishing
  dependsOn: build_and_test
  steps:
    - task: UseGitVersion@5
      displayName: GitVersion
      inputs:
        versionSpec: '5.x'
    - task: DotNetCoreCLI@2
      displayName: dotnet restore
      inputs:
        command: 'restore'
        feedsToUse: 'select'
        verbosityRestore: 'Normal'
    - task: DotNetCoreCLI@2
      displayName: dotnet pack
      inputs:
        command: 'pack'
        packagesToPack: '**/*.csproj'
        includesymbols: true
        versioningScheme: 'byEnvVar'
        versionEnvVar: 'GitVersion_NuGetVersionV2'
        verbosityPack: 'Normal'
    - task: PublishBuildArtifacts@1
      displayName: publish build artifacts
      inputs:
        PathtoPublish: '$(Build.ArtifactStagingDirectory)'
        ArtifactName: 'packages'
        publishLocation: 'Container'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions