Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] +semver:feature is not increasing the version when previous commit also has +semver:feature #3097

Closed
tonholis opened this issue Apr 22, 2022 · 3 comments
Labels

Comments

@tonholis
Copy link

tonholis commented Apr 22, 2022

Describe the bug
+semver:feature is not increasing the version when the previous commit also has +semver:feature

My git repo looks like this (main branch)

commit |  message                     | gitversion produced
cccc   |  test3 +semver:feature       | 1.5.0
bbbb   |  test2 +semver:feature       | 1.5.0
aaaa   |  test1 - with tag            | 1.4.0 

As you can see, the last commit is not increased to 1.6.0

Expected Behavior

It should increase the version when the previous commit has +semver:feature in the commit message.

Actual Behavior

It's not incrementing.

Possible Fix

Apply a tag in the previous commit to set a new base version

Steps to Reproduce

  1. Create a git repo with GitVersion.yaml
mode: ContinuousDeployment
next-version: 1.0.0
ignore:
  sha: []
merge-message-formats: {}
branches:
  main:
    mode: ContinuousDelivery
    tag: ''
  1. Send a commit and apply a tag (i.e. 1.4.0)
  2. Send a second commit with message: +semver:feature (the version produced should be 1.5.0)
  3. Send a third commit with a message: +semver:feature (the version produced should be 1.6.0)

Context

The GitVersion tool has been used within Azure DevOps Pipelines. Here is log:

Your Environment

2022-04-22T10:01:24.7659745Z ##[section]Starting: gitversion
2022-04-22T10:01:24.7667810Z ==============================================================================
2022-04-22T10:01:24.7668181Z Task         : GitVersion Task
2022-04-22T10:01:24.7668552Z Description  : Easy Semantic Versioning (http://semver.org) for projects using Git
2022-04-22T10:01:24.7668872Z Version      : 5.1.2
2022-04-22T10:01:24.7669114Z Author       : GitVersion Contributors
2022-04-22T10:01:24.7669521Z Help         : See the [documentation](http://gitversion.readthedocs.org/en/latest/) for help
2022-04-22T10:01:24.7669982Z ==============================================================================
2022-04-22T10:01:25.0987041Z 
2022-04-22T10:01:25.0988788Z --------------------------
2022-04-22T10:01:25.0990197Z Installing GitVersion.Tool version 5.x
2022-04-22T10:01:25.0990985Z --------------------------
2022-04-22T10:01:25.6815562Z [command]/usr/bin/dotnet tool install GitVersion.Tool --tool-path /home/vsts/work/_temp --version 5.10.1
2022-04-22T10:01:29.4192645Z You can invoke the tool using the following command: dotnet-gitversion
2022-04-22T10:01:29.4221686Z Tool 'gitversion.tool' (version '5.10.1') was successfully installed.
2022-04-22T10:01:29.4238067Z Caching tool: GitVersion.Tool 5.10.1 x64
2022-04-22T10:01:29.5607874Z Prepending PATH environment variable with directory: /opt/hostedtoolcache/GitVersion.Tool/5.10.1/x64
2022-04-22T10:01:29.5626513Z [command]/opt/hostedtoolcache/GitVersion.Tool/5.10.1/x64/dotnet-gitversion /home/vsts/work/1/s /output buildserver /nofetch /config /home/vsts/work/1/s/GitVersion.yml
2022-04-22T10:01:29.8048062Z INFO [04/22/22 10:01:29:79] Working directory: /home/vsts/work/1/s
2022-04-22T10:01:29.8227931Z INFO [04/22/22 10:01:29:82] Project root is: /home/vsts/work/1/s/
2022-04-22T10:01:29.8229292Z INFO [04/22/22 10:01:29:82] DotGit directory is: /home/vsts/work/1/s/.git
2022-04-22T10:01:29.8230126Z INFO [04/22/22 10:01:29:82] Branch from build environment: refs/heads/main
2022-04-22T10:01:29.8280214Z INFO [04/22/22 10:01:29:82] Begin: Normalizing git directory for branch 'refs/heads/main'
2022-04-22T10:01:29.8604013Z   INFO [04/22/22 10:01:29:85] One remote found (origin -> 'https://foo@dev.azure.com/bar/MyProject/_git/DummyAppTests').
2022-04-22T10:01:29.8667573Z   INFO [04/22/22 10:01:29:86] Skipping fetching, if GitVersion does not calculate your version as expected you might need to allow fetching or use dynamic repositories
2022-04-22T10:01:29.8717412Z   INFO [04/22/22 10:01:29:87] Creating local branch main
2022-04-22T10:01:29.9022577Z   INFO [04/22/22 10:01:29:90] Creating local branch from remote tracking 'refs/remotes/origin/develop'.
2022-04-22T10:01:29.9187708Z   INFO [04/22/22 10:01:29:91] HEAD points at branch 'refs/heads/main'.
2022-04-22T10:01:29.9188764Z   INFO [04/22/22 10:01:29:91] End: Normalizing git directory for branch 'refs/heads/main' (Took: 91.85ms)
2022-04-22T10:01:29.9275198Z   INFO [04/22/22 10:01:29:92] Begin: Loading version variables from disk cache
2022-04-22T10:01:29.9277085Z     INFO [04/22/22 10:01:29:92] Cache file /home/vsts/work/1/s/.git/gitversion_cache/11B21722CC25F0EC3A49A9C0C70D6307F2F5754C.yml not found.
2022-04-22T10:01:29.9277862Z   INFO [04/22/22 10:01:29:92] End: Loading version variables from disk cache (Took: 0.42ms)
2022-04-22T10:01:29.9306436Z   INFO [04/22/22 10:01:29:92] Using latest commit on specified branch
2022-04-22T10:01:30.0772963Z   INFO [04/22/22 10:01:30:07] Running against branch: main (1999d41 Merged PR 1764: Test2 +semver:feature)
2022-04-22T10:01:30.0773841Z   INFO [04/22/22 10:01:30:07] Begin: Calculating base versions
2022-04-22T10:01:30.0947479Z     INFO [04/22/22 10:01:30:09] NextVersion in GitVersion configuration file: 1.0.0 with commit count source External Source
2022-04-22T10:01:30.1080886Z     INFO [04/22/22 10:01:30:10] Fallback base version: 0.1.0 with commit count source 0b4e4b609b81ad902209b182861b5d360baf4ed5
2022-04-22T10:01:30.1743269Z     INFO [04/22/22 10:01:30:17] Git tag '1.4.0': 1.4.0 with commit count source bcc7fb1b0d77936f00c958ee1d42bcbe8debc64a
2022-04-22T10:01:30.1744887Z     INFO [04/22/22 10:01:30:17] Git tag '1.3.1': 1.3.1 with commit count source 481330e4797b7fecd893361d9d269626ae5c234c
2022-04-22T10:01:30.1758529Z     INFO [04/22/22 10:01:30:17] Git tag '1.2.0': 1.2.0 with commit count source cc8d49a9fd4218e971f0df752157272b34d1d6bd
2022-04-22T10:01:30.1765638Z     INFO [04/22/22 10:01:30:17] Git tag '1.1.0': 1.1.0 with commit count source 42be9235c532071ce9bf53326140385da6058aab
2022-04-22T10:01:30.1774499Z     INFO [04/22/22 10:01:30:17] Git tag '1.0.1': 1.0.1 with commit count source 0b4e4b609b81ad902209b182861b5d360baf4ed5
2022-04-22T10:01:30.2121381Z     INFO [04/22/22 10:01:30:21] Found multiple base versions which will produce the same SemVer (1.5.0), taking oldest source for commit counting (Git tag '1.4.0')
2022-04-22T10:01:30.2122670Z     INFO [04/22/22 10:01:30:21] Base version used: Git tag '1.4.0': 1.4.0 with commit count source bcc7fb1b0d77936f00c958ee1d42bcbe8debc64a
2022-04-22T10:01:30.2123406Z   INFO [04/22/22 10:01:30:21] End: Calculating base versions (Took: 135.63ms)
2022-04-22T10:01:30.2127421Z   INFO [04/22/22 10:01:30:21] 2 commits found between bcc7fb1 Merged PR 1691: Test1 and 1999d41 Merged PR 1764: Test2 +semver:feature
2022-04-22T10:01:30.2133666Z   INFO [04/22/22 10:01:30:21] 2 commits found between bcc7fb1 Merged PR 1691: Test1 and 1999d41 Merged PR 1764: Test2 +semver:feature
2022-04-22T10:01:30.2193266Z   INFO [04/22/22 10:01:30:21] Begin: Creating dictionary
2022-04-22T10:01:30.2251894Z   INFO [04/22/22 10:01:30:22] End: Creating dictionary (Took: 4.69ms)
2022-04-22T10:01:30.2252934Z   INFO [04/22/22 10:01:30:22] Begin: Storing version variables to cache file /home/vsts/work/1/s/.git/gitversion_cache/11B21722CC25F0EC3A49A9C0C70D6307F2F5754C.yml
2022-04-22T10:01:30.2683077Z   INFO [04/22/22 10:01:30:26] End: Storing version variables to cache file /home/vsts/work/1/s/.git/gitversion_cache/11B21722CC25F0EC3A49A9C0C70D6307F2F5754C.yml (Took: 43.06ms)
2022-04-22T10:01:30.2709040Z Executing GenerateSetVersionMessage for 'AzurePipelines'.
2022-04-22T10:01:30.3222559Z Executing GenerateBuildLogOutput for 'AzurePipelines'.
2022-04-22T10:01:30.3344262Z   INFO [04/22/22 10:01:30:29] Done writing 
2022-04-22T10:01:30.3398633Z ##[section]Async Command Start: Update Build Number
2022-04-22T10:01:30.5161191Z Update build number to 1.5.0+2 for build 7516
2022-04-22T10:01:30.5161614Z ##[section]Async Command End: Update Build Number
2022-04-22T10:01:30.5163241Z ##[section]Finishing: gitversion
  • Version Used: GitVersion.Tool 5.10.1 x64
  • Operating System and version (Windows 10, Ubuntu 18.04): ubuntu-20.04
@tonholis tonholis added the bug label Apr 22, 2022
@orionstudt
Copy link

orionstudt commented Jun 14, 2022

AFAIK this is expected behavior. If your release has multiple features you don't increment the minor N times for every feature, you increment it once. If you want to increment the minor version again, you need to tell it that it is the next release by tagging with 1.5.0

@asbjornu
Copy link
Member

I think @orionstudt is right. We should probably clarify this in the documentation.

@github-actions
Copy link

github-actions bot commented Mar 4, 2023

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants