Skip to content
This repository has been archived by the owner on Jul 30, 2021. It is now read-only.

[scripts] Update semver regex #309

Merged
merged 1 commit into from
Apr 30, 2019

Conversation

SamiSousa
Copy link
Contributor

  • Update semver regex to better match more valid semver

Previously, our regex was an approximation of what the semver
standard supports. This regex should more precisely match valid semvers.

@openshift-ci-robot openshift-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 26, 2019
@SamiSousa
Copy link
Contributor Author

This change is required for CI to work with operators with versions such as #280 : https://github.com/operator-framework/community-operators/pull/280/files#diff-e2003439d400d84637f240ca92eeb43bR213
/cc @estroz @dmesser


# Source: https://github.com/k-bx/python-semver
# Note: This regex is slightly modified from the source
SEMVER_REGEX="((0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\-(0|[1-9A-Za-z-][0-9A-Za-z-]*(\.0|[1-9A-Za-z-][0-9A-Za-z-]*)*))?(\+([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?)"
Copy link
Member

@estroz estroz Apr 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can put this in scripts/lib/file, and add

for f in "$(cd "$(dirname ${BASH_SOURCE[0]})/.." && pwd)"/lib/*; do
  . "$f"
done

above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds perfect!

- Update semver regex to better match more valid semver
- Include SEMVER_REGEX env variable in scripts/lib/file

Previously, our regex was an approximation of what the semver
standard supports. This regex should more precisely match valid
semvers.
@SamiSousa
Copy link
Contributor Author

@estroz Updated based on your comment, PTAL!

@estroz
Copy link
Member

estroz commented Apr 30, 2019

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 30, 2019
@estroz estroz self-requested a review April 30, 2019 19:13
@SamiSousa SamiSousa merged commit aad14c3 into operator-framework:master Apr 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants