Skip to content

Commit

Permalink
Add global_parameters upstream example (#596)
Browse files Browse the repository at this point in the history
Prepping example for #595, will make the changes to improve the Hera
syntax in another PR

Signed-off-by: Elliot Gunton <[email protected]>
  • Loading branch information
elliotgunton authored Apr 26, 2023
1 parent 5aee4de commit 396c8cf
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 0 deletions.
48 changes: 48 additions & 0 deletions docs/examples/workflows/upstream/global_parameters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Global Parameters

> Note: This example is a replication of an Argo Workflow example in Hera. The upstream example can be [found here](https://github.com/argoproj/argo-workflows/blob/master/examples/global-parameters.yaml).



=== "Hera"

```python linenums="1"
from hera.workflows import Container, Parameter, Workflow

with Workflow(
generate_name="global-parameters-",
entrypoint="whalesay1",
arguments=Parameter(name="message", value="hello world"),
) as w:
Container(
name="whalesay1",
image="docker/whalesay:latest",
command=["cowsay"],
args=["{{workflow.parameters.message}}"],
)
```

=== "YAML"

```yaml linenums="1"
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: global-parameters-
spec:
arguments:
parameters:
- name: message
value: hello world
entrypoint: whalesay1
templates:
- container:
args:
- '{{workflow.parameters.message}}'
command:
- cowsay
image: docker/whalesay:latest
name: whalesay1
```

20 changes: 20 additions & 0 deletions examples/workflows/upstream/global-parameters.upstream.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: global-parameters-
spec:
entrypoint: whalesay1
# Parameters can be passed/overridden via the argo CLI.
# To override the printed message, run `argo submit` with the -p option:
# $ argo submit examples/arguments-parameters.yaml -p message="goodbye world"
arguments:
parameters:
- name: message
value: hello world

templates:
- name: whalesay1
container:
image: docker/whalesay:latest
command: [cowsay]
args: ["{{workflow.parameters.message}}"]
18 changes: 18 additions & 0 deletions examples/workflows/upstream/global-parameters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: global-parameters-
spec:
arguments:
parameters:
- name: message
value: hello world
entrypoint: whalesay1
templates:
- container:
args:
- '{{workflow.parameters.message}}'
command:
- cowsay
image: docker/whalesay:latest
name: whalesay1
13 changes: 13 additions & 0 deletions examples/workflows/upstream/global_parameters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from hera.workflows import Container, Parameter, Workflow

with Workflow(
generate_name="global-parameters-",
entrypoint="whalesay1",
arguments=Parameter(name="message", value="hello world"),
) as w:
Container(
name="whalesay1",
image="docker/whalesay:latest",
command=["cowsay"],
args=["{{workflow.parameters.message}}"],
)

0 comments on commit 396c8cf

Please sign in to comment.