Skip to content

Commit

Permalink
Use kubectl create instead of apply
Browse files Browse the repository at this point in the history
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 secrets
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.

Fixes #1397
  • Loading branch information
afrittoli committed Oct 9, 2019
1 parent ef8a6b2 commit c2d536c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions examples/taskruns/secret-env.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
kind: Secret
apiVersion: v1
metadata:
name: secret-password
name: secret-env-password
stringData:
ninja: SECRET_PASSWORD
---
Expand All @@ -22,5 +22,5 @@ spec:
- name: SECRET_PASSWORD
valueFrom:
secretKeyRef:
name: secret-password
name: secret-env-password
key: ninja
4 changes: 2 additions & 2 deletions examples/taskruns/secret-volume-params.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
kind: Secret
apiVersion: v1
metadata:
name: secret-password
name: secret-vol-param-password
stringData:
ninja: SECRET_PASSWORD
---
Expand Down Expand Up @@ -33,4 +33,4 @@ spec:
inputs:
params:
- name: SCNAME
value: secret-password
value: secret-vol-param-password
4 changes: 2 additions & 2 deletions examples/taskruns/secret-volume.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
kind: Secret
apiVersion: v1
metadata:
name: secret-password
name: secret-vol-password
stringData:
ninja: SECRET_PASSWORD
---
Expand All @@ -25,4 +25,4 @@ spec:
volumes:
- name: secret-volume
secret:
secretName: secret-password
secretName: secret-vol-password
2 changes: 1 addition & 1 deletion test/e2e-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function create_resources() {

# Applying the resources, either *taskruns or * *pipelineruns
for file in $(find ${REPO_ROOT_DIR}/examples/${resource}s/ -name *.yaml | sort); do
perl -p -e 's/gcr.io\/christiewilson-catfactory/$ENV{KO_DOCKER_REPO}/g' ${file} | ko apply -f - || return 1
perl -p -e 's/gcr.io\/christiewilson-catfactory/$ENV{KO_DOCKER_REPO}/g' ${file} | ko create -f - || return 1
done
}

Expand Down

0 comments on commit c2d536c

Please sign in to comment.