1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-12-17 08:26:33 +00:00

Port buildpacks to v1beta1 🦇

Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
This commit is contained in:
Vincent Demeester 2020-03-04 17:09:29 +01:00 committed by tekton-robot
parent 62be238965
commit 708c078c5e
3 changed files with 66 additions and 70 deletions

View File

@ -55,7 +55,7 @@ kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/build
This `TaskRun` will use the `buildpacks-v3` task to fetch source code from a Git repo, build the source code, then publish a container image.
```
apiVersion: tekton.dev/v1alpha1
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
name: example-run
@ -68,24 +68,23 @@ spec:
# - name: my-cache
# persistentVolumeClaim:
# claimName: task-pv-claim
inputs:
resources:
params:
- name: SOURCE_SUBPATH
value: <optional subpath within your source repo, e.g. "apps/java-maven">
- name: BUILDER_IMAGE
value: <your builder image tag, see below for suggestions, e.g. "builder-repo/builder-image:builder-tag">
# Uncomment the lines below to use an existing cache
# - name: CACHE
# value: my-cache
resources:
inputs:
- name: source
resourceSpec:
type: git
params:
- name: url
value: <your git repo, e.g. "https://github.com/buildpacks/samples">
params:
- name: SOURCE_SUBPATH
value: <optional subpath within your source repo, e.g. "apps/java-maven">
- name: BUILDER_IMAGE
value: <your builder image tag, see below for suggestions, e.g. "builder-repo/builder-image:builder-tag">
# Uncomment the lines below to use an existing cache
# - name: CACHE
# value: my-cache
outputs:
resources:
outputs:
- name: image
resourceSpec:
type: image

View File

@ -1,35 +1,33 @@
---
apiVersion: tekton.dev/v1alpha1
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: buildpacks-v3
spec:
inputs:
params:
- name: BUILDER_IMAGE
description: The image on which builds will run (must include v3 lifecycle and compatible buildpacks).
- name: USE_CRED_HELPERS
description: Use Docker credential helpers for Google's GCR, Amazon's ECR, or Microsoft's ACR.
default: "false"
- name: CACHE
description: The name of the persistent app cache volume
default: empty-dir
- name: USER_ID
description: The user ID of the builder image user
default: "1000"
- name: GROUP_ID
description: The group ID of the builder image user
default: "1000"
- name: SOURCE_SUBPATH
description: A subpath within the `source` input where the source to build is located.
default: ""
params:
- name: BUILDER_IMAGE
description: The image on which builds will run (must include v3 lifecycle and compatible buildpacks).
- name: USE_CRED_HELPERS
description: Use Docker credential helpers for Google's GCR, Amazon's ECR, or Microsoft's ACR.
default: "false"
- name: CACHE
description: The name of the persistent app cache volume
default: empty-dir
- name: USER_ID
description: The user ID of the builder image user
default: "1000"
- name: GROUP_ID
description: The group ID of the builder image user
default: "1000"
- name: SOURCE_SUBPATH
description: A subpath within the `source` input where the source to build is located.
default: ""
resources:
resources:
inputs:
- name: source
type: git
outputs:
resources:
outputs:
- name: image
type: image
@ -46,24 +44,24 @@ spec:
args:
- "-c"
- >
chown -R "$(inputs.params.USER_ID):$(inputs.params.GROUP_ID)" "/tekton/home" &&
chown -R "$(inputs.params.USER_ID):$(inputs.params.GROUP_ID)" "/layers" &&
chown -R "$(inputs.params.USER_ID):$(inputs.params.GROUP_ID)" "/cache" &&
chown -R "$(inputs.params.USER_ID):$(inputs.params.GROUP_ID)" "/workspace/source"
chown -R "$(params.USER_ID):$(params.GROUP_ID)" "/tekton/home" &&
chown -R "$(params.USER_ID):$(params.GROUP_ID)" "/layers" &&
chown -R "$(params.USER_ID):$(params.GROUP_ID)" "/cache" &&
chown -R "$(params.USER_ID):$(params.GROUP_ID)" "/workspace/source"
volumeMounts:
- name: layers-dir
mountPath: /layers
- name: $(inputs.params.CACHE)
- name: $(params.CACHE)
mountPath: /cache
securityContext:
privileged: true
- name: detect
image: $(inputs.params.BUILDER_IMAGE)
image: $(params.BUILDER_IMAGE)
imagePullPolicy: Always
command: ["/cnb/lifecycle/detector"]
args:
- "-app=/workspace/source/$(inputs.params.SOURCE_SUBPATH)"
- "-app=/workspace/source/$(params.SOURCE_SUBPATH)"
- "-group=/layers/group.toml"
- "-plan=/layers/plan.toml"
volumeMounts:
@ -71,23 +69,23 @@ spec:
mountPath: /layers
- name: analyze
image: $(inputs.params.BUILDER_IMAGE)
image: $(params.BUILDER_IMAGE)
imagePullPolicy: Always
command: ["/cnb/lifecycle/analyzer"]
args:
- "-layers=/layers"
- "-helpers=$(inputs.params.USE_CRED_HELPERS)"
- "-helpers=$(params.USE_CRED_HELPERS)"
- "-group=/layers/group.toml"
- "-cache-dir=/cache"
- "$(outputs.resources.image.url)"
- "$(resources.outputs.image.url)"
volumeMounts:
- name: $(inputs.params.CACHE)
- name: $(params.CACHE)
mountPath: /cache
- name: layers-dir
mountPath: /layers
- name: restore
image: $(inputs.params.BUILDER_IMAGE)
image: $(params.BUILDER_IMAGE)
imagePullPolicy: Always
command: ["/cnb/lifecycle/restorer"]
args:
@ -95,17 +93,17 @@ spec:
- "-layers=/layers"
- "-cache-dir=/cache"
volumeMounts:
- name: $(inputs.params.CACHE)
- name: $(params.CACHE)
mountPath: /cache
- name: layers-dir
mountPath: /layers
- name: build
image: $(inputs.params.BUILDER_IMAGE)
image: $(params.BUILDER_IMAGE)
imagePullPolicy: Always
command: ["/cnb/lifecycle/builder"]
args:
- "-app=/workspace/source/$(inputs.params.SOURCE_SUBPATH)"
- "-app=/workspace/source/$(params.SOURCE_SUBPATH)"
- "-layers=/layers"
- "-group=/layers/group.toml"
- "-plan=/layers/plan.toml"
@ -114,20 +112,20 @@ spec:
mountPath: /layers
- name: export
image: $(inputs.params.BUILDER_IMAGE)
image: $(params.BUILDER_IMAGE)
imagePullPolicy: Always
command: ["/cnb/lifecycle/exporter"]
args:
- "-app=/workspace/source/$(inputs.params.SOURCE_SUBPATH)"
- "-app=/workspace/source/$(params.SOURCE_SUBPATH)"
- "-layers=/layers"
- "-helpers=$(inputs.params.USE_CRED_HELPERS)"
- "-helpers=$(params.USE_CRED_HELPERS)"
- "-group=/layers/group.toml"
- "-cache-dir=/cache"
- "$(outputs.resources.image.url)"
- "$(resources.outputs.image.url)"
volumeMounts:
- name: layers-dir
mountPath: /layers
- name: $(inputs.params.CACHE)
- name: $(params.CACHE)
mountPath: /cache
volumes:

View File

@ -1,5 +1,5 @@
---
apiVersion: tekton.dev/v1alpha1
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
name: buildpacks-run
@ -11,20 +11,19 @@ spec:
- name: buildpacks-cache
persistentVolumeClaim:
claimName: buildpacks-cache-pvc
inputs:
resources:
params:
- name: SOURCE_SUBPATH
value: apps/java-maven
- name: BUILDER_IMAGE
value: cnbs/sample-builder:alpine-p0.2
- name: CACHE
value: buildpacks-cache
resources:
inputs:
- name: source
resourceRef:
name: buildpacks-samples
params:
- name: SOURCE_SUBPATH
value: apps/java-maven
- name: BUILDER_IMAGE
value: cnbs/sample-builder:alpine-p0.2
- name: CACHE
value: buildpacks-cache
outputs:
resources:
outputs:
- name: image
resourceRef:
name: buildpacks-app-image
name: buildpacks-app-image