commitizen icon indicating copy to clipboard operation
commitizen copied to clipboard

ignored_tag_format not working

Open fragolinux opened this issue 8 months ago • 1 comments

Description

hi, we have a bunch of tags in the format $version.RC* which should not be considered when a bump is requested... this is our .cz.yaml file:

---
commitizen:
  changelog_incremental: true
  changelog_start_rev: 5.49.0
  name: cz_custom
  pre_bump_hooks:
  - '"${WORKSPACE}/bump_script.sh" || exit 1'
  tag_format: "${version}"
  update_changelog_on_bump: true
  use_shortcuts: true
  version_files:
  - automation_conf.yaml:release_version
  - infrastructure/helm/Chart.yaml:version
  - infrastructure/helm/Chart.yaml:appVersion
  version_type: semver
  version_provider: scm
  ignored_tag_formats:
    - "$version.*"

we are trying to bump from 5.51.6 to 5.52.0, these are the actual tags:

5.49.0.RC5
5.49.1
5.49.10
5.49.11
5.49.2
5.49.3
5.49.4
5.49.5
5.49.6
5.49.7
5.49.8
5.49.9
5.50.0
5.50.0.RC1
5.50.1
5.50.2
5.50.3
5.50.4
5.51.0
5.51.1
5.51.2
5.51.3
5.51.4
5.51.5
5.51.6

Steps to reproduce

cz bump

Current behavior

and this is the stack trace of a test run:

traceback (most recent call last):
  File "/usr/local/python/current/bin/cz", line 8, in <module>
    sys.exit(main())
             ~~~~^^
  File "/usr/local/python/3.13.2/lib/python3.13/site-packages/commitizen/cli.py", line 656, in main
    args.func(conf, arguments)()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/python/3.13.2/lib/python3.13/site-packages/commitizen/commands/bump.py", line 147, in __call__
    current_version = self.scheme(provider.get_version())
                                  ~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/python/3.13.2/lib/python3.13/site-packages/commitizen/providers/scm_provider.py", line 21, in get_version
    versions = sorted(rules.extract_version(t) for t in version_tags)
  File "/usr/local/python/3.13.2/lib/python3.13/site-packages/commitizen/providers/scm_provider.py", line 21, in <genexpr>
    versions = sorted(rules.extract_version(t) for t in version_tags)
                      ~~~~~~~~~~~~~~~~~~~~~^^^
  File "/usr/local/python/3.13.2/lib/python3.13/site-packages/commitizen/tags.py", line 149, in extract_version
    raise InvalidVersion(
        f"Invalid version tag: '{tag.name}' does not match any configured tag format"
    )
packaging.version.InvalidVersion: Invalid version tag: '5.49.0.RC5' does not match any configured tag format

Desired behavior

bump to 5.52.0

Screenshots

No response

Environment

cz version --report Commitizen Version: 4.6.0 Python Version: 3.13.2 (main, Apr 17 2025, 12:48:27) [GCC 12.2.0] Operating System: Linux

fragolinux avatar Apr 17 '25 13:04 fragolinux

It might have been fixed by #1418, can you try on the version 4.7.1 ?

noirbizarre avatar May 16 '25 11:05 noirbizarre