Skip to content
/ build Public
forked from shipwright-io/build

( Work-in-progress ) An API to build images on Kubernetes

Notifications You must be signed in to change notification settings

bamachrn/build

 
 

Repository files navigation

Work in Progress

The build Kubernetes API

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.

How

The following are the BuildStrategies supported by this operator, out-of-the-box:

Users have the option to define their own(custom) BuildStrategies and make them available for consumption by Builds.

Operator Resources

This operator ships two CRDs in order to register a strategy and then start the actual application builds using a registered strategy.

BuildStrategy

  • The resource BuildStrategy (buildstrategies.build.dev/v1alpha1) allows you to define a shared group of steps needed to fullfil the application build in namespaced scope. Those steps are defined as containers/v1 entries.
apiVersion: build.dev/v1alpha1
kind: BuildStrategy
metadata:
  name: source-to-image
spec:
  buildSteps:
...

The secret can be created like kubectl create secret generic <SECRET-NAME> --from-file=.dockerconfigjson=<PATH/TO/.docker/config.json> --type=kubernetes.io/dockerconfigjson

  • The resource ClusterBuildStrategy (clusterbuildstrategies.build.dev/v1alpha1) allows you to define a shared group of steps needed to fullfil the application build in cluster scope. Those steps are defined as containers/v1 entries.
apiVersion: build.dev/v1alpha1
kind: ClusterBuildStrategy
metadata:
  name: source-to-image
spec:
  buildSteps:
...

Well-known strategies can be boostrapped from here.

Build

The resource Build (builds.dev/v1alpha1) binds together source-code and BuildStrategy and related configuration as the build definition Please consider the following example:

apiVersion: build.dev/v1alpha1
kind: Build
metadata:
  name: buildpack-nodejs-build
spec:
  source:
    url: https://github.com/sclorg/nodejs-ex
    credentials:
      name: source-repository-credentials
  strategy:
    name: buildpacks-v3
    kind: ClusterBuildStrategy
  builder:
    image: heroku/buildpacks:18
    credentials:
      name: builder-registry-credentials
  output:
    image: quay.io/olemefer/nodejs-ex:v1
    credentials:
      name: output-registry-credentials

BuildRun

The resource BuildRun (buildruns.dev/v1alpha1) is the build process of a build definition which is executed in Kubernetes. Please consider the following example:

apiVersion: build.dev/v1alpha1
kind: BuildRun
metadata:
  name: buildpack-nodejs-buildrun
spec:
  buildRef:
    name: buildpack-nodejs-build

The BuildRun resource is updated as soon as the current building status changes:

$ kubectl get buildruns.build.dev buildpack-nodejs-buildrun
NAME                          SUCCEEDED   REASON      STARTTIME   COMPLETIONTIME
buildpack-nodejs-buildrun     Unknown     Running     70s

And finally:

$ kubectl get buildruns.build.dev buildpack-nodejs-buildrun
NAME                          SUCCEEDED   REASON      STARTTIME   COMPLETIONTIME
buildpack-nodejs-buildrun     True        Succeeded   2m10s       74s

Examples

Examples of Build resource using the example strategies shipped with this operator.


Try it!

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
    kind: ClusterBuildStrategy
  dockerfile: Dockerfile
  pathContext: ./
  output:
    image: image-registry.openshift-image-registry.svc:5000/build-examples/taxi-app
apiVersion: build.dev/v1alpha1
kind: BuildRun
metadata:
  name: kaniko-golang-buildrun
  namespace: build-examples
spec:
  buildRef:
    name: kaniko-golang-build

Development


Roadmap

Build Strategies Support

Build Strategy Alpha Beta GA
Source-to-Image
Buildpacks-v3 ☑️
Kaniko ☑️
Buildah ☑️

Features

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

About

( Work-in-progress ) An API to build images on Kubernetes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 91.5%
  • Shell 5.9%
  • Makefile 1.3%
  • Dockerfile 1.3%