diff --git a/test/e2e/tekton_test.go b/test/e2e/tekton_test.go index 6567ed329..99dec1da2 100644 --- a/test/e2e/tekton_test.go +++ b/test/e2e/tekton_test.go @@ -55,18 +55,21 @@ func TestTektonPipeline(t *testing.T) { _, err = kubectl.Run("apply", "-f", basedir+"/kn-deployer-rbac.yaml") assert.NilError(t, err) - _, err = kubectl.Run("apply", "-f", "https://raw.githubusercontent.com/tektoncd/catalog/master/buildah/buildah.yaml") + _, err = kubectl.Run("apply", "-f", "https://raw.githubusercontent.com/tektoncd/catalog/v1beta1/git/git-clone.yaml") assert.NilError(t, err) - _, err = kubectl.Run("apply", "-f", "https://raw.githubusercontent.com/tektoncd/catalog/master/kn/kn.yaml") + _, err = kubectl.Run("apply", "-f", basedir+"/resources.yaml") + assert.NilError(t, err) + + _, err = kubectl.Run("apply", "-f", "https://raw.githubusercontent.com/tektoncd/catalog/v1beta1/buildah/buildah.yaml") + assert.NilError(t, err) + + _, err = kubectl.Run("apply", "-f", "https://raw.githubusercontent.com/tektoncd/catalog/v1beta1/kn/kn.yaml") assert.NilError(t, err) _, err = kubectl.Run("apply", "-f", basedir+"/kn-pipeline.yaml") assert.NilError(t, err) - _, err = kubectl.Run("apply", "-f", basedir+"/kn-pipeline-resource.yaml") - assert.NilError(t, err) - _, err = kubectl.Run("create", "-f", basedir+"/kn-pipeline-run.yaml") assert.NilError(t, err) diff --git a/test/resources/tekton/kn-pipeline-run.yaml b/test/resources/tekton/kn-pipeline-run-template.yaml similarity index 79% rename from test/resources/tekton/kn-pipeline-run.yaml rename to test/resources/tekton/kn-pipeline-run-template.yaml index f8f2757fb..02bc8eb80 100644 --- a/test/resources/tekton/kn-pipeline-run.yaml +++ b/test/resources/tekton/kn-pipeline-run-template.yaml @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -apiVersion: tekton.dev/v1alpha1 +apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: generateName: buildah-build-kn-create- @@ -19,16 +19,15 @@ spec: serviceAccountName: kn-deployer-account pipelineRef: name: buildah-build-kn-create - resources: - - name: source - resourceRef: - name: buildah-build-kn-create-source - - name: image - resourceRef: - name: buildah-build-kn-create-image + workspaces: + - name: shared-workspace + persistentvolumeclaim: + claimName: buildah-source-pvc params: - name: IMAGE_FORMAT value: "docker" + - name: IMAGE + value: "${CONTAINER_REGISTRY}/helloworld:tkn" - name: ARGS value: - "service" @@ -36,5 +35,5 @@ spec: - "hello" - "--force" - "--service-account=kn-deployer-account" - - "--image=$(inputs.resources.image.url)" + - "--image=${CONTAINER_REGISTRY}/helloworld:tkn" - "--env=TARGET=Tekton" diff --git a/test/resources/tekton/kn-pipeline.yaml b/test/resources/tekton/kn-pipeline.yaml index 0f4bbb51b..7f12ecfb3 100644 --- a/test/resources/tekton/kn-pipeline.yaml +++ b/test/resources/tekton/kn-pipeline.yaml @@ -11,16 +11,11 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -apiVersion: tekton.dev/v1alpha1 +apiVersion: tekton.dev/v1beta1 kind: Pipeline metadata: name: buildah-build-kn-create spec: - resources: - - name: source - type: git - - name: image - type: image params: - name: ARGS type: array @@ -30,18 +25,32 @@ spec: - name: IMAGE_FORMAT type: string description: Image format to build and push to registry + - name: IMAGE + type: string + description: Reference of the image the Pipeline will produce + workspaces: + - name: shared-workspace tasks: + - name: fetch-kn-from-git + taskRef: + name: git-clone + workspaces: + - name: output + workspace: shared-workspace + params: + - name: url + value: "https://github.com/knative/client" - name: buildah-build taskRef: name: buildah - resources: - inputs: - - name: source - resource: source - outputs: - - name: image - resource: image + runAfter: + - fetch-kn-from-git + workspaces: + - name: source + workspace: shared-workspace params: + - name: IMAGE + value: "$(params.IMAGE)" - name: DOCKERFILE value: ./test/test_images/helloworld/Dockerfile - name: BUILDER_IMAGE @@ -52,13 +61,7 @@ spec: taskRef: name: kn runAfter: - - buildah-build - resources: - inputs: - - name: image - resource: image - from: - - buildah-build + - buildah-build params: - name: kn-image value: "gcr.io/knative-nightly/knative.dev/client/cmd/kn" diff --git a/test/resources/tekton/kn-pipeline-resource-template.yaml b/test/resources/tekton/resources.yaml similarity index 57% rename from test/resources/tekton/kn-pipeline-resource-template.yaml rename to test/resources/tekton/resources.yaml index 829ecacd2..15fc5522e 100644 --- a/test/resources/tekton/kn-pipeline-resource-template.yaml +++ b/test/resources/tekton/resources.yaml @@ -1,4 +1,4 @@ -# Copyright 2019 The Knative Authors +# Copyright 2020 The Knative Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,22 +11,14 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -apiVersion: tekton.dev/v1alpha1 -kind: PipelineResource -metadata: - name: buildah-build-kn-create-source -spec: - type: git - params: - - name: url - value: "https://github.com/knative/client" --- -apiVersion: tekton.dev/v1alpha1 -kind: PipelineResource +apiVersion: v1 +kind: PersistentVolumeClaim metadata: - name: buildah-build-kn-create-image + name: buildah-source-pvc spec: - type: image - params: - - name: url - value: "${CONTAINER_REGISTRY}/helloworld:tkn" \ No newline at end of file + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 500Mi diff --git a/test/tekton-tests.sh b/test/tekton-tests.sh index 4b0a3c331..e0418a83e 100755 --- a/test/tekton-tests.sh +++ b/test/tekton-tests.sh @@ -50,7 +50,7 @@ fi # Feed $KN_E2E_NAMESPACE and $CONTAINER_REGISTRY into yaml files resource_dir=$(dirname $0)/resources/tekton -for file in kn-deployer-rbac kn-pipeline-resource; do +for file in kn-deployer-rbac kn-pipeline-run; do sed -e "s#\${KN_E2E_NAMESPACE}#${KN_E2E_NAMESPACE}#" \ -e "s#\${CONTAINER_REGISTRY}#${CONTAINER_REGISTRY}#" ${resource_dir}/${file}-template.yaml > ${resource_dir}/${file}.yaml done