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

Bump2version doesn't fail when tag already exists #224

Open
jozenstar opened this issue Jul 22, 2021 · 3 comments
Open

Bump2version doesn't fail when tag already exists #224

jozenstar opened this issue Jul 22, 2021 · 3 comments
Labels
Milestone

Comments

@jozenstar
Copy link

Hi,
I'm using bump2version in my CI process on CircleCI.

I've mentioned that when the tag already exists, bump2version throws an error like

Adding changes in file 'helm/Chart.yaml' to Git
Adding changes in file '.bumpversion.cfg' to Git
Committing to Git with message '"[skip ci]  circleci-bot: bump version 0.54.0 → 0.55.0"'
Tagging 'v0.55.0' with message 'Bump version: 0.54.0 → 0.55.0' in Git and not signing
fatal: tag 'v0.55.0' already exists
Traceback (most recent call last):
  File "/usr/bin/bump2version", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python3.6/site-packages/bumpversion/cli.py", line 137, in main
    _tag_in_vcs(vcs, context, args)
  File "/usr/lib/python3.6/site-packages/bumpversion/cli.py", line 728, in _tag_in_vcs
    vcs.tag(sign_tags, tag_name, tag_message)
  File "/usr/lib/python3.6/site-packages/bumpversion/vcs.py", line 138, in tag
    subprocess.check_output(command)
  File "/usr/lib/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['git', 'tag', 'v0.55.0', '--message', 'Bump version: 0.54.0 → 0.55.0']' returned non-zero exit status 128.
CircleCI received exit code 0

So the git tag command exits with exit code 128, but the bump2version process still exits with an exit code 0, so the build is finished 'successfully'.

Bump2version version is bumpversion: v1.0.1 (using Python v3.6.8)

Bump2version config is:

current_version = 0.54.0
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
message = "[skip ci]  circleci-bot: bump version {current_version} → {new_version}"

[bumpversion:file:helm/Chart.yaml]```


Can we add some sort of check or exception to catch this error and exit with a non-zero code please?  
@florisla florisla added the bug label Jul 22, 2021
@florisla
Copy link
Collaborator

Agreed that it should not exit with ERRNO 0.

@florisla florisla added this to the Next release milestone Jul 22, 2021
@jozenstar
Copy link
Author

@florisla Thanks for the quick response!

Any thoughts on when this issue could be resolved?

@jozenstar
Copy link
Author

@florisla Any updates so far?

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

2 participants