Pull buildah and kn tasks directly from catalog

This commit is contained in:
Martin Gencur 2019-12-02 12:20:02 +01:00
parent 61dc2b6627
commit 0976ec0e5a
5 changed files with 6 additions and 102 deletions

View File

@ -50,10 +50,10 @@ func TestTektonPipeline(t *testing.T) {
_, err = kubectl.RunWithOpts([]string{"apply", "-n", test.env.Namespace, "-f", basedir + "/kn-deployer-rbac.yaml"}, runOpts{})
assert.NilError(t, err)
_, err = kubectl.RunWithOpts([]string{"apply", "-n", test.env.Namespace, "-f", basedir + "/buildah-task.yaml"}, runOpts{})
_, err = kubectl.RunWithOpts([]string{"apply", "-n", test.env.Namespace, "-f", "https://raw.githubusercontent.com/tektoncd/catalog/master/buildah/buildah.yaml"}, runOpts{})
assert.NilError(t, err)
_, err = kubectl.RunWithOpts([]string{"apply", "-n", test.env.Namespace, "-f", basedir + "/kn-task.yaml"}, runOpts{})
_, err = kubectl.RunWithOpts([]string{"apply", "-n", test.env.Namespace, "-f", "https://raw.githubusercontent.com/tektoncd/catalog/master/kn/kn.yaml"}, runOpts{})
assert.NilError(t, err)
_, err = kubectl.RunWithOpts([]string{"apply", "-n", test.env.Namespace, "-f", basedir + "/kn-pipeline.yaml"}, runOpts{})

View File

@ -1,63 +0,0 @@
# Copyright 2019 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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: Task
metadata:
name: buildah
spec:
inputs:
params:
- name: BUILDER_IMAGE
description: The location of the buildah builder image.
default: quay.io/buildah/stable:v1.11.0
- name: DOCKERFILE
description: Path to the Dockerfile to build.
default: ./Dockerfile
- name: TLSVERIFY
description: Verify the TLS on the registry endpoint (for push/pull to a non-TLS registry)
default: "true"
resources:
- name: source
type: git
outputs:
resources:
- name: image
type: image
steps:
- name: build
image: $(inputs.params.BUILDER_IMAGE)
workingDir: /workspace/source/test/test_images/helloworld
command: ['buildah', 'bud', '--tls-verify=$(inputs.params.TLSVERIFY)', '--layers', '-f', '$(inputs.params.DOCKERFILE)', '-t', '$(outputs.resources.image.url)', '.']
volumeMounts:
- name: varlibcontainers
mountPath: /var/lib/containers
securityContext:
privileged: true
- name: push
image: $(inputs.params.BUILDER_IMAGE)
workingDir: /workspace/source/test/test_images/helloworld
command: ['buildah', 'push', '--tls-verify=$(inputs.params.TLSVERIFY)', '$(outputs.resources.image.url)', 'docker://$(outputs.resources.image.url)']
volumeMounts:
- name: varlibcontainers
mountPath: /var/lib/containers
securityContext:
privileged: true
volumes:
- name: varlibcontainers
emptyDir: {}

View File

@ -38,6 +38,9 @@ spec:
outputs:
- name: image
resource: image
params:
- name: DOCKERFILE
value: ./test/test_images/helloworld/Dockerfile
- name: kn-service-create
taskRef:
name: kn

View File

@ -1,36 +0,0 @@
# Copyright 2019 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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: Task
metadata:
name: kn
spec:
inputs:
params:
- name: kn-image
description: kn CLI container image to run this task
default: gcr.io/knative-nightly/knative.dev/client/cmd/kn
- name: ARGS
type: array
description: kn CLI arguments to run
default:
- "help"
resources:
- name: image
type: image
steps:
- name: kn
image: "$(inputs.params.kn-image)"
command: ["/ko-app/kn"]
args: ["$(inputs.params.ARGS)"]

View File

@ -5,7 +5,7 @@ FROM golang:1.12 as builder
# Copy local code to the container image.
WORKDIR /go/src/knative.dev/client/test/test_images/helloworld
COPY . .
COPY ./test/test_images/helloworld/helloworld.go .
# Build the command inside the container.
# (You may fetch or manage dependencies here,