|
||
---|---|---|
.. | ||
README.md | ||
auth.md | ||
build-templates.md | ||
builder-contract.md | ||
builds.md | ||
personas.md |
README.md
Knative Build
A Build
is a custom resource in Knative that allows you to define an process that runs
to completion and can provide status. For example, fetch, build, and package your
code by using a Knative Build
that communicates whether the process succeeds.
A Knative Build
runs on-cluster and is implemented by a
Kubernetes Custom Resource Definition (CRD).
Given a Builder
, or container image that you have created to perform a task
or action, you can define a Knative Build
through a single configuration file.
Also consider using a Knative Build
to build the source code of your apps into container images,
which you can then run on Knative serving
.
More information about this use case is demonstrated in
this sample.
Key features of Knative builds
- A
Build
can include multiplesteps
where each step specifies aBuilder
. - A
Builder
is a type of container image that you create to accomplish any task, whether that's a single step in a process, or the whole process itself. - The
steps
in aBuild
can push to a repository. - A
BuildTemplate
can be used to defined reusable templates. - The
source
in aBuild
can be defined to mount data to a Kubernetes Volume, and supports:git
repositories- Google Cloud Storage
- An arbitrary container image
- Authenticate with
ServiceAccount
using Kubernetes Secrets.
Learn more
See the following reference topics for information about each of the build components:
Configuration syntax example
Use the following example to understand the syntax and structure of the various components of a
Knative Build
. Note that not all elements of a Build
configuration file are included in the following
example but you can reference the Knative build samples
section along with the reference files above for more information.
The following example demonstrates a build that uses authentication and includes multiple steps
and
multiple repositories:
apiVersion: build.knative.dev/v1alpha1
kind: Build
metadata:
name: example-build
spec:
serviceAccountName: build-auth-example
source:
git:
url: https://github.com/sample/build-sample.git
revision: master
steps:
- name: ubuntu-example
image: ubuntu
args: ["ubuntu-build-example", "SECRETS.md"]
steps:
- image: gcr.io/sample-builders/build-sample
args: ['echo', 'hello', 'build']
Get started with Knative build samples
Use the following samples to learn how to configure your Knative builds to perform simple tasks.
Tip: Review and reference multiple samples to piece together more complex builds.
Simple build samples
Build templates
Complex samples
Related info
If you are interested in contributing to the Knative build project, see the Knative Build code repository.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License.