Comments (9)
I believe this is fixed in v6. Can you upgrade and try it out?
from gitversion.
It doesn't seem fixed, as GitVersion still generates a prerelease version. I had to change mode: Mainline
to workflow: TrunkBased/v1
but I did not make any other changes to the config file. I'm not sure if that is correct, but I still see this line in the output logs:
INFO [04/30/24 13:09:20:46] TrunkBasedVersionStrategy: Force version increment '0.1.2' +semver 'Patch' with label 'tags-v_0-1-2' based on commit 'dc43f3b'.
and I don't think it should add any +semver here because commit dc43f3b is exactly the commit where tag v_0.1.2 points to.
This is the full output from a v6 run:
/opt/hostedtoolcache/GitVersion.Tool/6.0.0-beta.7/x64/dotnet-gitversion /home/vsts/work/1/s /output json /output buildserver /config /home/vsts/work/1/_automation/config/gitversion.yaml
INFO [04/30/24 13:09:20:01] Working directory: /home/vsts/work/1/s
INFO [04/30/24 13:09:20:02] Project root is: /home/vsts/work/1/s/
INFO [04/30/24 13:09:20:02] DotGit directory is: /home/vsts/work/1/s/.git
INFO [04/30/24 13:09:20:02] Branch from build environment: refs/tags/v_0.1.2
INFO [04/30/24 13:09:20:02] -< Begin: Normalizing git directory for branch 'refs/tags/v_0.1.2' >-
INFO [04/30/24 13:09:20:05] One remote found (origin -> 'https://[email protected]/$org/$proj/_git/$repo').
INFO [04/30/24 13:09:20:06] Skipping fetching, if GitVersion does not calculate your version as expected you might need to allow fetching or use dynamic repositories
INFO [04/30/24 13:09:20:06] Creating local branch tags/v_0.1.2 pointing at dc43f3b
INFO [04/30/24 13:09:20:09] Creating local branch from remote tracking 'refs/remotes/origin/feature/1648-snip-branch-name'.
INFO [04/30/24 13:09:20:10] Creating local branch from remote tracking 'refs/remotes/origin/main'.
INFO [04/30/24 13:09:20:11] HEAD points at branch 'refs/heads/tags/v_0.1.2'.
INFO [04/30/24 13:09:20:11] -< End: Normalizing git directory for branch 'refs/tags/v_0.1.2' (Took: 89.83ms) >-
INFO [04/30/24 13:09:20:13] -< Begin: Loading version variables from disk cache file /home/vsts/work/1/s/.git/gitversion_cache/CCA1D0FE3372DDA3A3818BCD8368D89CB00A09C7 >-
INFO [04/30/24 13:09:20:13] Cache file /home/vsts/work/1/s/.git/gitversion_cache/CCA1D0FE3372DDA3A3818BCD8368D89CB00A09C7 not found.
INFO [04/30/24 13:09:20:13] -< End: Loading version variables from disk cache file /home/vsts/work/1/s/.git/gitversion_cache/CCA1D0FE3372DDA3A3818BCD8368D89CB00A09C7 (Took: 0.17ms) >-
INFO [04/30/24 13:09:20:31] Using latest commit on specified branch
INFO [04/30/24 13:09:20:33] Getting tagged semantic versions. TagPrefix: [vV]_ and Format: Strict
INFO [04/30/24 13:09:20:38] Running against branch: tags/v_0.1.2 ('dc43f3b' - Merged PR 5351: [snip PR message])
INFO [04/30/24 13:09:20:38] -< Begin: Fetching the base versions for version calculation... >-
INFO [04/30/24 13:09:20:39] Calculating base versions for 'tags/v_0.1.2'
INFO [04/30/24 13:09:20:39] -< Begin: [Using 'ConfiguredNextVersionVersionStrategy' strategy] >-
INFO [04/30/24 13:09:20:39] -< End: [Using 'ConfiguredNextVersionVersionStrategy' strategy] (Took: 0.53ms) >-
INFO [04/30/24 13:09:20:39] -< Begin: [Using 'MergeMessageVersionStrategy' strategy] >-
INFO [04/30/24 13:09:20:39] -< End: [Using 'MergeMessageVersionStrategy' strategy] (Took: 0.39ms) >-
INFO [04/30/24 13:09:20:39] -< Begin: [Using 'TaggedCommitVersionStrategy' strategy] >-
INFO [04/30/24 13:09:20:39] -< End: [Using 'TaggedCommitVersionStrategy' strategy] (Took: 0.21ms) >-
INFO [04/30/24 13:09:20:39] -< Begin: [Using 'TrackReleaseBranchesVersionStrategy' strategy] >-
INFO [04/30/24 13:09:20:39] -< End: [Using 'TrackReleaseBranchesVersionStrategy' strategy] (Took: 0.14ms) >-
INFO [04/30/24 13:09:20:39] -< Begin: [Using 'TrunkBasedVersionStrategy' strategy] >-
INFO [04/30/24 13:09:20:40] -< Begin: Getting tagged semantic versions on branch 'refs/heads/tags/v_0.1.2'. TagPrefix: [vV]_ and Format: Strict >-
INFO [04/30/24 13:09:20:40] -< End: Getting tagged semantic versions on branch 'refs/heads/tags/v_0.1.2'. TagPrefix: [vV]_ and Format: Strict (Took: 3.14ms) >-
INFO [04/30/24 13:09:20:40] -< Begin: Getting tagged semantic versions of mainline branches. TagPrefix: [vV]_ and Format: Strict >-
INFO [04/30/24 13:09:20:41] -< Begin: Getting tagged semantic versions on branch 'refs/heads/main'. TagPrefix: [vV]_ and Format: Strict >-
INFO [04/30/24 13:09:20:41] -< End: Getting tagged semantic versions on branch 'refs/heads/main'. TagPrefix: [vV]_ and Format: Strict (Took: 0.70ms) >-
INFO [04/30/24 13:09:20:41] -< Begin: Getting tagged semantic versions on branch 'refs/remotes/origin/main'. TagPrefix: [vV]_ and Format: Strict >-
INFO [04/30/24 13:09:20:41] -< End: Getting tagged semantic versions on branch 'refs/remotes/origin/main'. TagPrefix: [vV]_ and Format: Strict (Took: 0.65ms) >-
INFO [04/30/24 13:09:20:41] -< End: Getting tagged semantic versions of mainline branches. TagPrefix: [vV]_ and Format: Strict (Took: 3.94ms) >-
INFO [04/30/24 13:09:20:42] -< Begin: Finding branches source of 'tags/v_0.1.2' >-
INFO [04/30/24 13:09:20:42] -< Begin: Finding merge base between 'tags/v_0.1.2' and 'main'. >-
INFO [04/30/24 13:09:20:43] Found merge base of ''dc43f3b' - Merged PR 5351: [snip PR message]'
INFO [04/30/24 13:09:20:43] Merge base of 'tags/v_0.1.2' and 'main' is ''dc43f3b' - Merged PR 5351: [snip PR message]'
INFO [04/30/24 13:09:20:43] -< End: Finding merge base between 'tags/v_0.1.2' and 'main'. (Took: 9.99ms) >-
INFO [04/30/24 13:09:20:43] -< Begin: Finding merge base between 'tags/v_0.1.2' and 'origin/main'. >-
INFO [04/30/24 13:09:20:43] Found merge base of ''dc43f3b' - Merged PR 5351: [snip PR message]'
INFO [04/30/24 13:09:20:43] Merge base of 'tags/v_0.1.2' and 'origin/main' is ''dc43f3b' - Merged PR 5351: [snip PR message]'
INFO [04/30/24 13:09:20:43] -< End: Finding merge base between 'tags/v_0.1.2' and 'origin/main'. (Took: 0.48ms) >-
INFO [04/30/24 13:09:20:44] -< End: Finding branches source of 'tags/v_0.1.2' (Took: 21.45ms) >-
INFO [04/30/24 13:09:20:46] TrunkBasedVersionStrategy: Force version increment '0.1.2' +semver 'Patch' with label 'tags-v_0-1-2' based on commit 'dc43f3b'.
INFO [04/30/24 13:09:20:47] Using current branch name to calculate version tag
INFO [04/30/24 13:09:20:47] -< End: [Using 'TrunkBasedVersionStrategy' strategy] (Took: 77.51ms) >-
INFO [04/30/24 13:09:20:47] -< Begin: [Using 'VersionInBranchNameVersionStrategy' strategy] >-
INFO [04/30/24 13:09:20:47] -< End: [Using 'VersionInBranchNameVersionStrategy' strategy] (Took: 0.39ms) >-
INFO [04/30/24 13:09:20:47] -< End: Fetching the base versions for version calculation... (Took: 82.83ms) >-
INFO [04/30/24 13:09:20:47] -------------------------------------------------------
INFO [04/30/24 13:09:20:47] Found multiple base versions which will produce the same SemVer (0.1.3-tags-v_0-1-2.1), taking oldest source for commit counting (TrunkBasedVersionStrategy)
INFO [04/30/24 13:09:20:47] Base version used: TrunkBasedVersionStrategy: 0.1.2 with commit source 'dc43f3be8e9f7d955998e0554fdfb4286bfbdfee'
INFO [04/30/24 13:09:20:47] -------------------------------------------------------
INFO [04/30/24 13:09:20:47] -< Begin: Using continuous delivery workflow to calculate the incremented version. >-
INFO [04/30/24 13:09:20:47] 0 commits found between 'dc43f3b' - Merged PR 5351: [snip PR message] and 'dc43f3b' - Merged PR 5351: [snip PR message]
INFO [04/30/24 13:09:20:47] -< End: Using continuous delivery workflow to calculate the incremented version. (Took: 2.06ms) >-
INFO [04/30/24 13:09:20:48] -< Begin: Write version variables to cache file /home/vsts/work/1/s/.git/gitversion_cache/CCA1D0FE3372DDA3A3818BCD8368D89CB00A09C7 >-
INFO [04/30/24 13:09:20:52] -< End: Write version variables to cache file /home/vsts/work/1/s/.git/gitversion_cache/CCA1D0FE3372DDA3A3818BCD8368D89CB00A09C7 (Took: 42.49ms) >-
{
"AssemblySemFileVer": "0.1.3.0",
"AssemblySemVer": "0.1.3.0",
"BranchName": "tags/v_0.1.2",
"BuildMetaData": null,
"CommitDate": "20240426",
"CommitsSinceVersionSource": 0,
"EscapedBranchName": "tags-v-0-1-2",
"FullBuildMetaData": "Branch.tags-v-0.1.2.Sha.dc43f3be8e9f7d955998e0554fdfb4286bfbdfee",
"FullSemVer": "0.1.3-tags-v_0-1-2.0",
"InformationalVersion": "0.1.3-tags-v_0-1-2.0+Branch.tags-v-0.1.2.Sha.dc43f3be8e9f7d955998e0554fdfb4286bfbdfee",
"Major": 0,
"MajorMinorPatch": "0.1.3",
"Minor": 1,
"Patch": 3,
"PreReleaseLabel": "tags-v_0-1-2",
"PreReleaseLabelWithDash": "-tags-v_0-1-2",
"PreReleaseNumber": 0,
"PreReleaseTag": "tags-v_0-1-2.0",
"PreReleaseTagWithDash": "-tags-v_0-1-2.0",
"SemVer": "0.1.3-tags-v_0-1-2.0",
"Sha": "dc43f3be8e9f7d955998e0554fdfb4286bfbdfee",
"ShortSha": "dc43f3b",
"UncommittedChanges": 0,
"VersionSourceSha": "dc43f3be8e9f7d955998e0554fdfb4286bfbdfee",
"WeightedPreReleaseNumber": 30000
}
from gitversion.
@HHobeck, is it expected behavior that tagged commits aren't picked up with the TrunkBased
workflow?
from gitversion.
If it's any help, I'm seeing the same issue when using GitVersion 5.10.3 on GitHub Actions. If I create a release in GitHub and tag it as e.g. 0.0.0-beta+7
and run dotnet-gitversion
locally, then the pre-release tag is correctly generated as beta+7
, but when my GitHub action executes, the pre-release tag is calculated as tags-0-0-1-beta-7.1
from gitversion.
@HHobeck, is it expected behavior that tagged commits aren't picked up with the
TrunkBased
workflow?
To answer your question: Yes of course the TrunkBased workflow (which uses the Mainline version stratgey) considers tags. Anyway I think it has nothing to do with the used strategy. If you see the log output then you see the following:
Branch from build environment: refs/tags/v_0.1.2
That means the current branch is of name tags/v_0.1.2. Because we have no branch configuration with name tags the algorithm uses the unknown branch configuration.
unknown:
increment: Patch
regex: (?<BranchName>.+)
prevent-increment:
when-current-commit-tagged: false
source-branches:
- main
pre-release-weight: 30000
from gitversion.
@HHobeck as I suspected. So it is the repository normalization that is causing this problem, which I thought was fixed. Oh well.
from gitversion.
@HHobeck as I suspected. So it is the repository normalization that is causing this problem, which I thought was fixed. Oh well.
The normalization process is something I have not touched. I have a common understanding what this module does but don't know the overall design. I think the behavior having a branch with name e.g. tags/1.0.0 is also something I have seen with azure devops as well.
Maybe it is by design and we need to change the configuration and add a tags branch configuration? Or let me ask the question different: Which branch would you use in the normalization process when starting the artefact creation by selecting just a tag? Maybe this discussion goes in the same direction: #3907
from gitversion.
Note that this is only an issue in Mainline mode. If I change my configuration to mode: ContinuousDelivery
, the tag gets used correctly (even with the weird refs/heads/tags/ local branch):
[command]/opt/hostedtoolcache/GitVersion.Tool/5.12.0/x64/dotnet-gitversion /home/vsts/work/1/s /output json /output buildserver /config /home/vsts/work/1/_automation/config/gitversion.yaml
INFO [05/01/24 12:05:45:46] Working directory: /home/vsts/work/1/s
INFO [05/01/24 12:05:45:48] Project root is: /home/vsts/work/1/s/
INFO [05/01/24 12:05:45:48] DotGit directory is: /home/vsts/work/1/s/.git
INFO [05/01/24 12:05:45:48] Branch from build environment: refs/tags/v_0.1.3
INFO [05/01/24 12:05:45:48] Begin: Normalizing git directory for branch 'refs/tags/v_0.1.3'
INFO [05/01/24 12:05:45:51] Skipping fetching, if GitVersion does not calculate your version as expected you might need to allow fetching or use dynamic repositories
INFO [05/01/24 12:05:45:52] Creating local branch tags/v_0.1.3 pointing at f68cded
INFO [05/01/24 12:05:45:54] Creating local branch from remote tracking 'refs/remotes/origin/feature/1648-snip-branch-name'.
INFO [05/01/24 12:05:45:55] Creating local branch from remote tracking 'refs/remotes/origin/main'.
INFO [05/01/24 12:05:45:55] HEAD points at branch 'refs/heads/tags/v_0.1.3'.
INFO [05/01/24 12:05:45:56] End: Normalizing git directory for branch 'refs/tags/v_0.1.3' (Took: 69.54ms)
INFO [05/01/24 12:05:45:56] Begin: Loading version variables from disk cache
INFO [05/01/24 12:05:45:56] Cache file /home/vsts/work/1/s/.git/gitversion_cache/E5BE13EBFDB188C579FDC6D9387C0F7C6B8A1675.yml not found.
INFO [05/01/24 12:05:45:56] End: Loading version variables from disk cache (Took: 0.36ms)
INFO [05/01/24 12:05:45:57] Using latest commit on specified branch
INFO [05/01/24 12:05:45:66] Running against branch: tags/v_0.1.3 (f68cded Merged PR 5393: [snip PR message])
INFO [05/01/24 12:05:45:66] Current commit is tagged with version 0.1.3, version calculation is for metadata only.
INFO [05/01/24 12:05:45:67] 0 commits found between f68cded Merged PR 5393: [snip PR message] and f68cded Merged PR 5393: [snip PR message]
INFO [05/01/24 12:05:45:67] Begin: Calculating base versions
INFO [05/01/24 12:05:45:68] No branch configuration found for branch tags/v_0.1.3, falling back to default configuration
INFO [05/01/24 12:05:45:68] Begin: Attempting to inherit branch configuration from parent branch
INFO [05/01/24 12:05:45:68] HEAD is merge commit, this is likely a pull request using tags/v_0.1.3 as base
INFO [05/01/24 12:05:45:68] Begin: Finding branch source of 'tags/v_0.1.3'
INFO [05/01/24 12:05:45:69] Begin: Finding merge base between 'tags/v_0.1.3' and 'main'.
INFO [05/01/24 12:05:45:69] Found merge base of f68cded Merged PR 5393: [snip PR message]
INFO [05/01/24 12:05:45:69] Merge base of tags/v_0.1.3' and 'main is f68cded Merged PR 5393: [snip PR message]
INFO [05/01/24 12:05:45:69] End: Finding merge base between 'tags/v_0.1.3' and 'main'. (Took: 7.10ms)
INFO [05/01/24 12:05:45:69] Begin: Finding merge base between 'tags/v_0.1.3' and 'origin/main'.
INFO [05/01/24 12:05:45:69] Found merge base of f68cded Merged PR 5393: [snip PR message]
INFO [05/01/24 12:05:45:69] Merge base of tags/v_0.1.3' and 'origin/main is f68cded Merged PR 5393: [snip PR message]
INFO [05/01/24 12:05:45:69] End: Finding merge base between 'tags/v_0.1.3' and 'origin/main'. (Took: 0.33ms)
INFO [05/01/24 12:05:45:70] Multiple source branches have been found, picking the first one (main).
This may result in incorrect commit counting.
Options were:
main, origin/main
INFO [05/01/24 12:05:45:70] End: Finding branch source of 'tags/v_0.1.3' (Took: 17.63ms)
INFO [05/01/24 12:05:45:70] Begin: Getting branches containing the commit 'f68cded'.
INFO [05/01/24 12:05:45:70] Trying to find direct branches.
INFO [05/01/24 12:05:45:70] No direct branches found, searching through all branches.
INFO [05/01/24 12:05:45:70] Searching for commits reachable from 'main'.
INFO [05/01/24 12:05:45:70] The branch 'main' has a matching commit.
INFO [05/01/24 12:05:45:70] End: Getting branches containing the commit 'f68cded'. (Took: 1.06ms)
INFO [05/01/24 12:05:45:70] Found possible parent branches: main
INFO [05/01/24 12:05:45:70] End: Attempting to inherit branch configuration from parent branch (Took: 26.63ms)
INFO [05/01/24 12:05:45:71] Fallback base version: 0.1.0 with commit count source a102d7409179ba5d4b5e3dd443e80f67dc5411f0
INFO [05/01/24 12:05:45:74] Git tag 'v_0.1.3': 0.1.3 with commit count source f68cded66ebfbca621449caa2e8ead3911ca0d3c
INFO [05/01/24 12:05:45:76] Found multiple base versions which will produce the same SemVer (0.1.3), taking oldest source for commit counting (Git tag 'v_0.1.3')
INFO [05/01/24 12:05:45:76] Base version used: Git tag 'v_0.1.3': 0.1.3 with commit count source f68cded66ebfbca621449caa2e8ead3911ca0d3c
INFO [05/01/24 12:05:45:76] End: Calculating base versions (Took: 88.70ms)
INFO [05/01/24 12:05:45:76] 0 commits found between f68cded Merged PR 5393: [snip PR message] and f68cded Merged PR 5393: [snip PR message]
INFO [05/01/24 12:05:45:76] Using branch name to calculate version tag
INFO [05/01/24 12:05:45:76] Begin: Getting version tags from branch 'refs/heads/tags/v_0.1.3'.
INFO [05/01/24 12:05:45:77] End: Getting version tags from branch 'refs/heads/tags/v_0.1.3'. (Took: 3.47ms)
INFO [05/01/24 12:05:45:77] Begin: Creating dictionary
INFO [05/01/24 12:05:45:77] End: Creating dictionary (Took: 3.24ms)
INFO [05/01/24 12:05:45:77] Begin: Storing version variables to cache file /home/vsts/work/1/s/.git/gitversion_cache/E5BE13EBFDB188C579FDC6D9387C0F7C6B8A1675.yml
INFO [05/01/24 12:05:45:80] End: Storing version variables to cache file /home/vsts/work/1/s/.git/gitversion_cache/E5BE13EBFDB188C579FDC6D9387C0F7C6B8A1675.yml (Took: 21.51ms)
from gitversion.
Note that this is only an issue in Mainline mode. If I change my configuration to
mode: ContinuousDelivery
, the tag gets used correctly (even with the weird refs/heads/tags/ local branch):
@arnoschuring-miele: In the log output you see the following line:
Branch from build environment: refs/tags/v_0.1.3
That means independent of wish mode you are using there is no configuration for tags in the configuration present. Maybe I need to say that I have no idea why it is not working with the Mainline mode. Anyway I want to point out that the Mainline
mode is deprecated and will be removed in version 6.x. The equivalent mechanism will be the Mainline
version strategy (which has been developed completely new with a different code base).
from gitversion.
Related Issues (20)
- [ISSUE]: gitversion/execute@1 task uses branch from wrong repository HOT 1
- [Improvement]: Finalizing the configuration of GitFlow and GitHubFlow workflow and align with the Mainline version strategy HOT 1
- [ISSUE]: n unexpected error occurred: LibGit2Sharp.LibGit2SharpException: No error message has been provided by the native library HOT 3
- Verifies the contents of `configuration.md` against the default serialized configuration
- [ISSUE]: Regex Capture Groups don't work correctly on release branch. HOT 3
- gitversion from container image default behaviour differs from other installation methods HOT 5
- [Documentation]: Documenting the GitFlow workflow and create sequence diagrams HOT 1
- [ISSUE]: Gitversion failing in teamcity run configuration HOT 1
- [ISSUE]: Can't make GitVersion work in conjunction with WiX Toolset 4.0/5.0 HOT 3
- Forced push breaks GitVersion
- [ISSUE]: GitVersion AzDo task appears to be stuck at version 5.0.1 HOT 1
- [ISSUE]: Plan Migration to .NET 7.0+ SDK HOT 1
- [ISSUE]: NotImplementedException in TrunkBased-Workflow HOT 1
- [Feature]: Support of multi mainline branches in the Mainline version strategy
- [ISSUE]: Unable to get Main branch to update WeightedPreReleaseNumber HOT 1
- [ISSUE]: `init` command still shown in the help output HOT 2
- [Documentation]: Documenting the GitHubFlow workflow and create sequence HOT 1
- [ISSUE]: netstandard2.0 Support in 6.0.0 HOT 1
- [ISSUE]: Update the docs on DockerHub and specify the usage when running in a CI environment HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gitversion.