diff --git a/docs/tasks.md b/docs/tasks.md index bf1bf5254da..1fe8ab90697 100644 --- a/docs/tasks.md +++ b/docs/tasks.md @@ -416,11 +416,8 @@ use it to build a docker image: steps: - image: docker name: client - workingDir: /workspace - command: - - /bin/sh - - -c - - | + script: | + #!/usr/bin/env bash cat > Dockerfile << EOF FROM ubuntu RUN apt-get update @@ -463,7 +460,7 @@ has been created to track this bug. [`outputs`](#outputs). -Input parameters can be referenced in the `Task` spec using the variable substitution syntax below, +Input parameters can be referenced in the `Task` spec using the variable substitution syntax below, where `` is the name of the parameter: ```shell @@ -481,19 +478,19 @@ So, with the following parameter: inputs: params: - name: array-param - value: + value: - "some" - "array" - "elements" ``` -then `command: ["first", "$(inputs.params.array-param)", "last"]` will become +then `command: ["first", "$(inputs.params.array-param)", "last"]` will become `command: ["first", "some", "array", "elements", "last"]` -Note that array parameters __*must*__ be referenced in a completely isolated string within a larger string array. -Any other attempt to reference an array is invalid and will throw an error. +Note that array parameters __*must*__ be referenced in a completely isolated string within a larger string array. +Any other attempt to reference an array is invalid and will throw an error. -For instance, if `build-args` is a declared parameter of type `array`, then this is an invalid step because +For instance, if `build-args` is a declared parameter of type `array`, then this is an invalid step because the string isn't isolated: ``` - name: build-step @@ -608,14 +605,17 @@ Mounting multiple volumes: spec: steps: - image: ubuntu - entrypoint: ["bash"] - args: ["-c", "curl https://foo.com > /var/my-volume"] + script: | + #!/usr/bin/env bash + curl https://foo.com > /var/my-volume volumeMounts: - name: my-volume mountPath: /var/my-volume - image: ubuntu - args: ["cat", "/etc/my-volume"] + script: | + #!/usr/bin/env bash + cat /etc/my-volume volumeMounts: - name: my-volume mountPath: /etc/my-volume @@ -639,8 +639,9 @@ spec: description: Name of volume steps: - image: ubuntu - entrypoint: ["bash"] - args: ["-c", "cat /var/configmap/test"] + script: | + #!/usr/bin/env bash + cat /var/configmap/test volumeMounts: - name: "$(inputs.params.volumeName)" mountPath: /var/configmap diff --git a/examples/taskruns/custom-volume.yaml b/examples/taskruns/custom-volume.yaml index 51092f29d0a..9729809b128 100644 --- a/examples/taskruns/custom-volume.yaml +++ b/examples/taskruns/custom-volume.yaml @@ -7,15 +7,17 @@ spec: steps: - name: write image: ubuntu - command: ["/bin/bash"] - args: ["-c", "echo some stuff > /im/a/custom/mount/path/file"] + script: | + #!/usr/bin/env bash + echo some stuff > /im/a/custom/mount/path/file volumeMounts: - name: custom mountPath: /im/a/custom/mount/path - name: read image: ubuntu - command: ["/bin/bash"] - args: ["-c", "cat /short/and/stout/file"] + script: | + #!/usr/bin/env bash + cat /short/and/stout/file volumeMounts: - name: custom mountPath: /short/and/stout diff --git a/examples/taskruns/dind-sidecar.yaml b/examples/taskruns/dind-sidecar.yaml index 8c746163fd4..d71f3aa469d 100644 --- a/examples/taskruns/dind-sidecar.yaml +++ b/examples/taskruns/dind-sidecar.yaml @@ -8,10 +8,8 @@ spec: - image: docker name: client workingDir: /workspace - command: - - /bin/sh - - -c - - | + script: | + #!/usr/bin/env sh cat > Dockerfile << EOF FROM ubuntu RUN apt-get update diff --git a/examples/taskruns/git-ssh-creds.yaml b/examples/taskruns/git-ssh-creds.yaml index 0c32a115ad9..3f29eab5b61 100644 --- a/examples/taskruns/git-ssh-creds.yaml +++ b/examples/taskruns/git-ssh-creds.yaml @@ -45,5 +45,6 @@ spec: steps: - name: config image: ubuntu - command: ["/bin/bash"] - args: ["-c", "cat /workspace/gitssh/README.md"] + script: | + #!/usr/bin/env bash + cat /workspace/gitssh/README.md diff --git a/examples/taskruns/secret-volume-params.yaml b/examples/taskruns/secret-volume-params.yaml index 77d505a83b1..0cd402b8810 100644 --- a/examples/taskruns/secret-volume-params.yaml +++ b/examples/taskruns/secret-volume-params.yaml @@ -18,10 +18,8 @@ spec: type: string steps: - image: ubuntu - command: - - '/bin/bash' - - '-c' - - | + script: | + #!/usr/bin/env bash SECRET_PASSWORD=$(cat /var/secret/ninja) [[ $SECRET_PASSWORD == SECRET_PASSWORD ]] volumeMounts: diff --git a/examples/taskruns/secret-volume.yaml b/examples/taskruns/secret-volume.yaml index fcff74a2947..c83f99471e1 100644 --- a/examples/taskruns/secret-volume.yaml +++ b/examples/taskruns/secret-volume.yaml @@ -13,10 +13,8 @@ spec: taskSpec: steps: - image: ubuntu - command: - - '/bin/bash' - - '-c' - - | + script: | + #!/usr/bin/env bash SECRET_PASSWORD=$(cat /var/secret/ninja) [[ $SECRET_PASSWORD == SECRET_PASSWORD ]] volumeMounts: diff --git a/examples/taskruns/task-volume-args.yaml b/examples/taskruns/task-volume-args.yaml index 3b90241312c..b04a5639ff3 100644 --- a/examples/taskruns/task-volume-args.yaml +++ b/examples/taskruns/task-volume-args.yaml @@ -8,7 +8,7 @@ data: apiVersion: tekton.dev/v1alpha1 kind: TaskRun metadata: - name: configmap-volume + generateName: task-volume-args- spec: taskSpec: inputs: @@ -19,8 +19,9 @@ spec: steps: - name: read image: ubuntu - command: ["/bin/bash"] - args: ["-c", "cat /configmap/test.data"] + script: | + #!/usr/bin/env bash + cat /configmap/test.data volumeMounts: - name: custom mountPath: /configmap diff --git a/examples/taskruns/template-volume.yaml b/examples/taskruns/template-volume.yaml index 124cc7c0045..358d69b050d 100644 --- a/examples/taskruns/template-volume.yaml +++ b/examples/taskruns/template-volume.yaml @@ -7,15 +7,17 @@ spec: steps: - name: write image: ubuntu - command: ["/bin/bash"] - args: ["-c", "echo some stuff > /im/a/custom/mount/path/file"] + script: | + #!/usr/bin/env bash + echo some stuff > /im/a/custom/mount/path/file volumeMounts: - name: custom mountPath: /im/a/custom/mount/path - name: read image: ubuntu - command: ["/bin/bash"] - args: ["-c", "cat /short/and/stout/file"] + script: | + #!/usr/bin/env bash + cat /short/and/stout/file volumeMounts: - name: custom mountPath: /short/and/stout