-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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 source secret validation to new build #18429
Add source secret validation to new build #18429
Conversation
@nak3 can you add quick unit test that exercise this with wrong secret name and correct secret name? |
@mfojtik Thank you. I added the test to |
pkg/oc/generate/cmd/newapp.go
Outdated
@@ -898,6 +898,9 @@ func (c *AppConfig) Run() (*AppResult, error) { | |||
} | |||
} | |||
if len(c.SourceSecret) > 0 { | |||
if len(validation.ValidateSecretName(c.SourceSecret, false)) != 0 { | |||
return nil, fmt.Errorf("the %q must be valid secret name", c.SourceSecret) |
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 suggest "source secret name %q is invalid"
@nak3 thanks for the PR. The test looks fine, please just update the actual error text and I'll lgtm :) |
@jim-minter Thank you. Sure, I updated. |
Thanks @nak - one more thing - please squash the commits. |
This patch makes a tiny change by adding source secret name validation to new build. Currently even though build-secret has the validation, source secret does not.
@jim-minter Thank you. Sure, I have done now. |
/lgtm |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bparees, jim-minter, nak3 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
Automatic merge from submit-queue. |
This patch makes a tiny change by adding source secret name validation
to new build.
Currently even though build-secret has the validation, source secret
does not.