mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-06 06:46:26 +01:00
79 lines
2.8 KiB
Plaintext
79 lines
2.8 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * builds/build-strategies.adoc
|
|
|
|
[id="images-custom_{context}"]
|
|
= Using custom builder images
|
|
|
|
By allowing you to define a specific builder image responsible for the entire
|
|
build process, {product-title}'s Custom build strategy was designed to fill a
|
|
gap created with the increased popularity of creating container images. When
|
|
there is a requirement for a build to still produce individual artifacts
|
|
(packages, JARs, WARs, installable ZIPs, and base images, for example), a
|
|
_Custom builder image_ using the Custom build strategy is the perfect match to
|
|
fill that gap.
|
|
|
|
A Custom builder image is a plain container image embedded with build process
|
|
logic, for example for building RPMs or base container images.
|
|
|
|
Additionally, the Custom builder allows implementing any extended build process,
|
|
for example a CI/CD flow that runs unit or integration tests.
|
|
|
|
To fully leverage the benefits of the Custom build strategy, you must understand
|
|
how to create a Custom builder image that will be capable of building desired
|
|
objects.
|
|
|
|
== Custom builder image
|
|
|
|
Upon invocation, a custom builder image will receive the following environment
|
|
variables with the information needed to proceed with the build:
|
|
|
|
.Custom Builder Environment Variables
|
|
[cols="1,3",options="header"]
|
|
|===
|
|
|
|
|Variable Name |Description
|
|
|
|
|`BUILD`
|
|
|The entire serialized JSON of the `Build` object definition. If you must
|
|
use a specific API version for serialization, you can set the
|
|
`buildAPIVersion` parameter in the custom strategy
|
|
specification of the build configuration.
|
|
|
|
|`SOURCE_REPOSITORY`
|
|
|The URL of a Git repository with source to be built.
|
|
|
|
|`SOURCE_URI`
|
|
|Uses the same value as `SOURCE_REPOSITORY`. Either can be used.
|
|
|
|
|`SOURCE_CONTEXT_DIR`
|
|
|Specifies the subdirectory of the Git repository to be used when building. Only
|
|
present if defined.
|
|
|
|
|`SOURCE_REF`
|
|
|The Git reference to be built.
|
|
|
|
|`ORIGIN_VERSION`
|
|
|The version of the {product-title} master that created this build object.
|
|
|
|
|`OUTPUT_REGISTRY`
|
|
|The container image registry to push the image to.
|
|
|
|
|`OUTPUT_IMAGE`
|
|
|The container image tag name for the image being built.
|
|
|
|
|`PUSH_DOCKERCFG_PATH`
|
|
|The path to the container registry credentials for running a `podman push` or `docker push` operation.
|
|
|
|
|===
|
|
|
|
== Custom builder workflow
|
|
|
|
Although custom builder image authors have great flexibility in defining the
|
|
build process, your builder image must still adhere to the following required
|
|
steps necessary for seamlessly running a build inside of {product-title}:
|
|
|
|
. The `Build` object definition contains all the necessary information about input parameters for the build.
|
|
. Run the build process.
|
|
. If your build produces an image, push it to the build's output location if it is defined. Other output locations can be passed with environment variables.
|