1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-23 06:08:46 +00:00
catalog/buildpacks/buildpacks-v3.yaml
Natalie Arellano 9beb1daa4c Add support in buildpacks task for platform envs
This change makes it possible for users to provide
environment variables to buildpacks via a volume with
appropriately configured directories.

Also includes some fixes for v1beta1 compatibility.

See https://buildpacks.io/docs/reference/buildpack-api/
for more info on how PLATFORM_DIR is used.

Resolves #160

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-06-08 10:14:53 +01:00

142 lines
3.9 KiB
YAML

---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: buildpacks-v3
spec:
params:
- name: BUILDER_IMAGE
description: The image on which builds will run (must include v3 lifecycle and compatible buildpacks).
- name: CACHE
description: The name of the persistent app cache volume.
default: empty-dir
- name: PLATFORM_DIR
description: The name of the platform directory.
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: PROCESS_TYPE
description: The default process type to set on the image.
default: "web"
- name: SOURCE_SUBPATH
description: A subpath within the `source` input where the source to build is located.
default: ""
resources:
outputs:
- name: image
type: image
workspaces:
- name: source
stepTemplate:
env:
- name: CNB_PLATFORM_API
value: "0.3"
steps:
- name: prepare
image: alpine
imagePullPolicy: Always
command: ["/bin/sh"]
args:
- "-c"
- >
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)" "$(workspaces.source.path)"
volumeMounts:
- name: layers-dir
mountPath: /layers
- name: $(params.CACHE)
mountPath: /cache
securityContext:
privileged: true
- name: detect
image: $(params.BUILDER_IMAGE)
imagePullPolicy: Always
command: ["/cnb/lifecycle/detector"]
args:
- "-app=$(workspaces.source.path)/$(params.SOURCE_SUBPATH)"
- "-group=/layers/group.toml"
- "-plan=/layers/plan.toml"
volumeMounts:
- name: layers-dir
mountPath: /layers
- name: $(params.PLATFORM_DIR)
mountPath: /platform
- name: analyze
image: $(params.BUILDER_IMAGE)
imagePullPolicy: Always
command: ["/cnb/lifecycle/analyzer"]
args:
- "-layers=/layers"
- "-group=/layers/group.toml"
- "-cache-dir=/cache"
- "$(resources.outputs.image.url)"
volumeMounts:
- name: $(params.CACHE)
mountPath: /cache
- name: layers-dir
mountPath: /layers
- name: restore
image: $(params.BUILDER_IMAGE)
imagePullPolicy: Always
command: ["/cnb/lifecycle/restorer"]
args:
- "-group=/layers/group.toml"
- "-layers=/layers"
- "-cache-dir=/cache"
volumeMounts:
- name: $(params.CACHE)
mountPath: /cache
- name: layers-dir
mountPath: /layers
- name: build
image: $(params.BUILDER_IMAGE)
imagePullPolicy: Always
command: ["/cnb/lifecycle/builder"]
args:
- "-app=$(workspaces.source.path)/$(params.SOURCE_SUBPATH)"
- "-layers=/layers"
- "-group=/layers/group.toml"
- "-plan=/layers/plan.toml"
volumeMounts:
- name: layers-dir
mountPath: /layers
- name: $(params.PLATFORM_DIR)
mountPath: /platform
- name: export
image: $(params.BUILDER_IMAGE)
imagePullPolicy: Always
command: ["/cnb/lifecycle/exporter"]
args:
- "-app=$(workspaces.source.path)/$(params.SOURCE_SUBPATH)"
- "-layers=/layers"
- "-group=/layers/group.toml"
- "-cache-dir=/cache"
- "-process-type=$(params.PROCESS_TYPE)"
- "$(resources.outputs.image.url)"
volumeMounts:
- name: layers-dir
mountPath: /layers
- name: $(params.CACHE)
mountPath: /cache
volumes:
- name: empty-dir
emptyDir: {}
- name: layers-dir
emptyDir: {}