Skip to content

Commit

Permalink
Fix TestYamls for change in ko create
Browse files Browse the repository at this point in the history
With ko-build/ko#750, which we picked up when we bumped `ko` to `v0.12.0` in the test-runner image, `-n (namespace)` is no longer an argument for `ko create`. So we need to ensure that the namespace for the `TestYamls` CRDs is actually set properly, and get rid of the `-n (namespace)` from our invocation of `ko create`.

Signed-off-by: Andrew Bayer <andrew.bayer@gmail.com>
  • Loading branch information
abayer committed Aug 30, 2022
1 parent 9d9aa9d commit 29bafa6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 2 additions & 3 deletions test/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ func substituteEnv(input []byte, namespace string) ([]byte, error) {
}
output := defaultKoDockerRepoRE.ReplaceAll(input, []byte(val))

// Strip any "namespace: default"s, all resources will be created in
// the test namespace using `ko create -n`
// Replace any "namespace: default"s with the test namespace.
output = defaultNamespaceRE.ReplaceAll(output, []byte("namespace: "+namespace))

// Replace image names to arch specific ones, where it's necessary
Expand All @@ -91,7 +90,7 @@ func substituteEnv(input []byte, namespace string) ([]byte, error) {
// koCreate wraps the ko binary and invokes `ko create` for input within
// namespace
func koCreate(input []byte, namespace string) ([]byte, error) {
cmd := exec.Command("ko", "create", "--platform", "linux/"+getTestArch(), "-n", namespace, "-f", "-")
cmd := exec.Command("ko", "create", "--platform", "linux/"+getTestArch(), "-f", "-")
cmd.Stdin = bytes.NewReader(input)
return cmd.CombinedOutput()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: git-clone-from-catalog
namespace: default
spec:
workspaces:
- name: output
Expand Down Expand Up @@ -111,6 +112,7 @@ apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: cleanup-workspace
namespace: default
spec:
workspaces:
# Shared workspace where git repo is cloned
Expand Down Expand Up @@ -141,6 +143,7 @@ apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: clone-cleanup-workspace
namespace: default
spec:
workspaces:
# common workspace where git repo is cloned and needs to be cleanup after done
Expand Down Expand Up @@ -185,6 +188,7 @@ apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: write-and-cleanup-workspace
namespace: default
spec:
pipelineRef:
name: clone-cleanup-workspace
Expand Down
6 changes: 6 additions & 0 deletions test/yamls/v1beta1/pipelineruns/pipelinerun.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: unit-tests
namespace: default
spec:
workspaces:
- name: source
Expand All @@ -43,6 +44,7 @@ apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: git-clone
namespace: default
spec:
workspaces:
- name: output
Expand Down Expand Up @@ -126,6 +128,7 @@ apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: kaniko
namespace: default
spec:
workspaces:
- name: source
Expand Down Expand Up @@ -195,6 +198,7 @@ apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: demo-deploy-kubectl
namespace: default
spec:
params:
- name: path
Expand Down Expand Up @@ -232,6 +236,7 @@ apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: demo-pipeline
namespace: default
spec:
params:
- name: image-registry
Expand Down Expand Up @@ -320,6 +325,7 @@ apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: demo-pipeline-run-1
namespace: default
spec:
pipelineRef:
name: demo-pipeline
Expand Down

0 comments on commit 29bafa6

Please sign in to comment.