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 is erroring when listing the current version and there is no value to replace in the file. #181

Open
cowboy-cod3r opened this issue Jan 4, 2021 · 2 comments

Comments

@cowboy-cod3r
Copy link

cowboy-cod3r commented Jan 4, 2021

Hi,

I use this product for quite a bit of projects. Thanks for keeping it up to date.

I recently upgraded from 1.0.0 to 1.0.1 and started getting some errors.

Issue
When attempting to get the current version, when there is no value to replace in one of my managed version files, I started getting this error:

# bump2version patch --allow-dirty --dry-run --list | grep current_version | awk -F "=" 'NR==1 { print $2 }'
Traceback (most recent call last):
  File "/Users/user1/opt/anaconda3/envs/myapp/bin/bump2version", line 8, in <module>
    sys.exit(main())
  File "/Users/user1/opt/anaconda3/envs/myapp/lib/python3.8/site-packages/bumpversion/cli.py", line 124, in main
    _check_files_contain_version(files, current_version, context)
  File "/Users/user1/opt/anaconda3/envs/myapp/lib/python3.8/site-packages/bumpversion/cli.py", line 618, in _check_files_contain_version
    f.should_contain_version(current_version, context)
  File "/Users/user2/opt/anaconda3/envs/myapp/lib/python3.8/site-packages/bumpversion/utils.py", line 68, in should_contain_version
    raise VersionNotFoundException(
bumpversion.exceptions.VersionNotFoundException: Did not find 'versionToken' in file: 'deploy/files/versions.csv'

The above error is correct in that versionToken does not exist in the file deploy/files/versions.csv. Prior to v1.0.1 being released though it would ignore that and return me the current version. Here is an example of it working with version 1.0.0.

bump2version patch --allow-dirty --dry-run --list | grep current_version | awk -F "=" 'NR==1 { print $2 }'
1.0.3

As part of my own CI process, I have a requirement to get the current version of the product I'm building so that I can name things appropriately based on version which is why I'm trying to get the current version. Is there a better approach to get the current version?

@florisla
Copy link
Collaborator

florisla commented Jan 19, 2021

Hi,

Would this proposed feature work for you?
#57

@cowboy-cod3r
Copy link
Author

Yes, I believe that would work. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants