-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add global_parameters upstream example (#596)
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
1 parent
5aee4de
commit 396c8cf
Showing
4 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
20
examples/workflows/upstream/global-parameters.upstream.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}}"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}}"], | ||
) |