Skip to content

Commit 75344ee

Browse files
afrittolitekton-robot
authored andcommitted
Use kubectl create instead of apply
When running YAML E2E tests, use kubectl create instead of apply, so that example can use generateName, which is a best practice for run objects (TaskRun/PipelineRun). Using "create" also exposed name conflicts for several resources all named the same. Luckily the content of those secret was the same, so we had no race condition in the past, but it's best to avoid side effects between tests as much as possible and keep resource names uniques across examples. With this change we start running taskrun tests again, and it turns out the gitlab test is broken because of a broken gitlab URL. Introduce a subfolder for examples that are valid but that we don't want to run in CI because they need some access to a resource which is not available. The Gitlab test has been removed before this was merged, but keeping the no-ci folder anyways as it may be useful for examples that we have no easy way to run in CI. Fixes tektoncd#1397
1 parent e01fe60 commit 75344ee

14 files changed

+40
-35
lines changed

examples/pipelineruns/no-ci/.keep

Whitespace-only changes.

examples/pipelineruns/output-pipelinerun.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: tekton.dev/v1alpha1
22
kind: PipelineResource
33
metadata:
4-
name: skaffold-git
4+
name: skaffold-git-output-pipelinerun
55
spec:
66
type: git
77
params:
@@ -102,4 +102,4 @@ spec:
102102
resources:
103103
- name: source-repo
104104
resourceRef:
105-
name: skaffold-git
105+
name: skaffold-git-output-pipelinerun

examples/pipelineruns/pipelinerun.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ spec:
1616
apiVersion: rbac.authorization.k8s.io/v1
1717
kind: ClusterRoleBinding
1818
metadata:
19-
name: default-cluster-admin
19+
generateName: default-cluster-admin-
2020
subjects:
2121
- kind: ServiceAccount
2222
name: default
@@ -29,7 +29,7 @@ roleRef:
2929
apiVersion: tekton.dev/v1alpha1
3030
kind: PipelineResource
3131
metadata:
32-
name: skaffold-image-leeroy-web
32+
name: skaffold-image-leeroy-web-pipelinerun
3333
spec:
3434
type: image
3535
params:
@@ -39,7 +39,7 @@ spec:
3939
apiVersion: tekton.dev/v1alpha1
4040
kind: PipelineResource
4141
metadata:
42-
name: skaffold-git
42+
name: skaffold-git-pipelinerun
4343
spec:
4444
type: git
4545
params:
@@ -250,10 +250,10 @@ spec:
250250
resources:
251251
- name: source-repo
252252
resourceRef:
253-
name: skaffold-git
253+
name: skaffold-git-pipelinerun
254254
- name: web-image
255255
resourceRef:
256-
name: skaffold-image-leeroy-web
256+
name: skaffold-image-leeroy-web-pipelinerun
257257
- name: app-image
258258
resourceRef:
259259
name: skaffold-image-leeroy-app

examples/taskruns/build-push-kaniko.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: tekton.dev/v1alpha1
22
kind: PipelineResource
33
metadata:
4-
name: skaffold-image-leeroy-web
4+
name: skaffold-image-leeroy-web-build-push-kaniko
55
spec:
66
type: image
77
params:
@@ -11,7 +11,7 @@ spec:
1111
apiVersion: tekton.dev/v1alpha1
1212
kind: PipelineResource
1313
metadata:
14-
name: skaffold-git
14+
name: skaffold-git-build-push-kaniko
1515
spec:
1616
type: git
1717
params:
@@ -54,7 +54,7 @@ spec:
5454
- --dockerfile=$(inputs.params.pathToDockerFile)
5555
- --destination=$(outputs.resources.builtImage.url)
5656
- --context=$(inputs.params.pathToContext)
57-
- --oci-layout-path=/builder/home/image-outputs/builtImage
57+
- --oci-layout-path=/builder/home/image-outputs/builtImage
5858
sidecars:
5959
- image: registry
6060
name: registry
@@ -70,7 +70,7 @@ spec:
7070
resources:
7171
- name: workspace
7272
resourceRef:
73-
name: skaffold-git
73+
name: skaffold-git-build-push-kaniko
7474
params:
7575
- name: pathToDockerFile
7676
value: Dockerfile
@@ -80,4 +80,4 @@ spec:
8080
resources:
8181
- name: builtImage
8282
resourceRef:
83-
name: skaffold-image-leeroy-web
83+
name: skaffold-image-leeroy-web-build-push-kaniko

examples/taskruns/configmap.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v1
22
kind: ConfigMap
33
metadata:
4-
name: config-for-testing
4+
name: config-for-testing-configmaps
55
data:
66
test.data: tasks are my jam
77
---
@@ -22,12 +22,12 @@ spec:
2222
- name: TEST_DATA
2323
valueFrom:
2424
configMapKeyRef:
25-
name: config-for-testing
25+
name: config-for-testing-configmaps
2626
key: test.data
2727
volumeMounts:
2828
- name: config-volume
2929
mountPath: /config
3030
volumes:
3131
- name: config-volume
3232
configMap:
33-
name: config-for-testing
33+
name: config-for-testing-configmaps

examples/taskruns/no-ci/.keep

Whitespace-only changes.

examples/taskruns/secret-env.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
kind: Secret
22
apiVersion: v1
33
metadata:
4-
name: secret-password
4+
name: secret-env-password
55
stringData:
66
ninja: SECRET_PASSWORD
77
---
@@ -22,5 +22,5 @@ spec:
2222
- name: SECRET_PASSWORD
2323
valueFrom:
2424
secretKeyRef:
25-
name: secret-password
25+
name: secret-env-password
2626
key: ninja

examples/taskruns/secret-volume-params.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
kind: Secret
22
apiVersion: v1
33
metadata:
4-
name: secret-password
4+
name: secret-vol-param-password
55
stringData:
66
ninja: SECRET_PASSWORD
77
---
@@ -15,6 +15,7 @@ spec:
1515
params:
1616
- name: SCNAME
1717
description: Name of secret
18+
type: string
1819
steps:
1920
- image: ubuntu
2021
command:
@@ -33,4 +34,4 @@ spec:
3334
inputs:
3435
params:
3536
- name: SCNAME
36-
value: secret-password
37+
value: secret-vol-param-password

examples/taskruns/secret-volume.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
kind: Secret
22
apiVersion: v1
33
metadata:
4-
name: secret-password
4+
name: secret-vol-password
55
stringData:
66
ninja: SECRET_PASSWORD
77
---
@@ -25,4 +25,4 @@ spec:
2525
volumes:
2626
- name: secret-volume
2727
secret:
28-
secretName: secret-password
28+
secretName: secret-vol-password

examples/taskruns/steptemplate-env-merge.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@ spec:
1919
params:
2020
- name: FOO
2121
description: FOO variable
22+
type: string
2223
- name: BAR
2324
description: BAR variable
25+
type: string
2426
- name: FOOBAR
2527
description: FOOBAR variable
2628
default: foobar
29+
type: string
2730
steps:
2831
# Test the environment variables are set in the task
2932
- name: foo

0 commit comments

Comments
 (0)