This document defines Builder
images and the
conventions to which they are expected to adhere.
A Builder
image is a special classification for images that run as a part of
the Build CRD's steps:
.
For example, in the following Build the images, gcr.io/cloud-builders/gcloud
and gcr.io/cloud-builders/docker
are "Builders".:
spec:
steps:
- image: gcr.io/cloud-builders/gcloud
...
- image: gcr.io/cloud-builders/docker
...
A Builder is typically a purpose-built container whose entrypoint is a tool that
performs some action and exits with a zero status on success. These entrypoints
are often command-line tools, for example, git
, docker
, mvn
, and so on.
Typical builders set their command:
(aka ENTRYPOINT
) to be the command they
wrap and expect to take args:
to direct their behavior.
See here and here for more builders.
It it possible, although less typical to implement the Builder convention by
overriding command:
and args:
for example:
steps:
- image: ubuntu
command: ['/bin/bash']
args: ['-c', 'echo hello $FOO']
env:
- name: 'FOO'
value: 'world'
It is also possible for advanced users to create purpose-built builders. One example of this are the "FTL" builders.
Builders should expect a Build to implement the following conventions:
-
/workspace
: The default working directory will be/workspace
, which is a volume that is filled by thesource:
step and shared across buildsteps:
. -
/builder/home
: This volume is exposed to steps via$HOME
. -
Credentials attached to the Build's service account may be exposed as Git or Docker credentials as outlined here.
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.