-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
feat: support for variable interpolation in workspace.* (in PipelineRun and TaskRun) #7671
feat: support for variable interpolation in workspace.* (in PipelineRun and TaskRun) #7671
Conversation
Hi @l-qing. Thanks for your PR. I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the 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. |
docs/variables.md
Outdated
| `Task` | `spec.steps[].volumemounts.name` | | ||
| `Task` | `spec.steps[].volumemounts.mountpath` | | ||
| `Task` | `spec.steps[].volumemounts.subpath` | | ||
| `Task` | `spec.steps[].env.valueFrom.secretKeyRef.name` | |
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.
It should actually be camel case notation.
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.
This will go away once this is rebased on top of the related PR, 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.
Yes, that's why I set up the do-not-merge/hold
.
@@ -4891,18 +4891,18 @@ spec: | |||
steps: | |||
- name: s1 | |||
image: alpine | |||
script: | | |||
script: | |
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.
Remove trailing whitespace.
} | ||
} | ||
} | ||
pr.Spec.Workspaces = workspace.ReplaceWorkspaceBindingsVars(pr.Spec.Workspaces, stringReplacements) |
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.
Refactor this section of the code so that it can be reused in taskrun and pipelinerun.
|
||
// ReplaceWorkspaceBindingsVars returns a new slice of WorkspaceBinding with references to parameters replaced, | ||
// based on the mapping provided in replacements. | ||
func ReplaceWorkspaceBindingsVars(wbs []v1.WorkspaceBinding, replacements map[string]string) []v1.WorkspaceBinding { |
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.
This is an extracted public method for reuse in both taskrun and pipelinerun.
The following is the coverage report on the affected files.
|
21e1b05
to
b6478cf
Compare
The following is the coverage report on the affected files.
|
7a8abcd
to
ca41dc9
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
ca41dc9
to
c7e512f
Compare
The following is the coverage report on the affected files.
|
c7e512f
to
c61546f
Compare
The following is the coverage report on the affected files.
|
/cc @JeromeJu |
/ok-to-test |
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 @l-qing for this!
Would you mind splitting up the PR from refactoring and changing the variable camel cases according to https://github.com/tektoncd/community/blob/main/standards.md#small-pull-requests?
The following is the coverage report on the affected files.
|
c61546f
to
325e973
Compare
The following is the coverage report on the affected files.
|
/hold Hold this PR until the #7701 is merged. |
The following is the coverage report on the affected files.
|
Thank you for your suggestion. |
325e973
to
273bc7e
Compare
The following is the coverage report on the affected files.
|
name: "projected.sources.secret.items success", | ||
prs: []*v1.PipelineRun{parse.MustParseV1PipelineRun(t, ` | ||
metadata: | ||
name: test-pipeline-run-different-service-accs |
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: maybe the PR name should be more specific to the aspect we are testing here (variable substitution)
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 found that the latter part of the unit tests fixed the name of the PR, so any modifications would have to be changed consistently.
pipeline/pkg/reconciler/pipelinerun/pipelinerun_test.go
Lines 6135 to 6140 in d27e6cf
_, clients := prt.reconcileRun("foo", "test-pipeline-run-different-service-accs", []string{}, false) | |
// Check that the expected TaskRun was created | |
actual, err := clients.Pipeline.TektonV1().TaskRuns("foo").List(prt.TestAssets.Ctx, metav1.ListOptions{ | |
LabelSelector: "tekton.dev/pipelineTask=b-task,tekton.dev/pipelineRun=test-pipeline-run-different-service-accs", | |
Limit: 1, | |
}) |
I've uniformly renamed test-pipeline-run-different-service-accs
to test-pipeline-run-variable-substitution
to better reflect the purpose of this case.
The following is the coverage report on the affected files.
|
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!
/approve
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: afrittoli, vdemeester 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 |
…un and TaskRun) fix tektoncd#7667 Support for variable interpolation in: * spec.workspaces[].configMap.items[].* * spec.workspaces[].secret.items[].* * spec.workspaces[].projected.sources[].configMap.items[].* * spec.workspaces[].projected.sources[].secret.items[].*
273bc7e
to
42637e1
Compare
/unhold |
/lgtm |
Thank you very much, I was just about to at you for comment. 😆 |
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
fix #7667
Support for variable interpolation in:
Changes
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
/kind feature