-
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
Unable to get tasks.TASK-NAME.status in finally section of the Pipeline #3762
Comments
@dmitry-mightydevops please note that access to execution status of non-finally tasks in finally tasks was added in tekton pipelines v0.20.0 but you're using tekton pipelines v0.15.2 it also looks like you're trying to use the status of finally task
your use case would be best solved by using an aggregate status of non-finally tasks, which is something that @pritidesai is working on another feature that could be useful is when expressions in finally tasks which will be included in the next release coming out this week, which can be used to solve this use case as such before aggregate status is available: apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: backend-build-pipeline
spec:
tasks:
- name: buildpack
taskRef:
name: buildpack
...
- name: kustomize
taskRef:
name: kustomize
runAfter:
- buildpack
...
- name: argocd-deploy
taskRef:
name: argocd-deploy
runAfter:
- kustomize
...
finally:
- name: slack-notification-succeeded
when:
- input: "Failed"
operator: notin
values:
- "$(tasks.buildpack.status)"
- "$(tasks.kustomize.status)"
- "$(tasks.argocd-deploy.status)"
taskRef:
name: slack-notification
params:
- name: status
value: "Succeeded"
...
- name: slack-notification-failed
when:
- input: "Failed"
operator: in
values:
- "$(tasks.buildpack.status)"
- "$(tasks.kustomize.status)"
- "$(tasks.argocd-deploy.status)"
taskRef:
name: slack-notification
params:
- name: status
value: "Failed"
... alternatively, we know apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: backend-build-pipeline
spec:
tasks:
- name: buildpack
taskRef:
name: buildpack
...
- name: kustomize
taskRef:
name: kustomize
runAfter:
- buildpack
...
- name: argocd-deploy
taskRef:
name: argocd-deploy
runAfter:
- kustomize
...
finally:
- name: slack-notification
taskRef:
name: slack-notification
params:
- name: status
value: "$(tasks.argocd-deploy.status)"
... so I don't think this is a bug, but an additional use case for providing the aggregate status of non-finally tasks to finally tasks |
@jerop thank you for the excellent explanation! |
Hello , I didn't get the finally task properly . |
Expected Behavior
Unable to get
tasks.TASK-NAME.status
in finally section of the PipelineTrying to follow this example - pipelinerun-task-execution-status.yaml
Essentially speaking I need to pass the value, which will be analyzed inside the slack-notification task based on the execution status of previous tasks. And if it fails - send a "Failure" notification, otherwise "Success" notification.
Here is my Pipeline:
Actual Behavior
Additional Info
The text was updated successfully, but these errors were encountered: