Skip to content

Commit

Permalink
Propagate params in pipelines
Browse files Browse the repository at this point in the history
Prior to this, we allowed parameter propagation in an inlined
pipelinerun. However, within a pipeline, we requrie a verbose spec.
This was an oversight as indicated in
tektoncd#7901.
This PR fixes that issue by updating the validation logic in the
webhook.

Fixes tektoncd#7901.

docs
  • Loading branch information
chitrangpatel committed May 10, 2024
1 parent 991f1e9 commit aa47541
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions docs/pipelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,45 @@ any resolved `param` value against the `enum` specified in each `PipelineTask` b

See usage in this [example](../examples/v1/pipelineruns/alpha/param-enum.yaml)

#### Propagated Params

Like with embedded [pipelineruns](pipelineruns.md#propagated-parameters), you can propagate `params` declared in the `pipeline` down to the inlined `pipelineTasks` and its inlined `Steps`. Wherever a resource (e.g. a `pipelineTask`) or a `StepAction` is referenced, the parameters need to be passed explicitly.

For example, the following is a valid yaml.

```yaml
apiVersion: tekton.dev/v1 # or tekton.dev/v1beta1
kind: Pipeline
metadata:
name: pipelien-propagated-params
spec:
params:
- name: HELLO
default: "Hello World!"
- name: BYE
default: "Bye World!"
tasks:
- name: echo-hello
taskSpec:
steps:
- name: echo
image: ubuntu
script: |
#!/usr/bin/env bash
echo "$(params.HELLO)"
- name: echo-bye
taskSpec:
steps:
- name: echo-action
ref:
name: step-action-echo
params:
- name: msg
value: "$(params.BYE)"
```
The same rules defined in [pipelineruns](pipelineruns.md#propagated-parameters) apply here.


## Adding `Tasks` to the `Pipeline`

Your `Pipeline` definition must reference at least one [`Task`](tasks.md).
Expand Down

0 comments on commit aa47541

Please sign in to comment.