1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-12-02 06:52:15 +00:00
catalog/buildpacks
Natalie Arellano 1abf7ae5c8 Clarify usage of platform directory.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
2020-06-08 10:14:53 +01:00
..
tests Update buildpacks task platform API to 0.3 2020-06-08 10:14:53 +01:00
buildpacks-v3.yaml Add support in buildpacks task for platform envs 2020-06-08 10:14:53 +01:00
OWNERS Add OWNERS file to buildpacks task 2019-11-06 11:45:29 -06:00
README.md Clarify usage of platform directory. 2020-06-08 10:14:53 +01:00

Cloud Native Buildpacks

This build template builds source into a container image using Cloud Native Buildpacks.

The Cloud Native Buildpacks website describes v3 buildpacks as:

... pluggable, modular tools that translate source code into container-ready artifacts such as OCI images. They replace Dockerfiles in the app development lifecycle with a higher level of abstraction. ... Cloud Native Buildpacks embrace modern container standards, such as the OCI image format. They take advantage of the latest capabilities of these standards, such as remote image layer rebasing on Docker API v2 registries.

Install the Task

kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/v1beta1/buildpacks/buildpacks-v3.yaml

NOTE: This task is currently only compatible with Tekton v0.11.0 and above, and CNB Platform API 0.3 (lifecycle v0.7.0 and above). For previous Platform API versions, see below.

Parameters

  • BUILDER_IMAGE: The image on which builds will run. (must include v3 lifecycle and compatible buildpacks; required)

  • CACHE: The name of the persistent app cache volume. (default: an empty directory -- effectively no cache)

  • PLATFORM_DIR: A directory containing platform provided configuration, such as environment variables. Files of the format /platform/env/MY_VAR with content my-value will be translated by the lifecycle into environment variables provided to buildpacks. For more information, see the buildpacks spec. (default: an empty directory)

  • USER_ID: The user ID of the builder image user, as a string value. (default: "1000")

  • GROUP_ID: The group ID of the builder image user, as a string value. (default: "1000")

  • PROCESS_TYPE: The default process type to set on the image. (default: "web")

  • SOURCE_SUBPATH: A subpath within the source input where the source to build is located. (default: "")

Outputs

  • image: An image-type PipelineResource specifying the image that should be built.

Workspaces

The source workspace holds the source to build. See SOURCE_SUBPATH above if source is located within a subpath of this input.

Usage

This TaskRun will use the buildpacks-v3 task to build the source code, then publish a container image.

apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
  name: example-run
spec:
  taskRef:
    name: buildpacks-v3
  podTemplate:
    volumes:
# Uncomment the lines below to use an existing cache
#    - name: my-cache
#      persistentVolumeClaim:
#        claimName: my-cache-pvc
# Uncomment the lines below to provide a platform directory
#    - name: my-platform-dir
#      persistentVolumeClaim:
#        claimName: my-platform-dir-pvc
  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
# Uncomment the lines below to provide a platform directory
#  - name: PLATFORM_DIR
#    value: my-platform-dir
  resources:
    outputs:
    - name: image
      resourceSpec:
        type: image
        params:
        - name: url
          value: <your output image tag, e.g. "gcr.io/app-repo/app-image:app-tag">
  workspaces:
  - name: source
    persistentVolumeClaim:
      claimName: my-source-pvc

Example builders

Cloud Foundry:

  • cloudfoundry/cnb:bionic
  • cloudfoundry/cnb:cflinuxfs3

Heroku:

  • heroku/buildpacks:18

Previous Platform API Versions

Use one of the following commands to install a previous version of this task. Be sure to also supply a compatible builder image (BUILDER_IMAGE input) when running the task (i.e. one that has a lifecycle implementing the expected platform API).

CNB Platform API 0.2

Commit: 8c34055

kubectl -f https://raw.githubusercontent.com/tektoncd/catalog/8c34055ea728413fb72af061e7bcbf1859a9fbd6/buildpacks/buildpacks-v3.yaml

CNB Platform API 0.1

Commit: 5c2ab7d6

kubectl -f https://raw.githubusercontent.com/tektoncd/catalog/5c2ab7d6c3b2507d43b49577d7f1bee9c49ed8ab/buildpacks/buildpacks-v3.yaml