Changelog only generates log for latest release in bitbucket pipeline.
Description
When we execute different changelog commands on bitbucket pipelines it fails to generate expected changelog. Same commands generate expected changelog on local machines on same branches.
The changelog generated via bitbucket pipeline only adds 1 latest release and lists all the previous commits under that release. In this example it compiles everything under 3.0.1 version. However the repo/branch has valid previous tags and releases which follow the convention.
Commands that are generating improper changelog:
cz changelog
cz changelog --unreleased v3.0.1
Command that fails on bitbucket pipeline
cz bump --changelog
Error that gets printed in return of the above bump command:
tag to create: v3.0.1
increment detected: PATCH
No tag found to do an incremental changelog
Steps to reproduce
- Create a repo in bitbucket
- Write bitbucket pipeline to generate the changelog using commitizen Following code can be used in bitbucket pipeline step to generate changelog
image:
name: my-custom-image:2.0
username: $USERNAME
password: $PASSWORD
email: $EMAIL
pipelines:
default:
- step:
name: Release new version
caches:
- pip
script:
- git remote set-url origin ${BITBUCKET_GIT_SSH_ORIGIN}
- pip install -U commitizen
- cz bump -cc
- new_version=$(cz version --project)
- cz changelog --unreleased-version "v$new_version"
- git add CHANGELOG.md
- git commit -m "docs(changelog): generated changelog for v$new_version"
Here is the code for cz.toml file
[tool.commitizen]
name = "cz_conventional_commits"
version = "3.0.0"
tag_format = "v$version"
version_files = [
"__version__.py"]
bump_message = "bump: $current_version → $new_version [skip-ci]"
Current behavior
All commits are gathered under latest version in changelog and older versions are getting ignored, in bitbucket pipelines
Desired behavior
Proper changelog should be generated in bitbucket pipelines
Environment
- commitizen version: 2.6.0
- python version: 3.7.2
- operating system: Linux
It doesn't look like a commitizen issue. This is more like a bitbucket pipeline issue. What did they say?
If you do git tag in the script part of the pipeline, what do you see? are the tags being pulled?
It doesn't look like a commitizen issue. This is more like a bitbucket pipeline issue. What did they say? If you do
git tagin thescriptpart of the pipeline, what do you see? are the tags being pulled?
Yes tags are being pulled. Checked that earlier too. That's why I was curious that why is it not able to generate proper changelog even when it can pull commit history and tags successfully.

Have you tried
clone:
depth: full
pipelines:
...
I think the pipeline is missing some git stuff, jenkins and github action have similar issues if they are not properly configured. But I don't have much experience with bitbucket pipelines.
If you manage to do it, please share the recipe on the tutorials section :pray:
Tried that but no luck. Also tried git fetch --unshallow at step level but that did not help either.
Sure will share the recipe once I am able to resolve it.
Any other pointer or direction you think I should look into ?
Yes, check the current branch is master with git branch --show-current. Sometimes the HEAD is detached from the branch in some CIs.
I'd try something like:
clone:
depth: full
image:
name: my-custom-image:2.0
username: $USERNAME
password: $PASSWORD
email: $EMAIL
pipelines:
default:
- step:
name: Release new version
caches:
- pip
script:
- git remote set-url origin ${BITBUCKET_GIT_SSH_ORIGIN}
- git checkout master
- pip install -U commitizen
- cz bump -ch
And I'd also open a ticket on bitbucket pipeline support
Any update on this? I'm gonna close it for now as I believe it's a CI issue. Feel free to re-open.