Update Tekton resources to v1beta1 (#861)

* Update to Tekton v1beta1

* replace PipelineResource with Task

* Pull kn task from github
This commit is contained in:
Martin Gencur 2020-05-27 15:31:59 +02:00 committed by GitHub
parent 93c58d294d
commit c6537a8e84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 49 additions and 52 deletions

View File

@ -55,18 +55,21 @@ func TestTektonPipeline(t *testing.T) {
_, err = kubectl.Run("apply", "-f", basedir+"/kn-deployer-rbac.yaml") _, err = kubectl.Run("apply", "-f", basedir+"/kn-deployer-rbac.yaml")
assert.NilError(t, err) 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) 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) assert.NilError(t, err)
_, err = kubectl.Run("apply", "-f", basedir+"/kn-pipeline.yaml") _, err = kubectl.Run("apply", "-f", basedir+"/kn-pipeline.yaml")
assert.NilError(t, err) 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") _, err = kubectl.Run("create", "-f", basedir+"/kn-pipeline-run.yaml")
assert.NilError(t, err) assert.NilError(t, err)

View File

@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
apiVersion: tekton.dev/v1alpha1 apiVersion: tekton.dev/v1beta1
kind: PipelineRun kind: PipelineRun
metadata: metadata:
generateName: buildah-build-kn-create- generateName: buildah-build-kn-create-
@ -19,16 +19,15 @@ spec:
serviceAccountName: kn-deployer-account serviceAccountName: kn-deployer-account
pipelineRef: pipelineRef:
name: buildah-build-kn-create name: buildah-build-kn-create
resources: workspaces:
- name: source - name: shared-workspace
resourceRef: persistentvolumeclaim:
name: buildah-build-kn-create-source claimName: buildah-source-pvc
- name: image
resourceRef:
name: buildah-build-kn-create-image
params: params:
- name: IMAGE_FORMAT - name: IMAGE_FORMAT
value: "docker" value: "docker"
- name: IMAGE
value: "${CONTAINER_REGISTRY}/helloworld:tkn"
- name: ARGS - name: ARGS
value: value:
- "service" - "service"
@ -36,5 +35,5 @@ spec:
- "hello" - "hello"
- "--force" - "--force"
- "--service-account=kn-deployer-account" - "--service-account=kn-deployer-account"
- "--image=$(inputs.resources.image.url)" - "--image=${CONTAINER_REGISTRY}/helloworld:tkn"
- "--env=TARGET=Tekton" - "--env=TARGET=Tekton"

View File

@ -11,16 +11,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
apiVersion: tekton.dev/v1alpha1 apiVersion: tekton.dev/v1beta1
kind: Pipeline kind: Pipeline
metadata: metadata:
name: buildah-build-kn-create name: buildah-build-kn-create
spec: spec:
resources:
- name: source
type: git
- name: image
type: image
params: params:
- name: ARGS - name: ARGS
type: array type: array
@ -30,18 +25,32 @@ spec:
- name: IMAGE_FORMAT - name: IMAGE_FORMAT
type: string type: string
description: Image format to build and push to registry 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: 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 - name: buildah-build
taskRef: taskRef:
name: buildah name: buildah
resources: runAfter:
inputs: - fetch-kn-from-git
- name: source workspaces:
resource: source - name: source
outputs: workspace: shared-workspace
- name: image
resource: image
params: params:
- name: IMAGE
value: "$(params.IMAGE)"
- name: DOCKERFILE - name: DOCKERFILE
value: ./test/test_images/helloworld/Dockerfile value: ./test/test_images/helloworld/Dockerfile
- name: BUILDER_IMAGE - name: BUILDER_IMAGE
@ -52,13 +61,7 @@ spec:
taskRef: taskRef:
name: kn name: kn
runAfter: runAfter:
- buildah-build - buildah-build
resources:
inputs:
- name: image
resource: image
from:
- buildah-build
params: params:
- name: kn-image - name: kn-image
value: "gcr.io/knative-nightly/knative.dev/client/cmd/kn" value: "gcr.io/knative-nightly/knative.dev/client/cmd/kn"

View File

@ -1,4 +1,4 @@
# Copyright 2019 The Knative Authors # Copyright 2020 The Knative Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with 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. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # 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 apiVersion: v1
kind: PipelineResource kind: PersistentVolumeClaim
metadata: metadata:
name: buildah-build-kn-create-image name: buildah-source-pvc
spec: spec:
type: image accessModes:
params: - ReadWriteOnce
- name: url resources:
value: "${CONTAINER_REGISTRY}/helloworld:tkn" requests:
storage: 500Mi

View File

@ -50,7 +50,7 @@ fi
# Feed $KN_E2E_NAMESPACE and $CONTAINER_REGISTRY into yaml files # Feed $KN_E2E_NAMESPACE and $CONTAINER_REGISTRY into yaml files
resource_dir=$(dirname $0)/resources/tekton 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}#" \ sed -e "s#\${KN_E2E_NAMESPACE}#${KN_E2E_NAMESPACE}#" \
-e "s#\${CONTAINER_REGISTRY}#${CONTAINER_REGISTRY}#" ${resource_dir}/${file}-template.yaml > ${resource_dir}/${file}.yaml -e "s#\${CONTAINER_REGISTRY}#${CONTAINER_REGISTRY}#" ${resource_dir}/${file}-template.yaml > ${resource_dir}/${file}.yaml
done done