[Bug] 5.5.1 Continue failing to get version when building from tag #2456
Closed
Description
Describe the bug
As fix for bug #2074 was released in v5.5.1, I've checked that maybe I'm running in a different scenario:
We are using TrunkBasedDevelopment (TBD) with a configuration file like:
mode: ContinuousDeployment
assembly-informational-format: '{FullSemVer}'
branches:
develop:
increment: Minor
regex: master
tracks-release-branches: true
prevent-increment-of-merged-branch-version: true
track-merge-target: false
tag: 'dev'
master:
regex: none
hotfix:
regex: ^fix(es)?[/-]
source-branches: ['develop']
feature:
regex: ^features?[/-]
source-branches: ['develop']
release:
regex: ^releases?[/-]
source-branches: ['develop']
increment: Patch
tag: 'qa'
Expected Behavior
The build for a tagged commit shoud be calculated as 1.0.4
Actual Behavior
The build number is being calculated as 1.1.0-tags-1-0-4.1+15
--------------------------
Installing GitVersion.Tool version 5.x
--------------------------
Herramienta encontrada en caché: GitVersion.Tool 5.5.1 x64
Anteponiendo la variable de entorno de la ruta con el directorio: C:\agents\A\_work\_tool\GitVersion.Tool\5.5.1\x64
[command]C:\agents\A\_work\_tool\GitVersion.Tool\5.5.1\x64\dotnet-gitversion.exe C:/agents/A/_work/56/s /output buildserver /nofetch /config C:\agents\A\_work\56\s\gitversion.yml
INFO [11/16/20 13:17:40:44] Working directory: C:/agents/A/_work/56/s
INFO [11/16/20 13:17:40:50] Branch from build environment: refs/tags/1.0.4
INFO [11/16/20 13:17:40:50] Project root is: C:\agents\A\_work\56\s\
INFO [11/16/20 13:17:40:50] DotGit directory is: C:\agents\A\_work\56\s\.git
INFO [11/16/20 13:17:40:50] Begin: Normalizing git directory for branch 'refs/tags/1.0.4'
INFO [11/16/20 13:17:40:58] One remote found (origin -> 'https://xxxxxx.xxx.es/tfs/xxxx/xxxx/_git/VC-xxxx').
INFO [11/16/20 13:17:40:59] Skipping fetching, if GitVersion does not calculate your version as expected you might need to allow fetching or use dynamic repositories
INFO [11/16/20 13:17:40:60] Updating local branch refs/heads/tags/1.0.4 to match ref refs/tags/1.0.4
INFO [11/16/20 13:17:40:65] Skipping update of 'refs/remotes/origin/master' as it already matches the remote ref.
INFO [11/16/20 13:17:40:65] Skipping update of 'refs/remotes/origin/release/1.0' as it already matches the remote ref.
INFO [11/16/20 13:17:40:65] HEAD points at branch 'refs/heads/tags/1.0.4'.
INFO [11/16/20 13:17:40:66] End: Normalizing git directory for branch 'refs/tags/1.0.4' (Took: 157.66ms)
INFO [11/16/20 13:17:40:68] Begin: Loading version variables from disk cache
INFO [11/16/20 13:17:40:68] Cache file C:\agents\A\_work\56\s\.git\gitversion_cache\0D4992420BC26C0F4E217312F6BEF95837839E5D.yml not found.
INFO [11/16/20 13:17:40:68] End: Loading version variables from disk cache (Took: 0.68ms)
INFO [11/16/20 13:17:40:82] Using latest commit on specified branch
INFO [11/16/20 13:17:40:83] No branch configuration found for branch tags/1.0.4, falling back to default configuration
INFO [11/16/20 13:17:40:83] Begin: Attempting to inherit branch configuration from parent branch
INFO [11/16/20 13:17:40:85] HEAD is merge commit, this is likely a pull request using tags/1.0.4 as base
INFO [11/16/20 13:17:40:86] Begin: Finding branch source of 'tags/1.0.4'
INFO [11/16/20 13:17:40:88] Begin: Finding merge base between 'tags/1.0.4' and 'fix/closebox-log'.
INFO [11/16/20 13:17:40:88] Found merge base of a1225f6caa7978e06f667af74eb81191b19941d8
INFO [11/16/20 13:17:40:89] Merge base of tags/1.0.4' and 'fix/closebox-log is a1225f6caa7978e06f667af74eb81191b19941d8
INFO [11/16/20 13:17:40:89] End: Finding merge base between 'tags/1.0.4' and 'fix/closebox-log'. (Took: 13.62ms)
INFO [11/16/20 13:17:40:89] Begin: Finding merge base between 'tags/1.0.4' and 'fix/pipelines'.
INFO [11/16/20 13:17:40:89] Found merge base of a1225f6caa7978e06f667af74eb81191b19941d8
INFO [11/16/20 13:17:40:89] Merge base of tags/1.0.4' and 'fix/pipelines is a1225f6caa7978e06f667af74eb81191b19941d8
INFO [11/16/20 13:17:40:89] End: Finding merge base between 'tags/1.0.4' and 'fix/pipelines'. (Took: 0.81ms)
INFO [11/16/20 13:17:40:89] Begin: Finding merge base between 'tags/1.0.4' and 'fix/reprint'.
INFO [11/16/20 13:17:40:89] Found merge base of a1225f6caa7978e06f667af74eb81191b19941d8
INFO [11/16/20 13:17:40:89] Merge base of tags/1.0.4' and 'fix/reprint is a1225f6caa7978e06f667af74eb81191b19941d8
INFO [11/16/20 13:17:40:89] End: Finding merge base between 'tags/1.0.4' and 'fix/reprint'. (Took: 1.23ms)
INFO [11/16/20 13:17:40:89] Begin: Finding merge base between 'tags/1.0.4' and 'fix/reprint-on-release-1.0'.
INFO [11/16/20 13:17:40:89] Found merge base of 4f69160f43a30dfe31e0ad28b1a33b0c68cc412d
INFO [11/16/20 13:17:40:89] Merge base of tags/1.0.4' and 'fix/reprint-on-release-1.0 is 4f69160f43a30dfe31e0ad28b1a33b0c68cc412d
INFO [11/16/20 13:17:40:89] End: Finding merge base between 'tags/1.0.4' and 'fix/reprint-on-release-1.0'. (Took: 0.37ms)
INFO [11/16/20 13:17:40:89] Begin: Finding merge base between 'tags/1.0.4' and 'master'.
INFO [11/16/20 13:17:40:90] Found merge base of a1225f6caa7978e06f667af74eb81191b19941d8
INFO [11/16/20 13:17:40:90] Merge base of tags/1.0.4' and 'master is a1225f6caa7978e06f667af74eb81191b19941d8
INFO [11/16/20 13:17:40:90] End: Finding merge base between 'tags/1.0.4' and 'master'. (Took: 1.44ms)
INFO [11/16/20 13:17:40:90] Begin: Finding merge base between 'tags/1.0.4' and 'release/1.0'.
INFO [11/16/20 13:17:40:90] Found merge base of 67cbdaa641189c1a1498806696aeb8e64ec96d4e
INFO [11/16/20 13:17:40:90] Merge base of tags/1.0.4' and 'release/1.0 is 67cbdaa641189c1a1498806696aeb8e64ec96d4e
INFO [11/16/20 13:17:40:90] End: Finding merge base between 'tags/1.0.4' and 'release/1.0'. (Took: 0.31ms)
INFO [11/16/20 13:17:40:90] Begin: Finding merge base between 'tags/1.0.4' and 'origin/master'.
INFO [11/16/20 13:17:40:90] Found merge base of a1225f6caa7978e06f667af74eb81191b19941d8
INFO [11/16/20 13:17:40:90] Merge base of tags/1.0.4' and 'origin/master is a1225f6caa7978e06f667af74eb81191b19941d8
INFO [11/16/20 13:17:40:90] End: Finding merge base between 'tags/1.0.4' and 'origin/master'. (Took: 2.82ms)
INFO [11/16/20 13:17:40:90] Begin: Finding merge base between 'tags/1.0.4' and 'origin/release/1.0'.
INFO [11/16/20 13:17:40:90] Found merge base of 67cbdaa641189c1a1498806696aeb8e64ec96d4e
INFO [11/16/20 13:17:40:90] Merge base of tags/1.0.4' and 'origin/release/1.0 is 67cbdaa641189c1a1498806696aeb8e64ec96d4e
INFO [11/16/20 13:17:40:90] End: Finding merge base between 'tags/1.0.4' and 'origin/release/1.0'. (Took: 0.71ms)
INFO [11/16/20 13:17:40:92] Multiple source branches have been found, picking the first one (release/1.0).
This may result in incorrect commit counting.
Options were:
release/1.0, origin/release/1.0, fix/reprint-on-release-1.0, fix/closebox-log, fix/pipelines, fix/reprint, master, origin/master
INFO [11/16/20 13:17:40:92] End: Finding branch source of 'tags/1.0.4' (Took: 61.51ms)
INFO [11/16/20 13:17:40:93] Begin: Getting branches containing the commit '67cbdaa641189c1a1498806696aeb8e64ec96d4e'.
INFO [11/16/20 13:17:40:93] Trying to find direct branches.
INFO [11/16/20 13:17:40:93] No direct branches found, searching through all branches.
INFO [11/16/20 13:17:40:93] Searching for commits reachable from 'fix/closebox-log'.
INFO [11/16/20 13:17:40:94] The branch 'fix/closebox-log' has no matching commits.
INFO [11/16/20 13:17:40:94] Searching for commits reachable from 'fix/pipelines'.
INFO [11/16/20 13:17:40:94] The branch 'fix/pipelines' has no matching commits.
INFO [11/16/20 13:17:40:94] Searching for commits reachable from 'fix/reprint'.
INFO [11/16/20 13:17:40:94] The branch 'fix/reprint' has no matching commits.
INFO [11/16/20 13:17:40:94] Searching for commits reachable from 'fix/reprint-on-release-1.0'.
INFO [11/16/20 13:17:40:94] The branch 'fix/reprint-on-release-1.0' has no matching commits.
INFO [11/16/20 13:17:40:94] Searching for commits reachable from 'master'.
INFO [11/16/20 13:17:40:94] The branch 'master' has no matching commits.
INFO [11/16/20 13:17:40:94] Searching for commits reachable from 'release/1.0'.
INFO [11/16/20 13:17:40:94] The branch 'release/1.0' has a matching commit.
INFO [11/16/20 13:17:40:94] Searching for commits reachable from 'origin/master'.
INFO [11/16/20 13:17:40:95] The branch 'origin/master' has no matching commits.
INFO [11/16/20 13:17:40:95] Searching for commits reachable from 'origin/release/1.0'.
INFO [11/16/20 13:17:40:95] The branch 'origin/release/1.0' has a matching commit.
INFO [11/16/20 13:17:40:95] End: Getting branches containing the commit '67cbdaa641189c1a1498806696aeb8e64ec96d4e'. (Took: 17.18ms)
INFO [11/16/20 13:17:40:95] Begin: Getting branches containing the commit '67cbdaa641189c1a1498806696aeb8e64ec96d4e'.
INFO [11/16/20 13:17:40:95] Trying to find direct branches.
INFO [11/16/20 13:17:40:95] No direct branches found, searching through all branches.
INFO [11/16/20 13:17:40:95] Searching for commits reachable from 'fix/closebox-log'.
INFO [11/16/20 13:17:40:95] The branch 'fix/closebox-log' has no matching commits.
INFO [11/16/20 13:17:40:95] Searching for commits reachable from 'fix/pipelines'.
INFO [11/16/20 13:17:40:95] The branch 'fix/pipelines' has no matching commits.
INFO [11/16/20 13:17:40:95] Searching for commits reachable from 'fix/reprint'.
INFO [11/16/20 13:17:40:96] The branch 'fix/reprint' has no matching commits.
INFO [11/16/20 13:17:40:96] Searching for commits reachable from 'fix/reprint-on-release-1.0'.
INFO [11/16/20 13:17:40:96] The branch 'fix/reprint-on-release-1.0' has no matching commits.
INFO [11/16/20 13:17:40:96] Searching for commits reachable from 'master'.
INFO [11/16/20 13:17:40:96] The branch 'master' has no matching commits.
INFO [11/16/20 13:17:40:96] Searching for commits reachable from 'release/1.0'.
INFO [11/16/20 13:17:40:96] The branch 'release/1.0' has a matching commit.
INFO [11/16/20 13:17:40:96] Searching for commits reachable from 'origin/master'.
INFO [11/16/20 13:17:40:97] The branch 'origin/master' has no matching commits.
INFO [11/16/20 13:17:40:97] Searching for commits reachable from 'origin/release/1.0'.
INFO [11/16/20 13:17:40:97] The branch 'origin/release/1.0' has a matching commit.
INFO [11/16/20 13:17:40:97] End: Getting branches containing the commit '67cbdaa641189c1a1498806696aeb8e64ec96d4e'. (Took: 20.08ms)
INFO [11/16/20 13:17:40:97] Found possible parent branches:
WARN [11/16/20 13:17:40:98] Failed to inherit Increment branch configuration, no branches found.
Falling back to master branch config
INFO [11/16/20 13:17:40:98] End: Attempting to inherit branch configuration from parent branch (Took: 144.11ms)
INFO [11/16/20 13:17:41:07] Running against branch: tags/1.0.4 (67cbdaa641189c1a1498806696aeb8e64ec96d4e)
INFO [11/16/20 13:17:41:08] Current commit is tagged with version 1.0.4, version calculation is for metadata only.
INFO [11/16/20 13:17:41:08] 0 commits found between 67cbdaa641189c1a1498806696aeb8e64ec96d4e and 67cbdaa641189c1a1498806696aeb8e64ec96d4e
INFO [11/16/20 13:17:41:08] Begin: Calculating base versions
INFO [11/16/20 13:17:41:29] Git tag '1.0.4': 1.0.4 with commit count source 67cbdaa641189c1a1498806696aeb8e64ec96d4e
INFO [11/16/20 13:17:41:31] Begin: Finding merge base between 'release/1.0' and 'tags/1.0.4'.
INFO [11/16/20 13:17:41:31] Found merge base of 67cbdaa641189c1a1498806696aeb8e64ec96d4e
INFO [11/16/20 13:17:41:31] Merge base of release/1.0' and 'tags/1.0.4 is 67cbdaa641189c1a1498806696aeb8e64ec96d4e
INFO [11/16/20 13:17:41:31] End: Finding merge base between 'release/1.0' and 'tags/1.0.4'. (Took: 1.69ms)
INFO [11/16/20 13:17:41:33] Git tag '1.0.3': 1.0.3 with commit count source 689a7296ab4777dffcdd720b284fa80c9f4dddf9
INFO [11/16/20 13:17:41:34] Found multiple base versions which will produce the same SemVer (1.1.0), taking oldest source for commit counting (Git tag '1.0.3')
INFO [11/16/20 13:17:41:34] Base version used: Git tag '1.0.3': 1.0.3 with commit count source 689a7296ab4777dffcdd720b284fa80c9f4dddf9
INFO [11/16/20 13:17:41:34] End: Calculating base versions (Took: 258.00ms)
INFO [11/16/20 13:17:41:35] 15 commits found between 689a7296ab4777dffcdd720b284fa80c9f4dddf9 and 67cbdaa641189c1a1498806696aeb8e64ec96d4e
INFO [11/16/20 13:17:41:35] Using branch name to calculate version tag
INFO [11/16/20 13:17:41:35] Begin: Getting version tags from branch 'refs/heads/tags/1.0.4'.
INFO [11/16/20 13:17:41:36] End: Getting version tags from branch 'refs/heads/tags/1.0.4'. (Took: 12.95ms)
INFO [11/16/20 13:17:41:45] Begin: Creating dictionary
INFO [11/16/20 13:17:41:46] End: Creating dictionary (Took: 11.68ms)
INFO [11/16/20 13:17:41:47] Begin: Storing version variables to cache file C:\agents\A\_work\56\s\.git\gitversion_cache\0D4992420BC26C0F4E217312F6BEF95837839E5D.yml
INFO [11/16/20 13:17:41:56] End: Storing version variables to cache file C:\agents\A\_work\56\s\.git\gitversion_cache\0D4992420BC26C0F4E217312F6BEF95837839E5D.yml (Took: 86.74ms)
Executing GenerateSetVersionMessage for 'AzurePipelines'.
Executing GenerateBuildLogOutput for 'AzurePipelines'.
INFO [11/16/20 13:17:41:60] Done writing
##[section]Async Command Start: Actualizar número de compilación
Actualizar número de compilación 1.1.0-tags-1-0-4.1+15 para la compilación 7035
##[section]Async Command End: Actualizar número de compilación
##[section]Finalizando: Use GitVersion
As GitVersion creates a new branch named 'tags/1.0.4' it fails calculating the version.
Steps to Reproduce
When we add a new fix we proceed as follow:
- Create a fix branch solving the bug
- Create a PR to master
- After PR is completed, cherry pick that PR to release/1.0 (for example) branch
- Add a new tag on release/1.0 named 1.0.4 (for example)
You can reproduce it with dotnet gitversion tool:
- git pull
- git checkout release/1.0
- dotnet gitversion >>> version 1.0.4
- git checkout -b tags/1.0.4
- dotnet gitversion >>> version 1.1.0-tags-1-0-4.1
Your Environment
We are using Azure DevOps Server 2019
- Version Used: 5.5.1
- Operating System and version (Windows 10, Ubuntu 18.04): Windows
- Link to your project:
- Link to your CI build (if appropriate):