Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

cz bump recognizes wrong increment in Azure DevOps #965

Discussion options

Hi all,

Good day!

I am incorporating "cz bump" for automated semantic versioning in our application.

Unfortunately, "cz bump" does not work as expected.
It recognizes the increment as "MAJOR" all the time irrespective of "fix" and "feat" commits only.

However, cz changelog shows the correct set of commits per version

Current version: 5.0.0
## Unreleased
### Fix
- move only specific version
## 4.0.0 (2024年01月18日)
### Feat
- scm based ver moves
- scm based ver moves
- scm based ver moves
- scm based ver moves
### Fix
- move only specific version
- removed the extra line
## 3.0.0 (2024年01月18日)
### Fix
- removed verison write
## 2.0.0 (2024年01月18日)
### Feat
- test the ver increment
### Fix
- corrected at tag
- branche names
## 2.0.0a0 (2024年01月18日)
### BREAKING CHANGE
- test
### Feat
- new lines
- add PR based stage exec
- add PR based stage exec
### Fix
- test the new config
- test minor
- Merged PR 30488: test
- test minor
- test minor

I suppose "cz bump" keeps taking all the commits including "BREAKING CHANGE" which is part of the version 2.0.0a0 and recognize as MAJOR increment all the time

Could you please suggest how this issue can be resolved?

Looking forward to your responses :)

Regards,
Ram

You must be logged in to vote

@woile It works now.

It was resolved with the setting "fetchDepth: 1" in Azure DevOps ci/cd yaml config :)

By default, Azure DevOps fetch all the commits misleading cz bump.
fetchDepth needs to be configured accordingly to consider only the latest commits.

Ref:
https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema/steps-checkout?view=azure-pipelines

Replies: 4 comments 6 replies

Comment options

Please provide steps to reproduce

You must be logged in to vote
0 replies
Comment options

Steps to reproduce:

Current version: 5.0.0
1st commit is "feat:". Increment recognized as MINOR (Version: 5.1.0)
2nd commit is "fix:". Increment recognized as MINOR (Expected: PATCH. Version is 5.2.0 rather than 5.1.1)
3rd commit is "BREAKING CHANGE:". Increment recognized as MAJOR (Version: 6.0.0)
4th commit is "fix:". Increment recognized as MAJOR (Expected: PATCH. Version is 7.0.0 rather than 6.0.1)

pyproject.toml

[build-system]
requires = ["setuptools>=64", "setuptools_scm[toml]>=8", "wheel"]
build-backend = "setuptools.build_meta"
[tool.setuptools_scm]
version_scheme = "python-simplified-semver"
local_scheme = "no-local-version"
[tool.commitizen]
version_provider="scm"

cz bump command:
cz bump --yes --annotated-tag --tag-format "$major.$minor.$patch"

My commits format:

feat: feat commit
fix: fix commit
BREAKING CHANGE: br commit

Looking into the source code of "get_commits()" method
https://github.com/commitizen-tools/commitizen/blob/master/commitizen/git.py
It seems to fetch all the commits and take the highest increment from the commits list.

You must be logged in to vote
3 replies
Comment options

Can you also share the git tag output? thanks

Comment options

3.0.0
4.0.0
5.0.0
5.1.0
5.2.0
6.0.0
7.0.0
8.0.0

Comment options

One more info:

I am using Azure DevOps Git repo

Comment options

@woile It works now.

It was resolved with the setting "fetchDepth: 1" in Azure DevOps ci/cd yaml config :)

By default, Azure DevOps fetch all the commits misleading cz bump.
fetchDepth needs to be configured accordingly to consider only the latest commits.

Ref:
https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema/steps-checkout?view=azure-pipelines

You must be logged in to vote
3 replies
Comment options

Awesome!!

Comment options

Could you submit a sample of your Azure ci? We don't have it in the docs tutorials and lots of people apparently use it

Comment options

But that also means that only the last commit is considered, doesn't it?

Answer selected by ramnarayan-code
Comment options

trigger:
 batch: true
 branches:
 include:
 - main
variables:
 - name: isMain
 value: $[eq(variables['build.sourceBranch'], 'refs/heads/main')]
 
stages:
- stage: bumpPkgVersion
 jobs:
 - job: bumpPkgVersion
 displayName: Increase Package Version 
 steps:
 - checkout: self
 persistCredentials: true
 clean: true
 fetchDepth: 1
 - script: |
 pip install commitizen==3.13.0
 displayName: 'install Commitizen'
 - task: AzureCLI@2
 condition: eq(variables.isMain, true)
 displayName: 'Main - Bump package version'
 inputs:
 azureSubscription: serviceConnection
 scriptType: bash
 scriptLocation: inlineScript
 addSpnToEnvironment: true
 inlineScript: | 
 cz bump --yes --annotated-tag --tag-format "$major.$minor.$patch"
 
 
 
You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /