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

🏃Add semver version validation rules to Machine type and fix KCP version validation #2674

Merged
merged 1 commit into from
Mar 16, 2020

Conversation

sedefsavas
Copy link

What this PR does / why we need it:

Which issue(s) this PR fixes
This PR adds semver version validation for Machine type.
Fixes #2657

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Mar 13, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @sedefsavas. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 13, 2020
@k8s-ci-robot k8s-ci-robot requested review from detiber and ncdc March 13, 2020 15:47
Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/approve
/ok-to-test
/milestone v0.3.1

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Mar 13, 2020
@k8s-ci-robot k8s-ci-robot added this to the v0.3.1 milestone Mar 13, 2020
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 13, 2020
@vincepri
Copy link
Member

waiting for ci to finish before lgtm

Copy link
Contributor

@JoelSpeed JoelSpeed left a comment

Choose a reason for hiding this comment

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

Just wondering what happens if the version string is v1 or v1.7, will this pass validation? Are they valid version strings in this context?

api/v1alpha3/machine_webhook_test.go Show resolved Hide resolved
api/v1alpha3/machine_webhook_test.go Show resolved Hide resolved
@sedefsavas
Copy link
Author

Just wondering what happens if the version string is v1 or v1.7, will this pass validation? Are they valid version strings in this context?

Yes, those are valid as I use semver.ParseTolerant(), if we want to limit that but still accept preceding "v", we can use both ParseTolerant() followed by Parse()

@JoelSpeed
Copy link
Contributor

ParseTolerant() followed by Parse()

I'm not sure how this would help? Since v1.17 isn't a valid Kubernetes version I think we should be failing that, only versions including the patch number should be allowed IMO.

Looking at how ParseTolerant and Parse are implemented, I think keeping the trimming from ParseTolerant and then using Parse should work to enforce a pattern that is compliant with the Kubernetes releases, WDYT?

@sedefsavas
Copy link
Author

Right, modified it accordingly. Thanks for reviewing!

@vincepri
Copy link
Member

Should we also change the validation in KCP to match what we're doing here?

@sedefsavas sedefsavas changed the title 🏃Add semver version validation rules to Machine type 🏃Add semver version validation rules to Machine type and fix KCP version validation Mar 16, 2020
@sedefsavas
Copy link
Author

Added the KCP version validation fix in this PR too.

Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 16, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sedefsavas, vincepri

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@vincepri
Copy link
Member

@sedefsavas mind rebasing?

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 16, 2020
[KCP] Fix semver version validation for KCP spec.version
@k8s-ci-robot k8s-ci-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Mar 16, 2020
@vincepri
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 16, 2020
@k8s-ci-robot k8s-ci-robot merged commit 21c07c9 into kubernetes-sigs:master Mar 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add semver version validation rules wherever it applies
4 participants