mirror of
https://github.com/tektoncd/catalog.git
synced 2024-11-24 06:15:46 +00:00
.. | ||
bazel.yaml | ||
README.md |
Bazel
This tasks builds source into a container image using the Bazel build tool, and Bazel's container image support.
This assumes the source repo in question is using the
container_push
rule to build and push a container image. For example:
container_push(
name = "push",
format = "Docker", # Or "OCI"
image = ":image",
registry = "gcr.io",
repository = "my-project/my-app",
stamp = True,
)
This target instructs Bazel to build and push a container image containing the
application defined by the :image
target, based on a suitable base image.
The rules_docker
repo defines build rules to construct images for a variety of
popular programming languages, like
Python,
Java,
Go and many more.
Install the Task
kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/bazel/bazel.yaml
Inputs
Parameters
- TARGET: The Bazel
container_push
target to run to build and push the container image.
Resources
- source: A
git
-typePipelineResource
specifying the location of the source to build.
Usage
This TaskRun runs the Task to fetch a Git repo, and build and push a container image using Bazel.
apiVersion: tekton.dev/v1alpha1
kind: TaskRun
metadata:
name: example-run
spec:
taskRef:
name: bazel
inputs:
params:
- name: TARGET
value: //path/to/image:publish
resources:
- name: source
resourceSpec:
type: git
params:
- name: url
value: https://github.com/my-user/my-repo