1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/images-custom.adoc
2025-10-29 16:59:21 +00:00

63 lines
2.5 KiB
Plaintext

// Module included in the following assemblies:
//
// * builds/build-strategies.adoc
:_mod-docs-content-type: CONCEPT
[id="images-custom_{context}"]
= Using custom builder images
{product-title}'s custom build strategy enables you to define a specific builder image responsible for the entire build process. When you need a build to produce individual artifacts such as packages, JARs, WARs, installable ZIPs, or base images, use a custom builder image using the custom build strategy.
A custom builder image is a plain container image embedded with build process logic, which is used for building artifacts such as RPMs or base container images.
Additionally, the custom builder allows implementing any extended build process, such as a CI/CD flow that runs unit or integration tests.
[id="images-custom-builder-image-ref_{context}"]
== Custom builder image
Upon invocation, a custom builder image receives 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` operation.
|===
[id="images-custom-builder-flow_{context}"]
== Custom builder workflow
Although custom builder image authors have flexibility in defining the build process, your builder image must adhere to the following required steps necessary for 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 output location of the build if it is defined. Other output locations can be passed with environment variables.