Is it possible to have the status of a workflow running in the same namespace and conditionally launching a new one based on the status of it? #12088
Unanswered
asant-leitha
asked this question in
Q&A
Replies: 1 comment
-
Yes, it's possible using Parent apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: parent-workflow
namespace: argo
spec:
templates:
- name: main
steps:
- - name: parent-task
template: parent-task
- name: parent-task
container:
name: ""
image: python:3.9
command:
- python
- "-c"
args:
- |
import random
import sys
# 50% chance to fail
if random.random() < 0.5:
print("Simulating failure: Random fail triggered!")
sys.exit(1) # Exit with failure
else:
print("Hello from Parent Workflow!")
- name: exit-handler
steps:
- - name: launch-child
templateRef:
name: child-workflow
template: main
when: "{{workflow.status}} == Succeeded" # Child workflow will only run if parent workflow is successful
entrypoint: main
onExit: exit-handler Child apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: child-workflow
namespace: argo
spec:
templates:
- name: main
container:
name: ""
image: docker/whalesay:latest
command:
- cowsay
args:
- Hello from Child Workflow!
entrypoint: main |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I need to launch a new workflow if and only if another workflow succeeded.
Beta Was this translation helpful? Give feedback.
All reactions