Capture error message/failure reason on task level #13522
Answered
by
jswxstw
sonamdolphin9192
asked this question in
Q&A
-
Hi, apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: exit-handler-with-param-
labels:
workflows.argoproj.io/test: "true"
annotations:
workflows.argoproj.io/description: |
onExitTemplate enables workflow to pass the arguments (parameters/Artifacts) to exit handler template.
workflows.argoproj.io/version: ">= 3.1.0"
spec:
entrypoint: main
templates:
- name: main
dag:
tasks:
- name: task-1
template: output
hooks:
exit:
template: exit
arguments:
parameters:
- name: error_message
value: "{{tasks.task-1.error_message}}" # Need error message on task level
- name: output
container:
image: python:alpine3.6
command: [sh, -c]
args: ["echo -n hello world > /tmp/hello_world.txt"]
outputs:
parameters:
- name: result
valueFrom:
default: "Foobar"
path: /tmp/hello_world.txt
- name: exit
inputs:
parameters:
- name: error_message
script:
image: python:alpine3.6
command: [ python ]
source: |
print("{{inputs.parameters.error_message}}") |
Beta Was this translation helpful? Give feedback.
Answered by
jswxstw
Aug 29, 2024
Replies: 2 comments 3 replies
-
There is a variable |
Beta Was this translation helpful? Give feedback.
2 replies
-
Can we log a ticket as a feature request for this ? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It is not supported yet, there are only variable
workflow.failures
andlastRetry.message
has the node error message.You may need to extract task/step level message from
workflow.failures
now.