Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use script mode in even more examples #1695

Merged
merged 1 commit into from
Dec 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/taskruns/build-gcs-targz.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
type: storage
steps:
- image: ubuntu
command: ['cat', 'source/file.txt'] # tests build-gcs resource
script: cat source/file.txt
inputs:
resources:
- name: source
Expand Down
2 changes: 1 addition & 1 deletion examples/taskruns/build-gcs-zip.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
type: storage
steps:
- image: ubuntu
command: ['cat', 'source/file.txt'] # tests build-gcs resource
script: cat source/file.txt
inputs:
resources:
- name: source
Expand Down
2 changes: 0 additions & 2 deletions examples/taskruns/build-push-kaniko.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ spec:
env:
- name: "DOCKER_CONFIG"
value: "/tekton/home/.docker/"
command:
- /kaniko/executor
args:
- --dockerfile=$(inputs.params.pathToDockerFile)
- --destination=$(outputs.resources.builtImage.url)
Expand Down
23 changes: 5 additions & 18 deletions examples/taskruns/cloud-event.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,8 @@ spec:
- name: wait-for-sink
image: python:3-alpine
imagePullPolicy: IfNotPresent
command: ["/bin/sh"]
args:
- -ce
- |
cat <<EOF | python
script: |
#!/usr/bin/env python3
import http.client
import json
import sys
Expand All @@ -97,14 +94,9 @@ spec:
# resolve or it does not accept connections on 8080 yet
print("Not yet...")
time.sleep(10)
EOF
- name: build-index-json
image: busybox
command:
- /bin/sh
args:
- -ce
- |
script: |
set -e
cat <<EOF > $(outputs.resources.myimage.path)/index.json
{
Expand All @@ -117,7 +109,6 @@ spec:
}
]
}
EOF
---
apiVersion: tekton.dev/v1alpha1
kind: Task
Expand All @@ -128,11 +119,8 @@ spec:
- name: polling
image: python:3-alpine
imagePullPolicy: IfNotPresent
command: ["/bin/sh"]
args:
- -ce
- |
cat <<EOF | python
script: |
#!/usr/bin/env python3
import http.client
import json
import sys
Expand Down Expand Up @@ -162,7 +150,6 @@ spec:
else:
print("Not yet...")
time.sleep(10)
EOF
---
apiVersion: tekton.dev/v1alpha1
kind: TaskRun
Expand Down
2 changes: 1 addition & 1 deletion examples/taskruns/clustertask.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
spec:
steps:
- image: ubuntu
command: ['echo', 'hello']
script: echo hello
---
apiVersion: tekton.dev/v1alpha1
kind: TaskRun
Expand Down
7 changes: 3 additions & 4 deletions examples/taskruns/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ spec:
steps:
- name: secret
image: ubuntu
command: ['bash']
args:
- '-c'
- '[[ $(cat /config/test.data) == $TEST_DATA ]]'
script: |
#!/usr/bin/env bash
[[ $(cat /config/test.data) == $TEST_DATA ]]
env:
- name: TEST_DATA
valueFrom:
Expand Down
10 changes: 4 additions & 6 deletions examples/taskruns/custom-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ metadata:
spec:
taskSpec:
steps:
- name: test
image: ubuntu
command: ['bash']
args:
- '-c'
- '[[ $MY_VAR1 == foo ]]'
- image: ubuntu
script: |
#!/usr/bin/env bash
[[ $MY_VAR1 == foo ]]
env:
- name: MY_VAR1
value: foo
3 changes: 1 addition & 2 deletions examples/taskruns/docker-creds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,4 @@ spec:
- name: test
image: quay.io/rhpipeline/skopeo:alpine
# Test pulling a private builder container.
command: ["skopeo"]
args: ["copy", "docker://gcr.io/build-crd-testing/secret-sauce", "dir:///tmp/"]
script: skopeo copy docker://gcr.io/build-crd-testing/secret-sauce dir:///tmp/
4 changes: 1 addition & 3 deletions examples/taskruns/gcs-resource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ spec:
type: storage
steps:
- image: alpine
command: ['unzip', 'source/archive.zip']
- image: alpine
command: ['cat', 'file.txt']
script: unzip source/archive.zip && cat file.txt
inputs:
resources:
- name: source
Expand Down
15 changes: 6 additions & 9 deletions examples/taskruns/git-resource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ spec:
- name: skaffold
type: git
steps:
- name: read
image: ubuntu
command: ['cat', '/workspace/skaffold/README.md']
- image: ubuntu
script: cat skaffold/README.md
inputs:
resources:
- name: skaffold
Expand All @@ -34,9 +33,8 @@ spec:
- name: skaffold
type: git
steps:
- name: read
image: ubuntu
command: ['cat', '/workspace/skaffold/README.md']
- image: ubuntu
script: cat skaffold/README.md
inputs:
resources:
- name: skaffold
Expand All @@ -59,9 +57,8 @@ spec:
- name: skaffold
type: git
steps:
- name: read
image: ubuntu
command: ['cat', '/workspace/skaffold/README.md']
- image: ubuntu
script: cat skaffold/README.md
inputs:
resources:
- name: skaffold
Expand Down
10 changes: 4 additions & 6 deletions examples/taskruns/home-is-set.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ metadata:
spec:
taskSpec:
steps:
- name: test
image: ubuntu
command: ['bash']
args:
- '-c'
- '[[ $HOME == /tekton/home ]]'
- image: ubuntu
script: |
#!/usr/bin/env bash
[[ $HOME == /tekton/home ]]
11 changes: 5 additions & 6 deletions examples/taskruns/home-volume.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@ spec:
steps:
- name: write
image: ubuntu
command: ['bash']
args: ['-c', 'echo some stuff > /tekton/home/stuff']
script: echo some stuff > /tekton/home/stuff
- name: read
image: ubuntu
command: ['cat']
args: ['/tekton/home/stuff']
script: cat /tekton/home/stuff
- name: override-homevol
image: ubuntu
command: ['bash']
# /tekton/home/stuff *doesn't* exist, because the specified volumeMount
# conflicts with it, and the user's explicit declaration wins the tie.
args: ['-c', '[[ ! -f /tekton/home/stuff ]]']
script: |
#!/usr/bin/env bash
[[ ! -f /tekton/home/stuff ]]
volumeMounts:
- name: empty
mountPath: /tekton/home
Expand Down
13 changes: 6 additions & 7 deletions examples/taskruns/old-home-volume.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@ spec:
steps:
- name: write
image: ubuntu
command: ['bash']
args: ['-c', 'echo some stuff > /builder/home/stuff']
script: echo some stuff > /builder/home/stuff
- name: read
image: ubuntu
command: ['cat']
args: ['/builder/home/stuff']
script: cat /builder/home/stuff
- name: override-homevol
image: ubuntu
command: ['bash']
# /tekton/home/stuff *doesn't* exist, because the specified volumeMount
# /builder/home/stuff *doesn't* exist, because the specified volumeMount
# conflicts with it, and the user's explicit declaration wins the tie.
args: ['-c', '[[ ! -f /builder/home/stuff ]]']
script: |
#!/usr/bin/env bash
[[ ! -f /builder/home/stuff ]]
volumeMounts:
- name: empty
mountPath: /builder/home
Expand Down
3 changes: 1 addition & 2 deletions examples/taskruns/pull-private-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,4 @@ spec:
- name: pull
# Private image is just Ubuntu
image: quay.io/rhpipeline/skopeo:alpine
command: ["skopeo"]
args: ["copy", "docker://gcr.io/build-crd-testing/secret-sauce", "dir:///tmp/"]
script: skopeo copy docker://gcr.io/build-crd-testing/secret-sauce dir:///tmp/
9 changes: 3 additions & 6 deletions examples/taskruns/pullrequest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,11 @@ spec:
steps:
- name: dump-workspace
image: ubuntu
command: ["sh"]
args: ["-c", "find $(inputs.resources.pr.path)/* -type f | xargs tail -n +1"]
script: find $(inputs.resources.pr.path)/* -type f | xargs tail -n +1

- name: ensure-approved
image: ubuntu
command: ["/bin/bash"]
args:
- -c
- |
script: |
if [ -f "$(inputs.resources.pr.path)/labels/approved" ]; then
echo "PR is approved!"
else
Expand Down
7 changes: 3 additions & 4 deletions examples/taskruns/secret-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ spec:
steps:
- name: secret
image: ubuntu
command: ['bash']
args:
- '-c'
- '[[ $SECRET_PASSWORD == SECRET_PASSWORD ]]'
script: |
#!/usr/bin/env bash
[[ $SECRET_PASSWORD == SECRET_PASSWORD ]]
env:
- name: SECRET_PASSWORD
valueFrom:
Expand Down
2 changes: 1 addition & 1 deletion examples/taskruns/sidecar-ready.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
image: ubuntu
# The step will only succeed if the sidecar has written this file, which
# it does 5s after it starts, before it reports Ready.
command: ['cat', '/shared/ready']
script: cat /shared/ready
volumeMounts:
- name: shared
mountPath: /shared
Expand Down
25 changes: 15 additions & 10 deletions examples/taskruns/steptemplate-env-merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,35 +28,40 @@ spec:
# Test the environment variables are set in the task
- name: foo
image: ubuntu
command: ["bash"]
args: ["-c", '[[ $(FOO) == "foo" ]]']
script: |
#!/usr/bin/env bash
[[ $FOO == "foo" ]]
env:
- name: FOO
value: $(inputs.params.FOO)
- name: foobar
image: ubuntu
command: ["bash"]
args: ["-c", '[[ $(FOOBAR) == "foobar" ]]']
script: |
#!/usr/bin/env bash
[[ $FOOBAR == "foobar" ]]
env:
- name: FOOBAR
value: $(inputs.params.FOOBAR)
- name: bar
image: ubuntu
command: ["bash"]
args: ["-c", '[[ $(BAR) == "bar" ]]']
script: |
#!/usr/bin/env bash
[[ $BAR == "bar" ]]
env:
- name: BAR
value: $(inputs.params.BAR)
# Use the env var from the stepTemplate
- name: qux-no-override
image: ubuntu
command: ["bash"]
args: ["-c", '[[ $(QUX) == "original" ]]']
script: |
#!/usr/bin/env bash
[[ $QUX == "original" ]]
# Override the env var in the stepTemplate
- name: qux-override
image: ubuntu
command: ["bash"]
args: ["-c", '[[ $(QUX) == "override" ]]']
script: |
#!/usr/bin/env bash
[[ $QUX == "override" ]]
env:
- name: QUX
value: override
14 changes: 2 additions & 12 deletions examples/taskruns/task-multiple-output-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,7 @@ spec:
steps:
- name: build-and-push-1
image: busybox
command:
- /bin/sh
args:
- -ce
- |
script: |
set -ex
mkdir -p /tekton/home/image-outputs/builtImage1
cat <<EOF > /tekton/home/image-outputs/builtImage1/index.json
Expand All @@ -85,14 +81,9 @@ spec:
}
]
}
EOF
- name: build-and-push-2
image: busybox
command:
- /bin/sh
args:
- -ce
- |
script: |
set -e
mkdir -p /tekton/home/image-outputs/builtImage2
cat <<EOF > /tekton/home/image-outputs/builtImage2/index.json
Expand All @@ -106,7 +97,6 @@ spec:
}
]
}
EOF
---
apiVersion: tekton.dev/v1alpha1
kind: TaskRun
Expand Down
Loading