Pipeline: Support more context variables (uid, annotations, …)

Created on 17 Jul 2020  Â·  3Comments  Â·  Source: tektoncd/pipeline

Feature request


Related to https://github.com/tektoncd/pipeline/issues/2957, it would be nice if we could expose more metadata values in the variables, under context. Currently we do have pipelineRun.name, …

Additionnal variables could benefit from being exposed:

  • metadata.uid (on PipelineRun and TaskRun). As it is the unique id set by k8s (or whatever other impl. in the future). It could be used, for example, as a parameter for a task to tag an oci image, …
  • metadata.annotations (on PipelineRun and TaskRun). This could be useful in conjunction with something like https://github.com/tektoncd/community/pull/147 where you could then pass some "runtime" information to the task execution. How it is presented (aka an array, etc…) is something to discuss though.

Use case

Base on #2957, it could help having build number sequence feature (decoupled from tektoncd/pipeline but accessible for the tasks executions)

Being able to use something like $(context.pipelineRun.buildNumber) in an environment variable would make this easier.

Presumably the user would control when the sequence resets, and arguably be able to set a specific value on the sequence (similar to database sequences).

good first issue kinfeature prioritimportant-longterm

Most helpful comment

3017 added support for UIDs and validation for all context variables

whoops @jerop just brought this to my attention, the only outstanding item is annotations - adding metadata.annotations would be simple but if we want folks to be able to select specific annotations (which is more likely) we need something like #1393 to allow us to index into the list.

i feel like it might make sense to close this issue until we have #1393 - or if someone strongly wants annotations support, maybe open a separate issue just for annotations with more details?

All 3 comments

https://github.com/tektoncd/pipeline/pull/3017 added support for UIDs and validation for all context variables

there were a couple design choices to be made for annotations, which could be best explored in a design doc and discussed in the API WG, so will reopen this issue for now

/reopen

@jerop: Reopened this issue.

In response to this:

https://github.com/tektoncd/pipeline/pull/3017 added support for UIDs and validation for all context variables

there were a couple design choices to be made for annotations, which could be best explored in a design doc and discussed in the API WG, so will reopen this issue for now

/reopen

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.

3017 added support for UIDs and validation for all context variables

whoops @jerop just brought this to my attention, the only outstanding item is annotations - adding metadata.annotations would be simple but if we want folks to be able to select specific annotations (which is more likely) we need something like #1393 to allow us to index into the list.

i feel like it might make sense to close this issue until we have #1393 - or if someone strongly wants annotations support, maybe open a separate issue just for annotations with more details?

Was this page helpful?
0 / 5 - 0 ratings