Open fabiomatavelli opened 4 years ago
What was your expected output?
Something like new_version=['0.0.1-xxxx.000000', '0.0.1']
?
Otherwise, if you want to specify two different serializations, you should use multiple --serialize
arguments:
--serialize "{major}.{minor}.{patch}-{commit}" --serialize "{major}.{minor}.{patch}"
instead of
--serialize "['{major}.{minor}.{patch}-{commit}', '{major}.{minor}.{patch}']"
It seems there's a bug in the --list
functionality; it does not always show what it needs to show.
I think I found the cause: bump2version
requires a --new-version
--current-version
argument.
When that's missing, the tool crashes instead of reporting it nicely.
See #94 .
The added .bumpversion.cfg
file probably contains new_version
current_version
?
Can you try this one?
bump2version
--verbose
--parse "(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<commit>.*))?"
--serialize "{major}.{minor}.{patch}-{commit}"
--serialize "{major}.{minor}.{patch}"
--message "Automatic build version: {current_version} → {new_version}"
--dry-run
--allow-dirty
--current-version "0.0.1-9ad4d93d.20704390"
--new-version "0.0.1-xxxx.000000"
commit
versionfile.txt
Sorry, I meant --current_version
of course.
(replying to @jpettit email) (he later clarified he was using a .bumversion.cfg file)
On Fri, Jan 17, 2020 at 5:15 AM jpettit wrote:
Just FYI - this works for me:
bump2version --verbose \ --parse "(?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)(\-(?P<commit>.*))?" \ --serialize "{major}.{minor}.{patch}-{commit}" \ --serialize "{major}.{minor}.{patch}" \ --message "CICD Automatic Version {current_version} → {new_version} [skip ci]" \ --allow-dirty --list \ --new-version ${NEW_VERSION} \ commit
I don't understand how bump2version determines the current_version in your case? Do you have a .bumpversion.cfg file present?
The last argument, "commit" is not a file on disk right? It's a version [part] which is not really used because you supply --new-version explicitly.
@florisla hey, sorry for the delay. Yes, the commit is part of the version. I will try with multiple --serialize params to see if it works. My idea is to developers only specify the files that they want to update in the config file, and then I pass the rest of the parameters through the command.
I will test here and I let you know.
Thank you
We have a pipeline that runs the bump2version automatically but, to avoid configure all the repositories with the version standard, we are passing it through the --parse parameter.
The problem is that if it is not defined in
.bumpversion.cfg
orsetup.cfg
, the program simply ignore the parameter.Here follows two examples:
export NEW_VERSION=0.0.1-xxxx.000000
Returns:
If we set the
parse
andserialize
on.bumpversion.cfg
, the same command returns: