Skip to content

Commit

Permalink
Update upstream examples
Browse files Browse the repository at this point in the history
See argoproj/argo-workflows#13429

Signed-off-by: Elliot Gunton <elliotgunton@gmail.com>
  • Loading branch information
elliotgunton committed Aug 19, 2024
1 parent f87154e commit c081175
Show file tree
Hide file tree
Showing 193 changed files with 1,160 additions and 1,105 deletions.
5 changes: 3 additions & 2 deletions docs/examples/workflows-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ Explore the examples through the side bar!
| [k8s-jobs](https://github.com/argoproj/argo-workflows/blob/main/examples/k8s-jobs.yaml) |
| [k8s-orchestration](https://github.com/argoproj/argo-workflows/blob/main/examples/k8s-orchestration.yaml) |
| [k8s-owner-reference](https://github.com/argoproj/argo-workflows/blob/main/examples/k8s-owner-reference.yaml) |
| [k8s-patch](https://github.com/argoproj/argo-workflows/blob/main/examples/k8s-patch.yaml) |
| [k8s-patch-basic](https://github.com/argoproj/argo-workflows/blob/main/examples/k8s-patch-basic.yaml) |
| [k8s-patch-json-pod](https://github.com/argoproj/argo-workflows/blob/main/examples/k8s-patch-json-pod.yaml) |
| [k8s-patch-merge-pod](https://github.com/argoproj/argo-workflows/blob/main/examples/k8s-patch-merge-pod.yaml) |
| [k8s-patch-pod](https://github.com/argoproj/argo-workflows/blob/main/examples/k8s-patch-pod.yaml) |
| [k8s-wait-wf](https://github.com/argoproj/argo-workflows/blob/main/examples/k8s-wait-wf.yaml) |
| [label-value-from-workflow](https://github.com/argoproj/argo-workflows/blob/main/examples/label-value-from-workflow.yaml) |
| [loops-param-argument](https://github.com/argoproj/argo-workflows/blob/main/examples/loops-param-argument.yaml) |
Expand Down
16 changes: 8 additions & 8 deletions docs/examples/workflows/upstream/archive_location.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ The upstream example can be [found here](https://github.com/argoproj/argo-workfl

with Workflow(
generate_name="archive-location-",
entrypoint="whalesay",
entrypoint="hello-world",
) as w:
Container(
name="whalesay",
image="docker/whalesay:latest",
command=["cowsay"],
name="hello-world",
image="busybox",
command=["echo"],
args=["hello world"],
archive_location={"archive_logs": True},
)
Expand All @@ -37,16 +37,16 @@ The upstream example can be [found here](https://github.com/argoproj/argo-workfl
metadata:
generateName: archive-location-
spec:
entrypoint: whalesay
entrypoint: hello-world
templates:
- archiveLocation:
archiveLogs: true
container:
args:
- hello world
command:
- cowsay
image: docker/whalesay:latest
name: whalesay
- echo
image: busybox
name: hello-world
```

16 changes: 8 additions & 8 deletions docs/examples/workflows/upstream/arguments_parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ The upstream example can be [found here](https://github.com/argoproj/argo-workfl

with Workflow(
generate_name="arguments-parameters-",
entrypoint="whalesay",
entrypoint="print-message",
arguments=Parameter(name="message", value="hello world"),
) as w:
Container(
name="whalesay",
image="docker/whalesay:latest",
command=["cowsay"],
name="print-message",
image="busybox",
command=["echo"],
args=["{{inputs.parameters.message}}"],
inputs=Parameter(name="message"),
)
Expand All @@ -39,17 +39,17 @@ The upstream example can be [found here](https://github.com/argoproj/argo-workfl
parameters:
- name: message
value: hello world
entrypoint: whalesay
entrypoint: print-message
templates:
- container:
args:
- '{{inputs.parameters.message}}'
command:
- cowsay
image: docker/whalesay:latest
- echo
image: busybox
inputs:
parameters:
- name: message
name: whalesay
name: print-message
```

Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ The upstream example can be [found here](https://github.com/argoproj/argo-workfl

with Workflow(
generate_name="arguments-parameters-from-configmap-",
entrypoint="whalesay",
entrypoint="print-message-from-configmap",
service_account_name="argo",
) as w:
Container(
name="whalesay",
image="argoproj/argosay:v2",
args=["echo", "{{inputs.parameters.message}}"],
name="print-message-from-configmap",
image="busybox",
command=["echo"],
args=["{{inputs.parameters.message}}"],
inputs=Parameter(
name="message",
value_from=m.ValueFrom(
Expand All @@ -47,21 +48,22 @@ The upstream example can be [found here](https://github.com/argoproj/argo-workfl
metadata:
generateName: arguments-parameters-from-configmap-
spec:
entrypoint: whalesay
entrypoint: print-message-from-configmap
serviceAccountName: argo
templates:
- container:
args:
- echo
- '{{inputs.parameters.message}}'
image: argoproj/argosay:v2
command:
- echo
image: busybox
inputs:
parameters:
- name: message
valueFrom:
configMapKeyRef:
key: msg
name: simple-parameters
name: whalesay
name: print-message-from-configmap
```

28 changes: 14 additions & 14 deletions docs/examples/workflows/upstream/artifact_disable_archive.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ The upstream example can be [found here](https://github.com/argoproj/argo-workfl
)

with Workflow(generate_name="artifact-disable-archive-", entrypoint="artifact-disable-archive") as w:
whalesay = Container(
name="whalesay",
image="docker/whalesay:latest",
hello_world_to_file = Container(
name="hello-world-to-file",
image="busybox",
command=["sh", "-c"],
args=["cowsay hello world | tee /tmp/hello_world.txt | tee /tmp/hello_world_nc.txt ; sleep 1"],
args=["echo hello world | tee /tmp/hello_world.txt | tee /tmp/hello_world_nc.txt ; sleep 1"],
outputs=[
Artifact(name="etc", path="/etc", archive=NoneArchiveStrategy()),
Artifact(name="hello-txt", path="/tmp/hello_world.txt", archive=NoneArchiveStrategy()),
Expand All @@ -37,8 +37,8 @@ The upstream example can be [found here](https://github.com/argoproj/argo-workfl
),
],
)
print_message = Container(
name="print-message",
print_message_from_files = Container(
name="print-message-from-files",
image="alpine:latest",
command=["sh", "-c"],
args=["cat /tmp/hello.txt && cat /tmp/hello_nc.txt && cd /tmp/etc && find ."],
Expand All @@ -49,10 +49,10 @@ The upstream example can be [found here](https://github.com/argoproj/argo-workfl
],
)
with Steps(name="artifact-disable-archive") as s:
Step(name="generate-artifact", template=whalesay)
Step(name="generate-artifact", template=hello_world_to_file)
Step(
name="consume-artifact",
template=print_message,
template=print_message_from_files,
arguments=[
Artifact(name="etc", from_="{{steps.generate-artifact.outputs.artifacts.etc}}"),
Artifact(name="hello-txt", from_="{{steps.generate-artifact.outputs.artifacts.hello-txt}}"),
Expand All @@ -73,13 +73,13 @@ The upstream example can be [found here](https://github.com/argoproj/argo-workfl
templates:
- container:
args:
- cowsay hello world | tee /tmp/hello_world.txt | tee /tmp/hello_world_nc.txt
- echo hello world | tee /tmp/hello_world.txt | tee /tmp/hello_world_nc.txt
; sleep 1
command:
- sh
- -c
image: docker/whalesay:latest
name: whalesay
image: busybox
name: hello-world-to-file
outputs:
artifacts:
- archive:
Expand Down Expand Up @@ -110,11 +110,11 @@ The upstream example can be [found here](https://github.com/argoproj/argo-workfl
path: /tmp/hello.txt
- name: hello-txt-nc
path: /tmp/hello_nc.txt
name: print-message
name: print-message-from-files
- name: artifact-disable-archive
steps:
- - name: generate-artifact
template: whalesay
template: hello-world-to-file
- - arguments:
artifacts:
- from: '{{steps.generate-artifact.outputs.artifacts.etc}}'
Expand All @@ -124,6 +124,6 @@ The upstream example can be [found here](https://github.com/argoproj/argo-workfl
- from: '{{steps.generate-artifact.outputs.artifacts.hello-txt-nc}}'
name: hello-txt-nc
name: consume-artifact
template: print-message
template: print-message-from-files
```

28 changes: 14 additions & 14 deletions docs/examples/workflows/upstream/artifact_passing.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@ The upstream example can be [found here](https://github.com/argoproj/argo-workfl
from hera.workflows import Artifact, Container, Step, Steps, Workflow

with Workflow(generate_name="artifact-passing-", entrypoint="artifact-example") as w:
whalesay = Container(
name="whalesay",
image="docker/whalesay:latest",
hello_world_to_file = Container(
name="hello-world-to-file",
image="busybox",
command=["sh", "-c"],
args=["sleep 1; cowsay hello world | tee /tmp/hello_world.txt"],
args=["sleep 1; echo hello world | tee /tmp/hello_world.txt"],
outputs=[Artifact(name="hello-art", path="/tmp/hello_world.txt")],
)
print_message = Container(
name="print-message",
print_message_from_file = Container(
name="print-message-from-file",
image="alpine:latest",
command=["sh", "-c"],
args=["cat /tmp/message"],
inputs=[Artifact(name="message", path="/tmp/message")],
)

with Steps(name="artifact-example") as s:
gen_step = Step(name="generate-artifact", template=whalesay)
gen_step = Step(name="generate-artifact", template=hello_world_to_file)
Step(
name="consume-artifact",
template=print_message,
template=print_message_from_file,
arguments=gen_step.get_artifact("hello-art").with_name("message"),
)
```
Expand All @@ -50,12 +50,12 @@ The upstream example can be [found here](https://github.com/argoproj/argo-workfl
templates:
- container:
args:
- sleep 1; cowsay hello world | tee /tmp/hello_world.txt
- sleep 1; echo hello world | tee /tmp/hello_world.txt
command:
- sh
- -c
image: docker/whalesay:latest
name: whalesay
image: busybox
name: hello-world-to-file
outputs:
artifacts:
- name: hello-art
Expand All @@ -71,16 +71,16 @@ The upstream example can be [found here](https://github.com/argoproj/argo-workfl
artifacts:
- name: message
path: /tmp/message
name: print-message
name: print-message-from-file
- name: artifact-example
steps:
- - name: generate-artifact
template: whalesay
template: hello-world-to-file
- - arguments:
artifacts:
- from: '{{steps.generate-artifact.outputs.artifacts.hello-art}}'
name: message
name: consume-artifact
template: print-message
template: print-message-from-file
```

28 changes: 14 additions & 14 deletions docs/examples/workflows/upstream/artifact_passing_subpath.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ The upstream example can be [found here](https://github.com/argoproj/argo-workfl
)

with Workflow(generate_name="artifact-passing-subpath-", entrypoint="artifact-example") as w:
whalesay = Container(
name="whalesay",
image="docker/whalesay:latest",
hello_world_to_file = Container(
name="hello-world-to-file",
image="busybox",
command=["sh", "-c"],
args=["sleep 1; cowsay hello world | tee /tmp/hello_world.txt"],
args=["sleep 1; echo hello world | tee /tmp/hello_world.txt"],
outputs=[Artifact(name="hello-art", path="/tmp/", archive=NoneArchiveStrategy())],
)
print_message_dir = Container(
Expand All @@ -35,23 +35,23 @@ The upstream example can be [found here](https://github.com/argoproj/argo-workfl
args=["ls /tmp/message"],
inputs=[Artifact(name="message", path="/tmp/message")],
)
print_message = Container(
name="print-message",
print_message_from_file = Container(
name="print-message-from-file",
image="alpine:latest",
command=["sh", "-c"],
args=["cat /tmp/message"],
inputs=[Artifact(name="message", path="/tmp/message")],
)
with Steps(name="artifact-example") as s:
Step(name="generate-artifact", template=whalesay)
Step(name="generate-artifact", template=hello_world_to_file)
Step(
name="list-artifact",
template=print_message_dir,
arguments=[Artifact(name="message", from_="{{steps.generate-artifact.outputs.artifacts.hello-art}}")],
)
Step(
name="consume-artifact",
template=print_message,
template=print_message_from_file,
arguments=[
Artifact(
name="message",
Expand All @@ -74,12 +74,12 @@ The upstream example can be [found here](https://github.com/argoproj/argo-workfl
templates:
- container:
args:
- sleep 1; cowsay hello world | tee /tmp/hello_world.txt
- sleep 1; echo hello world | tee /tmp/hello_world.txt
command:
- sh
- -c
image: docker/whalesay:latest
name: whalesay
image: busybox
name: hello-world-to-file
outputs:
artifacts:
- archive:
Expand Down Expand Up @@ -109,11 +109,11 @@ The upstream example can be [found here](https://github.com/argoproj/argo-workfl
artifacts:
- name: message
path: /tmp/message
name: print-message
name: print-message-from-file
- name: artifact-example
steps:
- - name: generate-artifact
template: whalesay
template: hello-world-to-file
- - arguments:
artifacts:
- from: '{{steps.generate-artifact.outputs.artifacts.hello-art}}'
Expand All @@ -126,6 +126,6 @@ The upstream example can be [found here](https://github.com/argoproj/argo-workfl
name: message
subPath: hello_world.txt
name: consume-artifact
template: print-message
template: print-message-from-file
```

8 changes: 4 additions & 4 deletions docs/examples/workflows/upstream/artifact_repository_ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ The upstream example can be [found here](https://github.com/argoproj/argo-workfl
) as w:
Container(
name="main",
image="docker/whalesay:latest",
image="busybox",
command=["sh", "-c"],
args=["cowsay hello world | tee /tmp/hello_world.txt"],
args=["echo hello world | tee /tmp/hello_world.txt"],
outputs=[Artifact(name="hello_world", path="/tmp/hello_world.txt")],
)
```
Expand All @@ -46,11 +46,11 @@ The upstream example can be [found here](https://github.com/argoproj/argo-workfl
templates:
- container:
args:
- cowsay hello world | tee /tmp/hello_world.txt
- echo hello world | tee /tmp/hello_world.txt
command:
- sh
- -c
image: docker/whalesay:latest
image: busybox
name: main
outputs:
artifacts:
Expand Down
Loading

0 comments on commit c081175

Please sign in to comment.