1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-24 06:15:46 +00:00
catalog/task/buildah/0.8/README.md
Jimmy Jones 82a2a61e20 buildah 0.8
* don't use interpolation
* easier way of specifying build args
* move to v1 resources
2024-07-15 17:32:51 +01:00

3.3 KiB

Buildah

This Task builds source into a container image using Project Atomic's Buildah build tool. It uses Buildah's support for building from Dockerfiles, using its buildah bud command. This command executes the directives in the Dockerfile to assemble a container image, then pushes that image to a container registry.

Install the Task

kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/buildah/0.8/raw

Parameters

  • IMAGE: The name (reference) of the image to build.
  • BUILDER_IMAGE:: The name of the image containing the Buildah tool. See note below. (default: quay.io/buildah/stable:v1)
  • DOCKERFILE: The path to the Dockerfile to execute (default: ./Dockerfile)
  • CONTEXT: Path to the directory to use as context (default: .)
  • TLSVERIFY: Verify the TLS on the registry endpoint (for push/pull to a non-TLS registry) (default: true)
  • FORMAT: The format of the built container, oci or docker (default: oci)
  • BUILD_EXTRA_ARGS: Extra parameters passed for the build command when building images. WARNING - must be sanitized to avoid command injection (default: "")
  • PUSH_EXTRA_ARGS: Extra parameters passed for the push command when pushing images. WARNING - must be sanitized to avoid command injection (default: "")
  • SKIP_PUSH: Skip pushing the built image (default: false)
  • BUILD_ARGS: Dockerfile build arguments, array of key=value (default: [""])

Results

  • IMAGE_URL: Image repository where the built image would be pushed to
  • IMAGE_DIGEST: Digest of the image just built

Workspaces

  • source: A Workspace containing the source to build.
  • sslcertdir: An optional Workspace containing your custom SSL certificates to connect to the registry. Buildah will look for files ending with *.crt, *.cert, *.key into this workspace. See this sample for a complete example on how to use it with OpenShift internal registry.
  • dockerconfig: An optional workspace that allows providing a .docker/config.json file for Buildah to access the container registry. The file should be placed at the root of the Workspace with name config.json. See this sample for a complete example on how to use dockerconfig to access container registry. (optional)

Platforms

The Task can be run on linux/amd64, linux/s390x, linux/arm64 and linux/ppc64le platforms.

Usage

This TaskRun runs the Task to fetch a Git repo, and build and push a container image using Buildah.

apiVersion: tekton.dev/v1
kind: TaskRun
metadata:
  name: buildah-build-my-repo
spec:
  taskRef:
    name: buildah
  params:
  - name: IMAGE
    value: gcr.io/my-repo/my-image
  workspaces:
  - name: source
    persistentVolumeClaim:
      claimName: my-source

In this example, the Git repo being built is expected to have a Dockerfile at the root of the repository.