A build configuration describes a single build definition and a set of
triggers for when a new build should
be created. Build configurations are defined by a
BuildConfig, which is a REST
object that can be used in a POST to the API server to create a new instance.
Depending on how you choose to create your application using OpenShift Container Platform, a
BuildConfig is typically generated automatically for you if you use the web
console or CLI, and it can be edited at any time. Understanding the parts that
make up a
BuildConfig and their available options can help if you choose to
manually tweak your configuration later.
The following example
BuildConfig results in a new build every time a
container image tag or the source code changes:
BuildConfig Object Definition
name: "ruby-sample-build" (1)
runPolicy: "Serial" (2)
- type: "Generic"
script: "bundle exec rake test"
||This specification will create a new
runPolicy field controls whether builds created from this build
configuration can be run simultaneously. The default value is
Serial, which means new builds
will run sequentially, not simultaneously.
||You can specify a list of triggers,
which cause a new build to be created.
source section defines the source of the build. The source type
determines the primary source of input, and can be either
Git, to point to
a code repository location,
Dockerfile, to build from an inline Dockerfile,
Binary, to accept binary payloads. It is possible to have multiple
sources at once, refer to the documentation for each source type for details.
strategy section describes the build strategy used to execute the
build. You can specify a
strategy here. This above example uses the
ruby-20-centos7 container image
that Source-To-Image will use for the application build.
||After the container image is successfully built, it will be pushed into the
repository described in the
postCommit section defines an optional build hook.