-
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
Variable interpolations for a TaskRun's name, etc. #1522
Comments
Tekton uses labels pretty effectively so you can use an "env" valueFrom with fieldRef to get most Tekton information. For example inside a
That works for Alternately you can use the Downward API to mount the labels as a volume to roughly the same effect. All in all I think this is probably sufficient for now and we should consider closing. |
@skaegi there is one trick to it though, those @imjasonh overall, I tend to agree with @skaegi, not sure it is required as of today, that said, it might be nice to have that "easy" variable interpolation in the future. |
I was able to use fieldRef to get the namespace. What about using this values in conditions for example if namespace is “prod” skip this step or add this step. Is that possible today? |
/assign R2wenD2 |
Since (inputs) is no longer a field on the resource, I'll use (runtime.) as the way to access names. |
Totally minor thing but in the working group update this morning i was typing |
Rather than runtime, lets use context.taskRunName so that the term runtime doesn't become overloaded. Please let me know if there are any concerns with adding a context scope. |
context sounds good to me! @R2wenD2 what do you think about |
I liked the idea with |
If we go that path I think we'd still want to scope it since it might not be clear which object's metadata you're talking about, e.g. |
I prefer |
I'll use "" as the default value for the name if a taskRun isn't a part of a pipelineRun. |
If it will start with I think also |
After some investigation, (and discussion with @bobcatfish) It makes sense to make the |
/close |
@R2wenD2: Closing this issue. 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. |
Expected Behavior
I'm able to reference the name of the TaskRun (and PipelineRun) I'm running inside of, from within the execution context.
Actual Behavior
I am not.
Additional Info
We could support this using variable interpolation, with a placeholder like
$(inputs.taskRunName)
or$(inputs.pipelineRunName)
etc. -- if the TaskRun is not part of a PipelineRun its name should be""
(or possibly be flagged as invalid?)There could also be variables for task name and pipeline name (
$(inputs.taskName)
, etc.), which could also be""
(or invalid) if the TaskRun is not running from a predefined, named Task.If we do this it probably also makes sense to be able to inject the namespace (
$(inputs.namespace)
and$(inputs.taskNamespace)
, since they can be in different namespaces. If it's a cluster-scoped Task,taskNamespace
could be""
(or invalid, some sentinel value).cc @csantanapr
/kind feature
/kind design
The text was updated successfully, but these errors were encountered: