-
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
Add context variables for PipelineRun & TaskRun UIDs and add validation for all context variables #3017
Add context variables for PipelineRun & TaskRun UIDs and add validation for all context variables #3017
Conversation
/kind feature |
The following is the coverage report on the affected files.
|
80e76b1
to
fd2d31e
Compare
The following is the coverage report on the affected files.
|
fd2d31e
to
1623109
Compare
The following is the coverage report on the affected files.
|
f6a20cd
to
f0c51cd
Compare
The following is the coverage report on the affected files.
|
f0c51cd
to
607106a
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
607106a
to
f5867de
Compare
The following is the coverage report on the affected files.
|
bb9ac5e
to
26166ab
Compare
The following is the coverage report on the affected files.
|
26166ab
to
7ce79a3
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
7ce79a3
to
e8a167d
Compare
The following is the coverage report on the affected files.
|
e8a167d
to
e8aa5d5
Compare
The following is the coverage report on the affected files.
|
293beab
to
8d8db44
Compare
The following is the coverage report on the affected files.
|
8d8db44
to
d0388c3
Compare
The following is the coverage report on the affected files.
|
pkg/reconciler/taskrun/taskrun.go
Outdated
@@ -300,6 +300,12 @@ func (c *Reconciler) prepare(ctx context.Context, tr *v1beta1.TaskRun) (*v1beta1 | |||
return nil, nil, controller.NewPermanentError(err) | |||
} | |||
|
|||
if err := validateContextVariables(taskSpec, tr); err != nil { |
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 am having trouble seeing this one as non-exported in taskrun
and the other one exported in pipelinerun/resources
. Could they share code even ? (because we are "validating" the same thing, be it taskrun or other objects)
d0388c3
to
0bd4707
Compare
The following is the coverage report on the affected files.
|
0bd4707
to
658f70f
Compare
The following is the coverage report on the affected files.
|
658f70f
to
a2559ec
Compare
The following is the coverage report on the affected files.
|
a2559ec
to
a695f09
Compare
The following is the coverage report on the affected files.
|
A user may want to tag an oci image with the TaskRun or PipelineRun UIDs. Currently, they can't do that because `metadata.uid` for TaskRuns and PipelineRuns are not exposed. In this PR, we add the UID context variable for TaskRuns and PipelineRun. Users can now use `$(context.taskRun.uid)` and `$(context.pipelineRun.uid)` to access and use UIDs. In addition, we add validation for all context variables that are supported so far -- `context.task.name`, `context.taskRun.name`, `context.taskRun.namespace`, `context.taskRun.uid`, `context.pipeline.name`, `context.pipelineRun.name`, `context.pipelineRun.namespace`, `context.pipelineRun.uid`. Partially fixes tektoncd#2958
a695f09
to
5c0d1b0
Compare
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sbwsg 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 |
Changes
A user may want to tag an oci image with the TaskRun or PipelineRun UIDs.
Currently, they can't do that because
metadata.uid
for TaskRuns andPipelineRuns are not exposed.
In this PR, we add the UID context variable for TaskRuns and
PipelineRun. Users can now use
$(context.taskRun.uid)
and$(context.pipelineRun.uid)
to access and use UIDs.In addition, we add validation for all context variables that are
supported so far --
context.task.name
,context.taskRun.name
,context.taskRun.namespace
,context.taskRun.uid
,context.pipeline.name
,context.pipelineRun.name
,context.pipelineRun.namespace
,context.pipelineRun.uid
.Partially fixes #2958
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
See the contribution guide for more details.
Double check this list of stuff that's easy to miss:
cmd
dir, please updatethe release Task to build and release this image.
Reviewer Notes
If API changes are included, additive changes must be approved by at least two OWNERS and backwards incompatible changes must be approved by more than 50% of the OWNERS, and they must first be added in a backwards compatible way.
Release Notes