Skip to content

GitVersion for PR branch on Azure DevOps not working as expected #1765

@onlyutkarsh

Description

@onlyutkarsh

Not entirely sure that it is a gitversion issue but it used to work for us before. Our gitversion.yml is as below

next-version: 1.0
assembly-informational-format: '{MajorMinorPatch}'
mode: ContinuousDeployment
branches:
  master:
    tag: ''
  release:
    tag: rc
  feature:
    tag: alpha
    increment: Patch
  pull-request:
    tag: pr
  hotfix:
    tag: rc
  support:
    tag: s
  develop:
    tag: beta

We now use GitVersion task in Azure DevOps pipelines and I see that pull requests are being tagged as PullRequest instead of what is defined in gitversion.yml file pr

I see following in the logs, any idea what is causing this?

##[section]Starting: GitVersion
==============================================================================
Task         : GitVersion Task
Description  : Easy Semantic Versioning (http://semver.org) for projects using Git
Version      : 5.0.0
Author       : GitVersion Contributors
Help         : See the [documentation](http://gitversion.readthedocs.org/en/latest/) for help
==============================================================================
[command]"C:\Program Files\dotnet\dotnet.exe" C:\a\vm1-1\_work\_tasks\GitVersion_e5983830-3f75-11e5-82ed-81492570a08e\5.0.0\core\GitVersion.dll C:\a\vm1-1\_work\40\s /output buildserver /nofetch /config C:\a\vm1-1\_work\40\s
INFO [08/06/19 11:09:10:85] Working directory: C:\a\vm1-1\_work\40\s
INFO [08/06/19 11:09:10:88] IsDynamicGitRepository: False
INFO [08/06/19 11:09:10:90] Returning Project Root from DotGitDirectory: C:\a\vm1-1\_work\40\s\.git - C:\a\vm1-1\_work\40\s
INFO [08/06/19 11:09:10:90] Running on Windows.
INFO [08/06/19 11:09:10:90] Applicable build agent found: 'VsoAgent'.
INFO [08/06/19 11:09:10:91] Branch from build environment: refs/pull/3378/merge
INFO [08/06/19 11:09:10:91] Begin: Normalizing git directory for branch 'refs/pull/3378/merge'
  INFO [08/06/19 11:09:10:96] One remote found (origin -> 'https://xxxxxxx.visualstudio.com/PDTO/_git/xxxxxxxx').
  INFO [08/06/19 11:09:10:97] Skipping fetching, if GitVersion does not calculate your version as expected you might need to allow fetching or use dynamic repositories
  INFO [08/06/19 11:09:10:98] Creating local branch refs/heads/pull/3378/merge pointing at f36495a7db3887b0a1e87ecece703639eba12fce
  INFO [08/06/19 11:09:11:06] Creating local branch from remote tracking 'refs/remotes/origin/develop'.
  INFO [08/06/19 11:09:11:10] Creating local branch from remote tracking 'refs/remotes/origin/feature/export-import-task'.
  INFO [08/06/19 11:09:11:12] Creating local branch from remote tracking 'refs/remotes/origin/feature/kishore/sprint18'.
  INFO [08/06/19 11:09:11:14] Creating local branch from remote tracking 'refs/remotes/origin/feature/Sanjib/Sprint26'.
  INFO [08/06/19 11:09:11:17] Creating local branch from remote tracking 'refs/remotes/origin/feature/Sanjib/Sprint29'.
  INFO [08/06/19 11:09:11:18] Creating local branch from remote tracking 'refs/remotes/origin/master'.
  INFO [08/06/19 11:09:11:20] HEAD points at branch 'refs/heads/pull/3378/merge'.
  INFO [08/06/19 11:09:11:20] End: Normalizing git directory for branch 'refs/pull/3378/merge' (Took: 297.37ms)
  INFO [08/06/19 11:09:11:20] IsDynamicGitRepository: False
  INFO [08/06/19 11:09:11:20] Returning Project Root from DotGitDirectory: C:\a\vm1-1\_work\40\s\.git - C:\a\vm1-1\_work\40\s
  INFO [08/06/19 11:09:11:20] Project root is: C:\a\vm1-1\_work\40\s
  INFO [08/06/19 11:09:11:20] DotGit directory is: C:\a\vm1-1\_work\40\s\.git
  INFO [08/06/19 11:09:11:22] IsDynamicGitRepository: False
  INFO [08/06/19 11:09:11:22] Returning Project Root from DotGitDirectory: C:\a\vm1-1\_work\40\s\.git - C:\a\vm1-1\_work\40\s
  INFO [08/06/19 11:09:11:22] Begin: Loading version variables from disk cache
    INFO [08/06/19 11:09:11:23] Cache file C:\a\vm1-1\_work\40\s\.git\gitversion_cache\C9FCFA0F317896D78E9F68B0D1C00BBC7F985654.yml not found.
  INFO [08/06/19 11:09:11:23] End: Loading version variables from disk cache (Took: 1.10ms)
  INFO [08/06/19 11:09:11:23] IsDynamicGitRepository: False
  INFO [08/06/19 11:09:11:23] Returning Project Root from DotGitDirectory: C:\a\vm1-1\_work\40\s\.git - C:\a\vm1-1\_work\40\s
  INFO [08/06/19 11:09:11:25] Using latest commit on specified branch
  INFO [08/06/19 11:09:11:27] Begin: Attempting to inherit branch configuration from parent branch
    INFO [08/06/19 11:09:11:28] HEAD is merge commit, this is likely a pull request using feature/export-import-task as base
    INFO [08/06/19 11:09:11:28] Begin: Finding branch source of 'feature/export-import-task'
      INFO [08/06/19 11:09:11:30] Begin: Finding merge base between 'feature/export-import-task' and 'develop'.
        INFO [08/06/19 11:09:11:31] Found merge base of ed695579ea3ac3a93c875394af3c89cbef3ef5a0
        INFO [08/06/19 11:09:11:32] Merge base of feature/export-import-task' and 'develop is ed695579ea3ac3a93c875394af3c89cbef3ef5a0
      INFO [08/06/19 11:09:11:32] End: Finding merge base between 'feature/export-import-task' and 'develop'. (Took: 15.07ms)
      INFO [08/06/19 11:09:11:32] Begin: Finding merge base between 'feature/export-import-task' and 'master'.
        INFO [08/06/19 11:09:11:32] Found merge base of d834375ed294be7a8f767cf4c42840ba330927e4
        INFO [08/06/19 11:09:11:32] Merge base of feature/export-import-task' and 'master is d834375ed294be7a8f767cf4c42840ba330927e4
      INFO [08/06/19 11:09:11:32] End: Finding merge base between 'feature/export-import-task' and 'master'. (Took: 2.04ms)
      INFO [08/06/19 11:09:11:34] Multiple source branches have been found, picking the first one (develop).
This may result in incorrect commit counting.
Options were:
 develop, master
    INFO [08/06/19 11:09:11:34] End: Finding branch source of 'feature/export-import-task' (Took: 50.95ms)
    INFO [08/06/19 11:09:11:34] Begin: Getting branches containing the commit 'ed695579ea3ac3a93c875394af3c89cbef3ef5a0'.
      INFO [08/06/19 11:09:11:34] Trying to find direct branches.
      INFO [08/06/19 11:09:11:34] No direct branches found, searching through tracked branches.
      INFO [08/06/19 11:09:11:34] Searching for commits reachable from 'origin/develop'.
      INFO [08/06/19 11:09:11:34] The branch 'origin/develop' has a matching commit.
      INFO [08/06/19 11:09:11:34] Searching for commits reachable from 'origin/master'.
      INFO [08/06/19 11:09:11:34] The branch 'origin/master' has no matching commits.
    INFO [08/06/19 11:09:11:34] End: Getting branches containing the commit 'ed695579ea3ac3a93c875394af3c89cbef3ef5a0'. (Took: 3.60ms)
    INFO [08/06/19 11:09:11:34] Found possible parent branches: origin/develop
  INFO [08/06/19 11:09:11:34] End: Attempting to inherit branch configuration from parent branch (Took: 77.11ms)
  INFO [08/06/19 11:09:11:35] Running against branch: pull/3378/merge (f36495a7db3887b0a1e87ecece703639eba12fce)
  INFO [08/06/19 11:09:11:35] Begin: Calculating base versions
    INFO [08/06/19 11:09:11:36] Fallback base version: 0.1.0 with commit count source d834375ed294be7a8f767cf4c42840ba330927e4 (Incremented: None)
    INFO [08/06/19 11:09:11:49] Found multiple base versions which will produce the same SemVer (0.1.0), taking oldest source for commit counting (Fallback base version)
    INFO [08/06/19 11:09:11:49] Base version used: Fallback base version: 0.1.0 with commit count source d834375ed294be7a8f767cf4c42840ba330927e4 (Incremented: None)
  INFO [08/06/19 11:09:11:49] End: Calculating base versions (Took: 133.98ms)
  INFO [08/06/19 11:09:11:50] Skipping version increment
  INFO [08/06/19 11:09:11:50] 192 commits found between d834375ed294be7a8f767cf4c42840ba330927e4 and f36495a7db3887b0a1e87ecece703639eba12fce
  INFO [08/06/19 11:09:11:50] Begin: Getting version tags from branch 'refs/heads/pull/3378/merge'.
  INFO [08/06/19 11:09:11:51] End: Getting version tags from branch 'refs/heads/pull/3378/merge'. (Took: 5.43ms)
  INFO [08/06/19 11:09:11:52] Begin: Creating dictionary
  INFO [08/06/19 11:09:11:53] End: Creating dictionary (Took: 7.84ms)
  INFO [08/06/19 11:09:11:54] Begin: Storing version variables to cache file C:\a\vm1-1\_work\40\s\.git\gitversion_cache\C9FCFA0F317896D78E9F68B0D1C00BBC7F985654.yml
  INFO [08/06/19 11:09:11:62] End: Storing version variables to cache file C:\a\vm1-1\_work\40\s\.git\gitversion_cache\C9FCFA0F317896D78E9F68B0D1C00BBC7F985654.yml (Took: 80.27ms)
  INFO [08/06/19 11:09:11:62] Applicable build agent found: 'VsoAgent'.
Executing GenerateSetVersionMessage for 'VsoAgent'.
Executing GenerateBuildLogOutput for 'VsoAgent'.
##[section]Async Command Start: Update Build Number
Update build number to 0.1.0-PullRequest3378.192 for build 18013
##[section]Async Command End: Update Build Number
##[section]Finishing: GitVersion


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions