From d308e5c5eb78101977a75cade1c0cd2f4cec55c3 Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Wed, 11 Mar 2020 10:31:19 +0100 Subject: [PATCH] =?UTF-8?q?kn:=20use=20workspace=20instead=20of=20GitResou?= =?UTF-8?q?rce=20=F0=9F=90=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This migrate kn to use `workspace` instead of an input `GitResource`. Signed-off-by: Vincent Demeester --- .../build_deploy/README.md | 47 +++++++++++-------- .../build_deploy/build_deploy_pipeline.yaml | 28 +++++++++-- .../build_deploy/pipeline_run.yaml | 5 +- .../build_deploy/resources.yaml | 9 ---- 4 files changed, 52 insertions(+), 37 deletions(-) diff --git a/kn/knative-dockerfile-deploy/build_deploy/README.md b/kn/knative-dockerfile-deploy/build_deploy/README.md index fbaa8ec3..e872738b 100644 --- a/kn/knative-dockerfile-deploy/build_deploy/README.md +++ b/kn/knative-dockerfile-deploy/build_deploy/README.md @@ -12,14 +12,14 @@ The following Pipeline definition refers: `kubectl create -f build_deploy_pipeline.yaml` ```yaml -apiVersion: tekton.dev/v1alpha1 +apiVersion: tekton.dev/v1beta1 kind: Pipeline metadata: name: buildah-build-kn-create spec: - resources: + workspaces: - name: source - type: git + resources: - name: image type: image params: @@ -28,14 +28,32 @@ spec: description: Arguments to pass to kn CLI default: - "help" + - name: GIT_URL + type: string + description: Git url to clone tasks: + - name: fetch-repository + taskRef: + name: git-clone + workspaces: + - name: output + workspace: source + params: + - name: url + value: $(params.GIT_URL) + - name: subdirectory + value: "" + - name: deleteExisting + value: "true" - name: buildah-build taskRef: name: buildah + runAfter: + - fetch-repository + workspaces: + - name: source + workspace: source resources: - inputs: - - name: source - resource: source outputs: - name: image resource: image @@ -77,16 +95,6 @@ Create the resource as `kubectl create -f resources.yaml`. ```yaml apiVersion: tekton.dev/v1alpha1 kind: PipelineResource -metadata: - name: buildah-build-kn-create-source -spec: - type: git - params: - - name: url - value: "https://github.com/navidshaikh/helloworld-go" ---- -apiVersion: tekton.dev/v1alpha1 -kind: PipelineResource metadata: name: buildah-build-kn-create-image spec: @@ -108,7 +116,7 @@ Save the following YAML in a file e.g.: `pipeline_run.yaml` and create PipelineR `kubectl create -f pipeline_run.yaml`. ```yaml -apiVersion: tekton.dev/v1alpha1 +apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: generateName: buildah-build-kn-create- @@ -117,13 +125,12 @@ spec: 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 params: + - name: GIT_URL + value: "https://github.com/navidshaikh/helloworld-go" - name: ARGS value: - "service" diff --git a/kn/knative-dockerfile-deploy/build_deploy/build_deploy_pipeline.yaml b/kn/knative-dockerfile-deploy/build_deploy/build_deploy_pipeline.yaml index 9da6fdf0..13e1eac9 100644 --- a/kn/knative-dockerfile-deploy/build_deploy/build_deploy_pipeline.yaml +++ b/kn/knative-dockerfile-deploy/build_deploy/build_deploy_pipeline.yaml @@ -3,9 +3,9 @@ kind: Pipeline metadata: name: buildah-build-kn-create spec: - resources: + workspaces: - name: source - type: git + resources: - name: image type: image params: @@ -14,14 +14,32 @@ spec: description: Arguments to pass to kn CLI default: - "help" + - name: GIT_URL + type: string + description: Git url to clone tasks: + - name: fetch-repository + taskRef: + name: git-clone + workspaces: + - name: output + workspace: source + params: + - name: url + value: $(params.GIT_URL) + - name: subdirectory + value: "" + - name: deleteExisting + value: "true" - name: buildah-build taskRef: name: buildah + runAfter: + - fetch-repository + workspaces: + - name: source + workspace: source resources: - inputs: - - name: source - resource: source outputs: - name: image resource: image diff --git a/kn/knative-dockerfile-deploy/build_deploy/pipeline_run.yaml b/kn/knative-dockerfile-deploy/build_deploy/pipeline_run.yaml index d1a1bf27..b12d623d 100644 --- a/kn/knative-dockerfile-deploy/build_deploy/pipeline_run.yaml +++ b/kn/knative-dockerfile-deploy/build_deploy/pipeline_run.yaml @@ -7,13 +7,12 @@ spec: 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 params: + - name: GIT_URL + value: "https://github.com/navidshaikh/helloworld-go" - name: ARGS value: - "service" diff --git a/kn/knative-dockerfile-deploy/build_deploy/resources.yaml b/kn/knative-dockerfile-deploy/build_deploy/resources.yaml index 2b0f2dfa..26cb4338 100644 --- a/kn/knative-dockerfile-deploy/build_deploy/resources.yaml +++ b/kn/knative-dockerfile-deploy/build_deploy/resources.yaml @@ -1,12 +1,3 @@ -apiVersion: tekton.dev/v1alpha1 -kind: PipelineResource -metadata: - name: buildah-build-kn-create-source -spec: - type: git - params: - - name: url - value: "https://github.com/navidshaikh/helloworld-go" --- apiVersion: tekton.dev/v1alpha1 kind: PipelineResource