I am unable to pass parameters to a Tekton task via the CLI or via TaskRun YAML.
Task file
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: ubuntu-test
namespace: tekton-pipelines
spec:
params:
- name: var
type: string
steps:
- env:
- name: VAR
value: $(params.var)
image: ubuntu
name: ''
resources: {}
script: |
#!/usr/bin/env bash
echo "Hello from Bash $VAR!"
TaskRun file
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
name: ubuntu-test-with-parameters
spec:
taskRef:
name: ubuntu-test
params:
- name: var
value:
- "John"
Regardless if I apply the TaskRun via the YAML file above or run tkn task start --showlog ubuntu-test -p var=John
I receive the following output:
[unnamed-0] Hello from Bash $(params.var)!
Environment Info
PS > tkn version
Client version: 0.16.0
Pipeline version: v0.10.1
Triggers version: v0.11.2
Dashboard version: v0.14.0
PS > oc version
Client Version: 4.6.16
Server Version: 4.6.15
Kubernetes Version: v1.19.0+1833054
It turns out the v10.1.1 pipeline release does not support the v1beta1
API version. I had followed an outdated tutorial here that installs an outdated version of Pipelines via an improperly tagged "latest" release.
If anyone comes across a similar issue, make sure your versions match the expected latest version of the GitHub release.