Skip to content
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

Expose pipelinerun status to taskrun #1016

Closed
dibyom opened this issue Jun 26, 2019 · 2 comments
Closed

Expose pipelinerun status to taskrun #1016

dibyom opened this issue Jun 26, 2019 · 2 comments
Labels
area/api Indicates an issue or PR that deals with the API. kind/design Categorizes issue or PR as related to design. kind/question Issues or PRs that are questions around the project or a particular feature

Comments

@dibyom
Copy link
Member

dibyom commented Jun 26, 2019

Expected Behavior

The use case is around tasks that can use the pipeline run status e.g. a task that updates github PR status based on the success/failure of a previous pipeline (#995 (comment)).

Actual Behavior

Does not exist though there is WIP to expose the pipelinerun status to the conditional container.

@vdemeester vdemeester added area/api Indicates an issue or PR that deals with the API. kind/design Categorizes issue or PR as related to design. kind/question Issues or PRs that are questions around the project or a particular feature labels Jun 26, 2019
@vdemeester
Copy link
Member

A task could use the kubernetes and Tekton API (given it has access to the cluster and the correct RBAC setup), and get information about the current Pipeline, this would only require that a reference of the current run (taskrun, pipelinerun) can be passed to the container process (as an environment variable, through variable interpolation, …).

@dibyom
Copy link
Member Author

dibyom commented Oct 15, 2019

@akihikokuroda pointed out that this is already possible in the design for #1020 :

Each task can know what the pipelinerun and taskrun it is executed under by mapping the label (tekton.dev/pipelineRun) to an environment variable and then using the Kube API to get the necessary information:

     env:
        - name: PIPELINERUN
          valueFrom:
            fieldRef:
              fieldPath: metadata.labels['tekton.dev/pipelineRun']

Ref: https://github.com/tektoncd/pipeline/blob/master/docs/labels.md
https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/
https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api Indicates an issue or PR that deals with the API. kind/design Categorizes issue or PR as related to design. kind/question Issues or PRs that are questions around the project or a particular feature
Projects
None yet
Development

No branches or pull requests

2 participants