Skip to content

Commit 50e6102

Browse files
committed
V1 CRD release
This commit adds the examples test for the v1 CRD. It sets the `served` fields of the CRDs to true.
1 parent 902c142 commit 50e6102

File tree

88 files changed

+4930
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+4930
-4
lines changed

config/300-pipeline.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ spec:
4242
# See issue: https://github.com/knative/serving/issues/912
4343
x-kubernetes-preserve-unknown-fields: true
4444
- name: v1
45-
served: false
45+
served: true
4646
storage: false
4747
schema:
4848
openAPIV3Schema:

config/300-pipelinerun.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ spec:
5757
subresources:
5858
status: {}
5959
- name: v1
60-
served: false
60+
served: true
6161
storage: false
6262
schema:
6363
openAPIV3Schema:

config/300-task.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ spec:
4444
subresources:
4545
status: {}
4646
- name: v1
47-
served: false
47+
served: true
4848
storage: false
4949
schema:
5050
openAPIV3Schema:

config/300-taskrun.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ spec:
5757
subresources:
5858
status: {}
5959
- name: v1
60-
served: false
60+
served: true
6161
storage: false
6262
schema:
6363
openAPIV3Schema:
File renamed without changes.
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
apiVersion: tekton.dev/v1
3+
kind: Task
4+
metadata:
5+
name: print-result
6+
spec:
7+
description: >-
8+
Prints a result from another task
9+
params:
10+
- name: TO_PRINT
11+
type: string
12+
steps:
13+
- name: print-result
14+
image: bash:latest
15+
env:
16+
- name: PARAM_TO_PRINT
17+
value: $(params.TO_PRINT)
18+
script: |
19+
#!/usr/bin/env bash
20+
set -e
21+
echo $PARAM_TO_PRINT
22+
---
23+
apiVersion: tekton.dev/v1
24+
kind: Task
25+
metadata:
26+
name: generate-result
27+
spec:
28+
description: >-
29+
Creates strings of length based on parameters and puts them into results fields
30+
params:
31+
- name: STRING_LENGTH
32+
description: Length of the string to create
33+
- name: STRING_CHAR
34+
description: Char to use when creating string
35+
type: string
36+
default: '.'
37+
results:
38+
- name: RESULT_STRING
39+
description: A result string
40+
steps:
41+
- name: gen-result
42+
image: bash:latest
43+
env:
44+
- name: PARAM_STRING_LENGTH
45+
value: $(params.STRING_LENGTH)
46+
- name: PARAM_STRING_CHAR
47+
value: $(params.STRING_CHAR)
48+
script: |
49+
#!/usr/bin/env bash
50+
set -e
51+
len=$PARAM_STRING_LENGTH
52+
ch=$PARAM_STRING_CHAR
53+
printf '%*s' "$len" | tr ' ' "$ch" >> $(results.RESULT_STRING.path)
54+
---
55+
apiVersion: tekton.dev/v1
56+
kind: Pipeline
57+
metadata:
58+
name: result-test
59+
spec:
60+
description: >-
61+
Generate a result of a certain length in a task and print the result in another task
62+
params:
63+
- name: RESULT_STRING_LENGTH
64+
description: Length of string to generate for generate-result task
65+
- name: RESULT_STRING_CHAR
66+
description: Char to repeat in result string
67+
default: '.'
68+
tasks:
69+
- name: generate-result
70+
params:
71+
- name: STRING_LENGTH
72+
value: $(params.RESULT_STRING_LENGTH)
73+
- name: STRING_CHAR
74+
value: $(params.RESULT_STRING_CHAR)
75+
taskRef:
76+
kind: Task
77+
name: generate-result
78+
- name: print-result
79+
params:
80+
- name: TO_PRINT
81+
value: $(tasks.generate-result.results.RESULT_STRING)
82+
taskRef:
83+
kind: Task
84+
name: print-result
85+
---
86+
apiVersion: tekton.dev/v1
87+
kind: PipelineRun
88+
metadata:
89+
name: result-test-run
90+
spec:
91+
pipelineRef:
92+
name: result-test
93+
params:
94+
- name: RESULT_STRING_LENGTH
95+
value: "3000"
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
kind: PipelineRun
2+
apiVersion: tekton.dev/v1
3+
metadata:
4+
generateName: pipelinerun-with-failing-step-
5+
spec:
6+
taskRunTemplate:
7+
serviceAccountName: 'default'
8+
params:
9+
- name: CONTINUE
10+
value: "continue"
11+
pipelineSpec:
12+
params:
13+
- name: CONTINUE
14+
tasks:
15+
- name: task1
16+
params:
17+
- name: CONTINUE
18+
value: "$(params.CONTINUE)"
19+
taskSpec:
20+
params:
21+
- name: CONTINUE
22+
steps:
23+
# not really doing anything here, just a hurdle to test the "ignore step error"
24+
- image: alpine
25+
onError: $(params.CONTINUE)
26+
name: exit-with-1
27+
script: |
28+
exit 1
29+
# initialize a task result which will be validated by the next task
30+
- image: alpine
31+
name: write-a-result
32+
onError: continue
33+
script: |
34+
echo -n 123 | tee $(results.task1-result.path)
35+
exit 11
36+
results:
37+
- name: task1-result
38+
description: result of a task1
39+
- name: task2
40+
runAfter: ["task1"]
41+
params:
42+
- name: task1-result
43+
value: $(tasks.task1.results.task1-result)
44+
taskSpec:
45+
params:
46+
- name: task1-result
47+
steps:
48+
# again, not really doing anything here, just a hurdle to test the "ignore step error"
49+
- image: alpine
50+
onError: continue
51+
name: exit-with-255
52+
script: |
53+
exit 255
54+
# verify that the task result was produced by the first task, fail if the result does not match
55+
- image: alpine
56+
name: verify-a-task-result
57+
script: |
58+
ls /tekton/results/
59+
if [ $(params.task1-result) == 123 ]; then
60+
echo "Yay! the task result matches which was initialized in the previous task while ignoring the step error"
61+
else
62+
echo "the task result does not match."
63+
exit 1
64+
fi
65+
# the last step of a task and one more hurdle
66+
- image: alpine
67+
name: exit-with-20
68+
onError: continue
69+
script: |
70+
exit 20
71+
---
72+
73+
apiVersion: tekton.dev/v1
74+
kind: PipelineRun
75+
metadata:
76+
generateName: pipelinerun-with-failing-step-and-ws-
77+
spec:
78+
workspaces:
79+
- name: ws
80+
volumeClaimTemplate:
81+
spec:
82+
accessModes:
83+
- ReadWriteOnce
84+
resources:
85+
requests:
86+
storage: 16Mi
87+
pipelineSpec:
88+
tasks:
89+
- name: writer
90+
taskSpec:
91+
steps:
92+
- name: write
93+
image: alpine
94+
onError: continue
95+
script: |
96+
ls -1 /tekton/run/
97+
echo bar > $(workspaces.task-ws.path)/foo
98+
exit 1
99+
workspaces:
100+
- name: task-ws
101+
workspaces:
102+
- name: task-ws
103+
workspace: ws
104+
- name: reader
105+
runAfter:
106+
- writer
107+
taskSpec:
108+
steps:
109+
- name: read
110+
image: alpine
111+
onError: continue
112+
script: |
113+
cat $(workspaces.myws.path)/foo | grep bar
114+
exit 1
115+
workspaces:
116+
- name: myws
117+
workspaces:
118+
- name: myws
119+
workspace: ws
120+
workspaces:
121+
- name: ws
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# In this contrived example 3 different kinds of workspace volume are used to thread
2+
# data through a pipeline's tasks.
3+
# 1. A ConfigMap is used as source of recipe data.
4+
# 2. A Secret is used to store a password.
5+
# 3. A PVC is used to share data from one task to the next.
6+
#
7+
# The end result is a pipeline that first checks if the password is correct and, if so,
8+
# copies data out of a recipe store onto a shared volume. The recipe data is then read
9+
# by a subsequent task and printed to screen.
10+
apiVersion: v1
11+
kind: ConfigMap
12+
metadata:
13+
name: sensitive-recipe-storage
14+
data:
15+
brownies: |
16+
1. Heat oven to 325 degrees F
17+
2. Melt 1/2 cup butter w/ 1/2 cup cocoa, stirring smooth.
18+
3. Remove from heat, allow to cool for a few minutes.
19+
4. Transfer to bowl.
20+
5. Whisk in 2 eggs, one at a time.
21+
6. Stir in vanilla.
22+
7. Separately combine 1 cup sugar, 1/4 cup flour, 1 cup chopped
23+
walnuts and pinch of salt
24+
8. Combine mixtures.
25+
9. Bake in greased pan for 30 minutes. Watch carefully for
26+
appropriate level of gooeyness.
27+
---
28+
apiVersion: v1
29+
kind: Secret
30+
metadata:
31+
name: secret-password
32+
type: Opaque
33+
data:
34+
password: aHVudGVyMg==
35+
---
36+
apiVersion: v1
37+
kind: PersistentVolumeClaim
38+
metadata:
39+
name: shared-task-storage
40+
spec:
41+
resources:
42+
requests:
43+
storage: 16Mi
44+
volumeMode: Filesystem
45+
accessModes:
46+
- ReadWriteOnce
47+
---
48+
apiVersion: tekton.dev/v1
49+
kind: Task
50+
metadata:
51+
name: fetch-secure-data
52+
spec:
53+
workspaces:
54+
- name: password-vault
55+
- name: recipe-store
56+
- name: shared-data
57+
steps:
58+
- name: fetch-and-write
59+
image: ubuntu
60+
script: |
61+
if [ "hunter2" = "$(cat $(workspaces.password-vault.path)/password)" ]; then
62+
cp $(workspaces.recipe-store.path)/recipe.txt $(workspaces.shared-data.path)
63+
else
64+
echo "wrong password!"
65+
exit 1
66+
fi
67+
---
68+
apiVersion: tekton.dev/v1
69+
kind: Task
70+
metadata:
71+
name: print-data
72+
spec:
73+
workspaces:
74+
- name: shared-data
75+
readOnly: true
76+
params:
77+
- name: filename
78+
steps:
79+
- name: print-secrets
80+
image: ubuntu
81+
script: cat $(workspaces.shared-data.path)/$(params.filename)
82+
---
83+
apiVersion: tekton.dev/v1
84+
kind: Pipeline
85+
metadata:
86+
name: fetch-and-print-recipe
87+
spec:
88+
workspaces:
89+
- name: password-vault
90+
- name: recipe-store
91+
- name: shared-data
92+
tasks:
93+
- name: fetch-the-recipe
94+
taskRef:
95+
name: fetch-secure-data
96+
workspaces:
97+
- name: password-vault
98+
- name: recipe-store
99+
- name: shared-data
100+
- name: print-the-recipe
101+
taskRef:
102+
name: print-data
103+
# Note: this is currently required to ensure order of write / read on PVC is correct.
104+
runAfter:
105+
- fetch-the-recipe
106+
params:
107+
- name: filename
108+
value: recipe.txt
109+
workspaces:
110+
- name: shared-data
111+
---
112+
apiVersion: tekton.dev/v1
113+
kind: PipelineRun
114+
metadata:
115+
generateName: recipe-time-
116+
spec:
117+
pipelineRef:
118+
name: fetch-and-print-recipe
119+
workspaces:
120+
- name: password-vault
121+
secret:
122+
secretName: secret-password
123+
- name: recipe-store
124+
configMap:
125+
name: sensitive-recipe-storage
126+
items:
127+
- key: brownies
128+
path: recipe.txt
129+
- name: shared-data
130+
persistentVolumeClaim:
131+
claimName: shared-task-storage

examples/v1/pipelineruns/no-ci/.keep

Whitespace-only changes.

0 commit comments

Comments
 (0)