Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add global_parameters upstream example #596

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}}"],
)