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

Be able to use pipeline execution status in pipeline finally #3806

Closed
eliihen opened this issue Mar 3, 2021 · 2 comments · Fixed by #3817
Closed

Be able to use pipeline execution status in pipeline finally #3806

eliihen opened this issue Mar 3, 2021 · 2 comments · Fixed by #3817
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@eliihen
Copy link

eliihen commented Mar 3, 2021

Feature request

It's currently possible to check individual tasks's execution status in a pipeline's finally, but seemingly not the pipeline's execution status as a whole. One could imagine this is a pretty common usecase, as acting on the pipeline's result would make control flow easier as checking each individual task's execution status doesn't scale with larger pipelines. Having a single field for the pipeline result that the user could combine with when expressions would make a pretty user-friendly way clean up after a pipeline depending on the results.

This feature request suggests adding a variable binding to the pipeline that is accessible from a pipeline's "finally". For example context.pipelineRun.status or similar.

Use case

We're trying to implement our first pipeline using the github-set-status task. Roughly the idea is to set the github commit status to pending when the pipeline starts, do some stuff, and whenever the pipeline fails sets the github commit status to failed. The latter I just can't seem to figure out.

I would like to do something like the following (some parts omitted for brevity):

apiVersion: tekton.dev/v1beta1
kind: Pipeline
spec:
  tasks:
    - name: github-set-pending
      taskRef:
        name: github-set-status
      params:
        - name: STATE
          value: pending
    # .. More tasks
  finally:
    - name: github-set-error
      when:
        - input: "$(context.pipelineRun.status)"
          operator: in
          values: ["Failure"]
      taskRef:
        name: github-set-status
      params:
        - name: STATE
          value: error
        - name: DESCRIPTION
          value: "$(context.pipelineRun.statusMessage)"

From the documentation it's unclear what the idiomatic way to fetch pipeline execution status in finally is. I looked for some time without finding it, apologies if I missed something obvious.

If this feature is hard to implement, then it may be wise to document a workaround under Adding finally to the Pipeline in the interim.

@eliihen eliihen added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 3, 2021
@pritidesai
Copy link
Member

/assign

@pritidesai
Copy link
Member

@esphen can you please review the proposal tektoncd/community#371 and let me know if it matches your expectations?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants