1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-12-02 06:52:15 +00:00

kn: use workspace instead of GitResource 🐐

This migrate kn to use `workspace` instead of an input
`GitResource`.

Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
This commit is contained in:
Vincent Demeester 2020-03-11 10:31:19 +01:00 committed by tekton-robot
parent e3a8044d49
commit d308e5c5eb
4 changed files with 52 additions and 37 deletions

View File

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

View File

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

View File

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

View File

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