-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
update regex to match all iterations #6839
Conversation
Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only found one true issue.
It could be worth commenting each line for the next person who might have to edit this. Also adding the examples in the PR description as a comment could help as well.
Two additional notes:
- depending on how this matching is applied you may want to have start and stop anchors (
^
,$
) to prevent matching in the middle of bad strings. e.g. -1.2.3.4.5.6
matches twice: once on1.2.3
and again on4.5.6
- There are also two unnamed groups. Namely the two groups quantified by
?
that for the string1.5.0a1.dev123457+nightly
would matcha1.dev123457+nightly
anda1
. I don't suspect this is an issue, but I wanted to make sure you were aware it still matches as an unnamed group since every other group is named.
bumpversion doesn't need this. If there is anything that falls outside the match it will fail. Tested here
It is not an issue. I've added a comment to clarify in the code. |
\.(?P<patch>[\d]+) # patch version number | ||
(((?P<prekind>a|b|rc) # optional pre-release type | ||
?(?P<num>[\d]+?)) # optional pre-release version number | ||
\.?(?P<nightly>[a-z0-9]+\+[a-z]+)? # optional nightly release indicator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would need to give this some thought but I think we want 1.5.0a1
to be valid but 1.5.0a
to be invalid right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the +
in ?(?P<num>[\d]+?))
should handle that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed the parenthesis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@colin-rogers-dbt 1.5.0a
is not valid because of the ?
in the middle. it means what come before is optional, but if it's filled, what's after is required.
((?P<prekind>a|b|rc)?(?P<num>[\d]+?))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Co-authored-by: Nathaniel May <nathaniel.may@fishtownanalytics.com>
* update regex to match all iterations * convert to num to match all adapters * add comments, remove extra . * clarify with more comments * Update .bumpversion.cfg Co-authored-by: Nathaniel May <nathaniel.may@fishtownanalytics.com> --------- Co-authored-by: Nathaniel May <nathaniel.may@fishtownanalytics.com> # Conflicts: # .bumpversion.cfg
* update regex to match all iterations * convert to num to match all adapters * add comments, remove extra . * clarify with more comments * Update .bumpversion.cfg Co-authored-by: Nathaniel May <nathaniel.may@fishtownanalytics.com> --------- Co-authored-by: Nathaniel May <nathaniel.may@fishtownanalytics.com> # Conflicts: # .bumpversion.cfg
* update regex to match all iterations * convert to num to match all adapters * add comments, remove extra . * clarify with more comments * Update .bumpversion.cfg Co-authored-by: Nathaniel May <nathaniel.may@fishtownanalytics.com> --------- Co-authored-by: Nathaniel May <nathaniel.may@fishtownanalytics.com> # Conflicts: # .bumpversion.cfg
* update regex to match all iterations * convert to num to match all adapters * add comments, remove extra . * clarify with more comments * Update .bumpversion.cfg Co-authored-by: Nathaniel May <nathaniel.may@fishtownanalytics.com> --------- Co-authored-by: Nathaniel May <nathaniel.may@fishtownanalytics.com> # Conflicts: # .bumpversion.cfg
* [CI/CD] Update release workflow and introduce workflow for nightly releases (#6602) * Add release workflows * Update nightly-release.yml * Set default `test_run` value to `true` * Update .bumpversion.cfg * Resolve review comment - Update workflow docs - Change workflow name - Set `test_run` default value to `true` * Update Slack secret * PyPI * Update release workflow (#6778) - Update AWS secrets - Rework condition for Slack notification * update regex to match all iterations (#6839) * update regex to match all iterations * convert to num to match all adapters * add comments, remove extra . * clarify with more comments * Update .bumpversion.cfg Co-authored-by: Nathaniel May <nathaniel.may@fishtownanalytics.com> --------- Co-authored-by: Nathaniel May <nathaniel.may@fishtownanalytics.com> # Conflicts: # .bumpversion.cfg * put back correct version --------- Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>
* [CI/CD] Update release workflow and introduce workflow for nightly releases (#6602) * Add release workflows * Update nightly-release.yml * Set default `test_run` value to `true` * Update .bumpversion.cfg * Resolve review comment - Update workflow docs - Change workflow name - Set `test_run` default value to `true` * Update Slack secret * PyPI * Update release workflow (#6778) - Update AWS secrets - Rework condition for Slack notification * update regex to match all iterations (#6839) * update regex to match all iterations * convert to num to match all adapters * add comments, remove extra . * clarify with more comments * Update .bumpversion.cfg Co-authored-by: Nathaniel May <nathaniel.may@fishtownanalytics.com> --------- Co-authored-by: Nathaniel May <nathaniel.may@fishtownanalytics.com> # Conflicts: # .bumpversion.cfg * put back correct version --------- Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>
* [CI/CD] Update release workflow and introduce workflow for nightly releases (#6602) * Add release workflows * Update nightly-release.yml * Set default `test_run` value to `true` * Update .bumpversion.cfg * Resolve review comment - Update workflow docs - Change workflow name - Set `test_run` default value to `true` * Update Slack secret * PyPI * Update release workflow (#6778) - Update AWS secrets - Rework condition for Slack notification * update regex to match all iterations (#6839) * update regex to match all iterations * convert to num to match all adapters * add comments, remove extra . * clarify with more comments * Update .bumpversion.cfg Co-authored-by: Nathaniel May <nathaniel.may@fishtownanalytics.com> --------- Co-authored-by: Nathaniel May <nathaniel.may@fishtownanalytics.com> # Conflicts: # .bumpversion.cfg * put back correct version --------- Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>
…6846) * update regex to match all iterations (#6839) * update regex to match all iterations * convert to num to match all adapters * add comments, remove extra . * clarify with more comments * Update .bumpversion.cfg Co-authored-by: Nathaniel May <nathaniel.may@fishtownanalytics.com> --------- Co-authored-by: Nathaniel May <nathaniel.may@fishtownanalytics.com> # Conflicts: # .bumpversion.cfg * put back correct version * put back correct version
Description
The existing regex (new since nightly releases were added) had a bug and did not recognize versions without any kind of prerelease (ie.
1.5.0
).This change passes for the following
1.5.0
1.5.0a1
1.5.0a1.dev123457+nightly
and fails for
1.5
1
1.5.2-a1
Tested with release here
Checklist
changie new
to create a changelog entry