-
-
Notifications
You must be signed in to change notification settings - Fork 296
cz bump recognizes wrong increment in Azure DevOps #965
-
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
Beta Was this translation helpful? Give feedback.
All reactions
@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.
Replies: 4 comments 6 replies
-
Please provide steps to reproduce
Beta Was this translation helpful? Give feedback.
All reactions
-
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.
Beta Was this translation helpful? Give feedback.
All reactions
-
Can you also share the git tag
output? thanks
Beta Was this translation helpful? Give feedback.
All reactions
-
3.0.0
4.0.0
5.0.0
5.1.0
5.2.0
6.0.0
7.0.0
8.0.0
Beta Was this translation helpful? Give feedback.
All reactions
-
One more info:
I am using Azure DevOps Git repo
Beta Was this translation helpful? Give feedback.
All reactions
-
@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.
Beta Was this translation helpful? Give feedback.
All reactions
-
Awesome!!
Beta Was this translation helpful? Give feedback.
All reactions
-
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
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
But that also means that only the last commit is considered, doesn't it?
Beta Was this translation helpful? Give feedback.
All reactions
-
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"
Beta Was this translation helpful? Give feedback.