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

docs: Modify examples for intermediate parameters #11532

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
30 changes: 30 additions & 0 deletions docs/fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ Workflow is the definition of a workflow resource

- [`input-artifact-s3.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/input-artifact-s3.yaml)

- [`intermediate-parameters.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/intermediate-parameters.yaml)

- [`k8s-jobs.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/k8s-jobs.yaml)

- [`k8s-json-patch-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/k8s-json-patch-workflow.yaml)
Expand Down Expand Up @@ -619,6 +621,8 @@ WorkflowSpec is the specification of a Workflow.

- [`input-artifact-s3.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/input-artifact-s3.yaml)

- [`intermediate-parameters.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/intermediate-parameters.yaml)

- [`k8s-json-patch-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/k8s-json-patch-workflow.yaml)

- [`k8s-owner-reference.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/k8s-owner-reference.yaml)
Expand Down Expand Up @@ -1052,6 +1056,8 @@ CronWorkflowSpec is the specification of a CronWorkflow

- [`input-artifact-s3.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/input-artifact-s3.yaml)

- [`intermediate-parameters.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/intermediate-parameters.yaml)

- [`k8s-json-patch-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/k8s-json-patch-workflow.yaml)

- [`k8s-owner-reference.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/k8s-owner-reference.yaml)
Expand Down Expand Up @@ -1878,6 +1884,8 @@ Outputs hold parameters, artifacts, and results from a step

- [`influxdb-ci.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/influxdb-ci.yaml)

- [`intermediate-parameters.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/intermediate-parameters.yaml)

- [`k8s-wait-wf.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/k8s-wait-wf.yaml)

- [`key-only-artifact.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/key-only-artifact.yaml)
Expand Down Expand Up @@ -2141,6 +2149,8 @@ Parameter indicate a passed string parameter to a service template with an optio

- [`influxdb-ci.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/influxdb-ci.yaml)

- [`intermediate-parameters.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/intermediate-parameters.yaml)

- [`k8s-wait-wf.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/k8s-wait-wf.yaml)

- [`label-value-from-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/label-value-from-workflow.yaml)
Expand Down Expand Up @@ -2708,6 +2718,8 @@ Inputs are the mechanism for passing parameters, artifacts, volumes from one tem

- [`input-artifact-s3.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/input-artifact-s3.yaml)

- [`intermediate-parameters.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/intermediate-parameters.yaml)

- [`k8s-wait-wf.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/k8s-wait-wf.yaml)

- [`key-only-artifact.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/key-only-artifact.yaml)
Expand Down Expand Up @@ -3012,6 +3024,8 @@ WorkflowStep is a reference to a template to execute in a series of step

- [`influxdb-ci.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/influxdb-ci.yaml)

- [`intermediate-parameters.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/intermediate-parameters.yaml)

- [`k8s-wait-wf.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/k8s-wait-wf.yaml)

- [`life-cycle-hooks-tmpl-level.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/life-cycle-hooks-tmpl-level.yaml)
Expand Down Expand Up @@ -3133,6 +3147,8 @@ SuspendTemplate is a template subtype to suspend a workflow at a predetermined p

- [`cron-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/cron-workflow.yaml)

- [`intermediate-parameters.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/intermediate-parameters.yaml)

- [`suspend-template-outputs.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/suspend-template-outputs.yaml)

- [`suspend-template.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/suspend-template.yaml)
Expand Down Expand Up @@ -3531,6 +3547,8 @@ ValueFrom describes a location in which to obtain the value to a parameter

- [`handle-large-output-results.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/handle-large-output-results.yaml)

- [`intermediate-parameters.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/intermediate-parameters.yaml)

- [`k8s-wait-wf.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/k8s-wait-wf.yaml)

- [`nested-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/nested-workflow.yaml)
Expand Down Expand Up @@ -4358,6 +4376,8 @@ SuppliedValueFrom is a placeholder for a value to be filled in directly, either
<summary>Examples with this field (click to open)</summary>
<br>

- [`intermediate-parameters.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/intermediate-parameters.yaml)

- [`suspend-template-outputs.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/suspend-template-outputs.yaml)
</details>

Expand Down Expand Up @@ -4443,6 +4463,8 @@ _No description available_

- [`handle-large-output-results.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/handle-large-output-results.yaml)

- [`intermediate-parameters.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/intermediate-parameters.yaml)

- [`k8s-wait-wf.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/k8s-wait-wf.yaml)

- [`nested-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/nested-workflow.yaml)
Expand Down Expand Up @@ -4723,6 +4745,8 @@ ObjectMeta is metadata that all persisted resources must have, which includes al

- [`input-artifact-s3.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/input-artifact-s3.yaml)

- [`intermediate-parameters.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/intermediate-parameters.yaml)

- [`k8s-json-patch-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/k8s-json-patch-workflow.yaml)

- [`k8s-owner-reference.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/k8s-owner-reference.yaml)
Expand Down Expand Up @@ -5345,6 +5369,8 @@ A single application container that you want to run within a pod.

- [`input-artifact-s3.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/input-artifact-s3.yaml)

- [`intermediate-parameters.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/intermediate-parameters.yaml)

- [`k8s-owner-reference.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/k8s-owner-reference.yaml)

- [`k8s-wait-wf.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/k8s-wait-wf.yaml)
Expand Down Expand Up @@ -6062,6 +6088,8 @@ PersistentVolumeClaimSpec describes the common attributes of storage devices and

- [`input-artifact-s3.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/input-artifact-s3.yaml)

- [`intermediate-parameters.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/intermediate-parameters.yaml)

- [`k8s-json-patch-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/k8s-json-patch-workflow.yaml)

- [`k8s-owner-reference.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/k8s-owner-reference.yaml)
Expand Down Expand Up @@ -6685,6 +6713,8 @@ EnvVarSource represents a source for the value of an EnvVar.

- [`handle-large-output-results.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/handle-large-output-results.yaml)

- [`intermediate-parameters.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/intermediate-parameters.yaml)

- [`k8s-wait-wf.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/k8s-wait-wf.yaml)

- [`nested-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/nested-workflow.yaml)
Expand Down
193 changes: 103 additions & 90 deletions docs/intermediate-inputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,46 +21,52 @@ The workflow will pause at a `Suspend` node, and user will be able to update par

## Intermediate Parameters Approval Example

- The below example shows static enum values `approval` step.
- The [below example](https://raw.githubusercontent.com/argoproj/argo-workflows/master/examples/intermediate-parameters.yaml) shows static enum values `approval` step.
- The user will be able to choose between `[YES, NO]` which will be used in subsequent steps.

[![Approval Example Demo](https://img.youtube.com/vi/eyeZ2oddwWE/0.jpg)](https://youtu.be/eyeZ2oddwWE)

```yaml

entrypoint: cicd-pipeline
templates:
- name: cicd-pipeline
steps:
- - name: deploy-pre-prod
template: deploy
- - name: approval
template: approval
- - name: deploy-prod
template: deploy
when: '{{steps.approval.outputs.parameters.approve}} == YES'
- name: approval
suspend: {}
inputs:
parameters:
- name: approve
default: 'NO'
enum:
- 'YES'
- 'NO'
outputs:
parameters:
- name: approve
valueFrom:
supplied: {}
- name: deploy
container:
image: 'argoproj/argosay:v2'
command:
- /argosay
args:
- echo
- deploying
apiVersion: argoproj.io/v1alpha1
agilgur5 marked this conversation as resolved.
Show resolved Hide resolved
kind: Workflow
metadata:
generateName: intermediate-parameters-cicd-
spec:
entrypoint: cicd-pipeline
templates:
- name: cicd-pipeline
steps:
- - name: deploy-pre-prod
template: deploy
- - name: approval
template: approval
- - name: deploy-prod
template: deploy
when: '{{steps.approval.outputs.parameters.approve}} == YES'
- name: approval
suspend: {}
inputs:
parameters:
- name: approve
default: 'NO'
enum:
- 'YES'
- 'NO'
description: >-
Choose YES to continue workflow and deploy to production
outputs:
parameters:
- name: approve
valueFrom:
supplied: {}
- name: deploy
container:
image: 'argoproj/argosay:v2'
command:
- /argosay
args:
- echo
- deploying
```

## Intermediate Parameters DB Schema Update Example
Expand All @@ -74,61 +80,68 @@ templates:
[![DB Schema Update Example Demo](https://img.youtube.com/vi/QgE-1782YJc/0.jpg)](https://youtu.be/QgE-1782YJc)

```yaml
entrypoint: db-schema-update
templates:
- name: db-schema-update
steps:
- - name: generate-db-list
template: generate-db-list
- - name: choose-db
template: choose-db
arguments:
parameters:
- name: db_name
value: '{{steps.generate-db-list.outputs.parameters.db_list}}'
- - name: update-schema
template: update-schema
arguments:
parameters:
- name: db_name
value: '{{steps.choose-db.outputs.parameters.db_name}}'
- name: generate-db-list
outputs:
parameters:
- name: db_list
valueFrom:
path: /tmp/db_list.txt
container:
name: main
image: 'argoproj/argosay:v2'
command:
- sh
- '-c'
args:
- >-
echo "{\"enum\": [\"db1\", \"db2\", \"db3\"]}" | tee /tmp/db_list.txt
- name: choose-db
inputs:
parameters:
- name: db_name
outputs:
parameters:
- name: db_name
valueFrom:
supplied: {}
suspend: {}
- name: update-schema
inputs:
parameters:
- name: db_name
container:
name: main
image: 'argoproj/argosay:v2'
command:
- sh
- '-c'
args:
- echo Updating DB {{inputs.parameters.db_name}}
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: intermediate-parameters-db-
spec:
entrypoint: db-schema-update
templates:
- name: db-schema-update
steps:
- - name: generate-db-list
template: generate-db-list
- - name: choose-db
template: choose-db
arguments:
parameters:
- name: db_name
value: '{{steps.generate-db-list.outputs.parameters.db_list}}'
- - name: update-schema
template: update-schema
arguments:
parameters:
- name: db_name
value: '{{steps.choose-db.outputs.parameters.db_name}}'
- name: generate-db-list
outputs:
parameters:
- name: db_list
valueFrom:
path: /tmp/db_list.txt
container:
name: main
image: 'argoproj/argosay:v2'
command:
- sh
- '-c'
args:
- >-
echo "{\"enum\": [\"db1\", \"db2\", \"db3\"]}" | tee /tmp/db_list.txt
- name: choose-db
inputs:
parameters:
- name: db_name
description: >-
Choose DB to update a schema
outputs:
parameters:
- name: db_name
valueFrom:
supplied: {}
suspend: {}
- name: update-schema
inputs:
parameters:
- name: db_name
container:
name: main
image: 'argoproj/argosay:v2'
command:
- sh
- '-c'
args:
- echo Updating DB {{inputs.parameters.db_name}}
```

### Some Important Details
Expand Down
42 changes: 42 additions & 0 deletions examples/intermediate-parameters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This example demonstrates the ability to use intermediate parameter.
# See https://argoproj.github.io/argo-workflows/intermediate-inputs/ for details.
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: intermediate-parameters-cicd-
spec:
entrypoint: cicd-pipeline
templates:
- name: cicd-pipeline
steps:
- - name: deploy-pre-prod
template: deploy
- - name: approval
template: approval
- - name: deploy-prod
template: deploy
when: '{{steps.approval.outputs.parameters.approve}} == YES'
- name: approval
suspend: {}
inputs:
parameters:
- name: approve
default: 'NO'
enum:
- 'YES'
- 'NO'
description: >-
Choose YES to continue workflow and deploy to production
outputs:
parameters:
- name: approve
valueFrom:
supplied: {}
- name: deploy
container:
image: 'argoproj/argosay:v2'
command:
- /argosay
args:
- echo
- deploying