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")
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)

View File

@ -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"

View File

@ -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"

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");
# 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"
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 500Mi

View File

@ -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