Este contenido no está disponible en el idioma seleccionado.
Chapter 1. Overview of Builds
Builds is an extensible build framework based on the Shipwright project, which you can use to build container images on an OpenShift Container Platform cluster. You can build container images from source code and Dockerfiles by using image build tools, such as Source-to-Image (S2I) and Buildah. You can create and apply build resources, view logs of build runs, and manage builds in your OpenShift Container Platform namespaces.
Builds includes the following capabilities:
- Standard Kubernetes-native API for building container images from source code and Dockerfiles
-
Support for Source-to-Image (S2I) and
Buildahbuild strategies - Extensibility with your own custom build strategies
- Execution of builds from source code in a local directory
- Shipwright CLI for creating and viewing logs, and managing builds on the cluster
- Integrated user experience with the Developer perspective of the OpenShift Container Platform web console
Builds consists of the following custom resources (CRs):
-
Build -
BuildStrategyandClusterBuildStrategy -
BuildRun
1.1. Build resource Copiar enlaceEnlace copiado en el portapapeles!
The Build resource defines the source code of your application and the location where your application images will be pushed. The following example shows a simple build that consists of a Git source, a build strategy, and an output image:
You can also extend a Build resource to push your images to a private registry or use a Dockerfile.
1.2. BuildStrategy and ClusterBuildStrategy resources Copiar enlaceEnlace copiado en el portapapeles!
The BuildStrategy and ClusterBuildStrategy resources define a series of steps to assemble an application. You can use the BuildStrategy resources within a namespace and the ClusterBuildStrategy resources within a cluster.
The specification of a BuildStrategy or ClusterBuildStrategy resource consists of a steps object. The following example shows the specification of the buildah cluster build strategy:
1.3. BuildRun resource Copiar enlaceEnlace copiado en el portapapeles!
A BuildRun resource invokes a build on your cluster, similar to any cluster job or Tekton task run. The BuildRun resource represents a workload on your cluster, which results in a running pod. A BuildRun is the running instance of a build. It instantiates a build for execution with specific parameters on a cluster.
A BuildRun resource helps you to define the following elements:
-
A unique
BuildRunname to monitor the status of the build -
A referenced
Buildinstance to use during the build - A service account to host all secrets for the build
Each BuildRun resource is available within a namespace.
1.4. Build controller Copiar enlaceEnlace copiado en el portapapeles!
The build controller monitors any updates in the Build resource and performs the following tasks:
-
Validates if the referenced
Strategyobject exists in theBuildresource. -
Validates if the specified parameters in the
BuildCR exist in the referenced build strategy. It also validates if the parameter names collide with any reserved names. -
Validates if the container registry output secret exists in the
Buildresource. -
Validates if the referenced
spec.source.git.urlendpoint URL exists in theBuildresource.
The build run controller monitors any updates in the Build or TaskRun resource and performs the following tasks:
-
Searches for any existing
TaskRunresource and updates its parentBuildRunresource status. -
Retrieves the specified service account and sets it along with the output secret in the
Buildresource. -
If a
TaskRunresource does not exist, the controller generates a new TektonTaskRunresource and sets a reference to theTaskRunresource. -
For any subsequent updates in the
TaskRunresource, the controller updates the parentBuildRunresource.
1.4.1. Build validations Copiar enlaceEnlace copiado en el portapapeles!
To avoid triggering BuildRun resources that will fail because of incorrect or missing dependencies or configuration settings, the build controller validates them in advance. If all validations are successful, you view a status.reason field named Succeeded. However, if any validations fail, you must check the status.reason and status.message fields to understand the root cause.
| status.reason field | Description |
|---|---|
|
| The referenced strategy at namespace level does not exist. |
|
| The referenced strategy at cluster level does not exist. |
|
|
Setting owner references between a |
|
| The secret used to authenticate to Git does not exist. |
|
| The secret used to authenticate to the container registry does not exist. |
|
| The secret used to authenticate to the container registry does not exist. |
|
| Multiple secrets used for authentication are missing. |
|
|
One or many defined |
|
|
The parameters are not defined in the referenced strategy. You must define those parameters in the |
|
|
The defined |
|
|
The build name in the |
|
| Indicates that the name for a user-provided environment variable is blank. |
|
| Indicates that the value for a user-provided environment variable is blank. |