Codenamed build-v2
An API to build container-images on Kubernetes using popular strategies and tools like
source-to-image, buildpack-v3, kaniko, jib and buildah, in an extensible way.
The following are the BuildStrategies supported by this operator, out-of-the-box:
Users have the option to define their own BuildStrategies and make them available for consumption
by Builds.
This operator ships two CRDs in order to register a strategy and then start the actual application builds using a registered strategy.
The resource BuildStrategy (buildstrategies.build.dev/v1alpha1) allows you to define a shared group of
steps needed to fullfil the application build. Those steps are defined as
containers/v1 entries.
---
apiVersion: build.dev/v1alpha1
kind: BuildStrategy
metadata:
name: source-to-image
spec:
buildSteps:
...Well-known strategies can be boostrapped from here.
The resource Build (builds.dev/v1alpha1) binds together source-code and BuildStrategy
culminating in the actual appplication build process being executed in Kubernetes. Please consider
the following example:
---
apiVersion: build.dev/v1alpha1
kind: Build
metadata:
name: example-build-buildpack
spec:
source:
url: https://github.com/sclorg/nodejs-ex
credentials:
name: source-repository-credentials
strategy:
name: buildpacks-v3
namespace: openshift
builder:
image: heroku/buildpacks:18
credentials: quayio-olemefer
output:
image: quay.io/olemefer/nodejs-ex:v1
credentials:
name: quayio-olemeferThe resource is updated as soon as the current building status changes:
$ kubectl get builds.build.dev buildpacks
NAME STATUS
buildpacks Running
And finally:
$ kubectl get builds.build.dev buildpacks
NAME STATUS
buildpacks Succeeded
Examples of Build resource using the example strategies shipped with this operator.
-
Install Tekton, optionally you could use OpenShift Pipelines Community Operator
-
Install
operator-sdk -
Create a project or namespace called
build-examples -
Execute
make localto register well-known build strategies includingKanikoand start the operator. -
Start a Kaniko build
---
apiVersion: build.dev/v1alpha1
kind: Build
metadata:
name: kaniko-golang-build
namespace: build-examples
spec:
source:
url: https://github.com/sbose78/taxi
strategy:
name: kaniko
namespace: build-examples
dockerfile: Dockerfile
pathContext: ./
output:
image: image-registry.openshift-image-registry.svc:5000/build-examples/taxi-app- Build, test & run using HACK.md.
| Build Strategy | Alpha | Beta | GA |
|---|---|---|---|
| Source-to-Image | ☑ | ||
| Buildpacks-v3 | ☑️ | ||
| Kaniko | ☑️ | ||
| Buildah | ☑️ |
| Feature | Alpha | Beta | GA |
|---|---|---|---|
| Private Git Repos | ☑️ | ||
| Private Output Image Registry | ☑️ | ||
| Private Builder Image Registry | ☑️ | ||
| Cluster scope BuildStrategy | ☑️ | ||
| Runtime Base Image | ⚪️ | ||
| Binary builds | |||
| Image Caching | |||
| ImageStreams support | |||
| Entitlements |