Skip to content

Commit

Permalink
Test multiple scripts in one task executing with different UIDs
Browse files Browse the repository at this point in the history
Prior to this commit we weren't testing whether scripts were executable
when UIDs differed from Step to Step in a single Task.

This commit updates the step-script examples to vary the UID of each
Step. A failure of one of these would indicate that a bug has
been introduced in the permissions of the shell scripts that Tekton
generates and places in the /tekton/scripts directory.
  • Loading branch information
Scott authored and tekton-robot committed May 6, 2021
1 parent 98aef3b commit 18f337d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/v1alpha1/taskruns/step-script.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ spec:
env:
- name: FOO
value: foooooooo
# Test that Pods with containers run as different UIDs
# are able to run scripts regardless of any specific
# Step's UID.
securityContext:
runAsUser: 2000
script: |
#!/usr/bin/env bash
set -euxo pipefail
Expand All @@ -30,6 +35,8 @@ spec:
- name: place-file
image: ubuntu
securityContext:
runAsUser: 8000
script: |
#!/usr/bin/env bash
echo "echo Hello from script file" > /workspace/hello
Expand All @@ -42,6 +49,8 @@ spec:
- name: contains-eof
image: ubuntu
securityContext:
runAsUser: 16000
script: |
#!/usr/bin/env bash
cat > file << EOF
Expand Down
9 changes: 9 additions & 0 deletions examples/v1beta1/taskruns/step-script.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ spec:
env:
- name: FOO
value: foooooooo
# Test that Pods with containers run as different UIDs
# are able to run scripts regardless of any specific
# Step's UID.
securityContext:
runAsUser: 2000
script: |
#!/usr/bin/env bash
set -euxo pipefail
Expand All @@ -29,6 +34,8 @@ spec:
- name: place-file
image: ubuntu
securityContext:
runAsUser: 8000
script: |
#!/usr/bin/env bash
echo "echo Hello from script file" > /workspace/hello
Expand All @@ -41,6 +48,8 @@ spec:
- name: contains-eof
image: ubuntu
securityContext:
runAsUser: 16000
script: |
#!/usr/bin/env bash
cat > file << EOF
Expand Down

0 comments on commit 18f337d

Please sign in to comment.