github.com/kubevela/workflow@v0.6.0/examples/run-with-template.md (about)

     1  # Run your workflow with template
     2  
     3  You can also create a Workflow Template and run it with a WorkflowRun with different context.
     4  
     5  Apply the following Workflow Template first:
     6  
     7  ```yaml
     8  apiVersion: core.oam.dev/v1alpha1
     9  kind: Workflow
    10  metadata:
    11    name: deploy-template
    12    namespace: default
    13  steps:
    14    - name: apply
    15      type: apply-deployment
    16      if: context.env == "dev"
    17      properties:
    18        image: nginx
    19    - name: apply-test
    20      type: apply-deployment
    21      if: context.env == "test"
    22      properties:
    23        image: crccheck/hello-world
    24  ```
    25  
    26  Apply the following WorkflowRun:
    27  
    28  ```yaml
    29  apiVersion: core.oam.dev/v1alpha1
    30  kind: WorkflowRun
    31  metadata:
    32    name: deploy-run
    33    namespace: default
    34  spec:
    35    context:
    36      env: dev
    37    workflowRef: deploy-template
    38  ```
    39  
    40  If you apply the WorkflowRun with `dev` in `context.env`, then you'll get a deployment with `nginx` image. If you change the `env` to `test`, you'll get a deployment with `crccheck/hello-world` image.