-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix: stepresult intepolations does not accept multiple matches #7830
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
fix: stepresult intepolations does not accept multiple matches #7830
Conversation
|
Skipping CI for Draft Pull Request. |
|
/kind fix |
|
@ericzzzzzzz: The label(s) In response to this:
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. |
|
convert pr status to review for testing ci, but this is not really ready for review |
|
/hold |
|
/kind bug |
|
/kind bug |
|
The following is the coverage report on the affected files.
|
|
The following is the coverage report on the affected files.
|
|
/hold cancel |
|
This is ready for review now ! thanks |
chitrangpatel
left a comment
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.
Thanks @ericzzzzzzz !!
|
/cherry-pick release-v0.56.x |
|
@chitrangpatel: once the present PR merges, I will cherry-pick it on top of release-v0.56.x in a new PR and assign it to you. In response to this:
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. |
|
@vdemeester, @JeromeJu PTAL 🙏 It will be nice to get this in before the bugfix release. |
adefe3f to
1855c8d
Compare
|
The following is the coverage report on the affected files.
|
|
The following is the coverage report on the affected files.
|
1855c8d to
197e565
Compare
|
The following is the coverage report on the affected files.
|
|
The following is the coverage report on the affected files.
|
JeromeJu
left a comment
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.
Thanks @ericzzzzzzz generally lgtm just some nits.
| // replaceCommandAndArgs performs replacements for step results in e.Command | ||
| func replaceCommandAndArgs(command []string, stepDir string) ([]string, error) { | ||
| newCommand := []string{} | ||
| var newCommand []string |
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.
NIT:
| var newCommand []string | |
| var newCommands []string |
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 think command is supposed to be singular, although it's a slice of string, because it is a command which does one thing and invoking a sub-command from a program requires its parent command, like ["gcloud", "run", "deploy"], we normally consider this as one command. Commands seems to indicate there are multiple commands to do many things. K8s spec for container also uses singular, although it's an a list of string.
pkg/entrypoint/entrypointer.go
Outdated
| func replaceCommandAndArgs(command []string, stepDir string) ([]string, error) { | ||
| newCommand := []string{} | ||
| var newCommand []string | ||
| flag: |
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.
dumb question: is this the best practice to have this here?
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.
Wondering if we change L439 to newC = replaceWithArray... can we move off this flag? - but will definitely leave for your decision on the implementation.
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 changed this a little to make it more readable
pkg/entrypoint/entrypointer.go
Outdated
| for _, m := range matches { | ||
| replaceWithString, replaceWithArray, err := findReplacement(stepDir, m[0]) | ||
| if err != nil { | ||
| return []string{}, err |
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.
Shall we consider wrapping the error here with the specific command arg that it fails on?
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: chitrangpatel, JeromeJu 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 |
197e565 to
5575605
Compare
|
The following is the coverage report on the affected files.
|
|
The following is the coverage report on the affected files.
|
vdemeester
left a comment
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.
/lgtm
|
@chitrangpatel: new pull request created: #7875 In response to this:
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. |
Changes
fixes: #7764
"$(steps.foo.results.res.first)-$(steps.foo.results.res.second)"set env variables for step.Submitter Checklist
As the author of this PR, please check off the items in this checklist:
/kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes