Skip to content

[Bug] Don't inherit semver on an Azure DevOps PullRequest #3180

@enriqueraso

Description

@enriqueraso

Describe the bug
When creating a PullRequest on an Azure DevOps repository, no matter you autoincrement minor or patch based on your gitversion.xml configuration, it doesn't inherit from source branch on PullRequest completion.

Expected Behavior

It should works as in local, it inherits semver when you merge source branch to target branch configured to inherit. Although it doesn't work on local when you tried to simulate Azure DevOps environment.

Actual Behavior

When you merge source branch to target branch configured to inherit, it works on a merge but not in a PullRequest in Azure DevOps. Also it doesn't work reproducing an Azure DevOps environment locally.

Possible Fix

After debugged it, it only requires to detect PullRequest properly on a ReferenceName class.

Steps to Reproduce

GitVersion.Tool 5.10.3 installed on Azure DevOps.

image

Content of gitversion.xml

assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatch
assembly-informational-format: '{InformationalVersion}'
mode: ContinuousDelivery
branches: 
  main:
    regex: ^main$
    tag: rc
    increment: None
    is-source-branch-for:
    - bug
    - feature
    prevent-increment-of-merged-branch-version: true
    track-merge-target: false
    tracks-release-branches: false
    is-release-branch: false
    is-mainline: true
    pre-release-weight: 55000
  release:
    regex: ^releases[/-]
    tag: ''
    increment: Inherit
    source-branches:
    - main
    is-source-branch-for:
    - retrofit-bug
    - retrofit-feature
    prevent-increment-of-merged-branch-version: false
    track-merge-target: false
    tracks-release-branches: false
    is-release-branch: true
    is-mainline: true
    pre-release-weight: 55000
  pull-request:
    regex: ^pull[/-]
    tag: 'beta.{BranchName}'
    increment: Inherit
    source-branches:
    - retrofit-bug
    - retrofit-feature
    - bug
    - feature
    prevent-increment-of-merged-branch-version: false
    track-merge-target: false
    tracks-release-branches: false
    is-release-branch: false
    is-mainline: false
    pre-release-weight: 30000
  retrofit-bug:
    regex: ^retrofit/bugs[/-]
    tag: beta.{BranchName}
    increment: Patch
    source-branches: 
    - release
    prevent-increment-of-merged-branch-version: false
    track-merge-target: true
    tracks-release-branches: false
    is-release-branch: false
    is-mainline: false
    pre-release-weight: 30000
  retrofit-feature:
    regex: ^retrofit[/-]
    tag: beta.{BranchName}
    increment: Minor
    source-branches:
    - release
    prevent-increment-of-merged-branch-version: false
    track-merge-target: true
    tracks-release-branches: false
    is-release-branch: false
    is-mainline: false
    pre-release-weight: 30000
  bug:
    regex: ^bugs[/-]
    tag: beta.{BranchName}
    increment: None
    source-branches:
    - main
    prevent-increment-of-merged-branch-version: false
    track-merge-target: false
    tracks-release-branches: false
    is-release-branch: false
    is-mainline: false
    pre-release-weight: 30000
  feature:
    regex: ^(?!.*main)(?!.*releases)(?!.*pull)(?!.*retrofit)(?!.*bugs).*
    tag: beta.{BranchName}
    increment: None
    source-branches:
    - main
    prevent-increment-of-merged-branch-version: false
    track-merge-target: false
    tracks-release-branches: false
    is-release-branch: false
    is-mainline: false
    pre-release-weight: 30000
ignore:
  sha: []
merge-message-formats: {}

Results of a PullRequest completion that doesn't inherit incremented Patch.

image

Results of a PullRequest with the fix.

image

Context

Without this fix, we can not use GitVersion in Azure DevOps.

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