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

[ Proposal ] An API to build images on Kubernetes with diverse strategies

Notifications You must be signed in to change notification settings

bluebosh/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 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. 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.

Build

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-olemefer

The 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

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


Try it!

  1. Install Tekton, optionally you could use OpenShift Pipelines Community Operator

  2. Install operator-sdk

  3. Create a project or namespace called build-examples

  4. Execute make local to register well-known build strategies including Kaniko and start the operator.

  5. 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

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

[ Proposal ] An API to build images on Kubernetes with diverse strategies

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 91.6%
  • Shell 5.8%
  • Makefile 1.3%
  • Dockerfile 1.3%