-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsimple-condition.yaml
More file actions
49 lines (46 loc) · 1.26 KB
/
simple-condition.yaml
File metadata and controls
49 lines (46 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: samplecondition-
spec:
entrypoint: doNothing
templates:
- name: doNothing
steps:
# Add 1 and 2 to equal 3
- - name: add-numbers
template: add-numbers
# evaluate the result and decise what to do (multiplication or subtraction)
- - name: multiply
template: multiply # invoke multiplication when addition result is 3
when: "{{steps.add-numbers.outputs.result}} == 3"
- name: subtract
template: subtract # invoke subtraction when addition result is 2
when: "{{steps.add-numbers.outputs.result}} == 2"
- name: add-numbers
script:
image: python:alpine3.6
command: [python]
source: |
value1 = 1
value2 = 2
result = value1 + value2
print(result)
- name: multiply
container:
image: python:alpine3.6
command: [python]
source: |
value1 = 1
value2 = 2
result = value1 * value2
print(result)
- name: subtract
container:
image: python:alpine3.6
command: [python]
source: |
value1 = 100
value2 = 50
result = value1 - value2
print(result)