Skip to content

How can I specify global exit handler? #6473

Answered by minty99
minty99 asked this question in Q&A
Discussion options

You must be logged in to vote

I asked this in Slack, 'Hong Wang' gave me good answer.
I should place templates section nested into spec.

  workflowDefaults: |
    spec:
      onExit: exit-handler
      templates:
      - name: exit-handler
        steps:
        - - name: job-success
            template: send-ok-noti
            when: "{{workflow.status}} == Succeeded"
          - name: job-fail
            template: send-fail-noti
            when: "{{workflow.status}} != Succeeded"
      - name: send-ok-noti
        container:
          image: 'some_image'
          env:
          - name: MESSAGE
            value: "{{workflow.name}} succeeded!"
      - name: send-fail-noti
        container:
          image: 'some…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by minty99
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant