Skip to main content
This resource wrapper does not currently exist in the openshift-python-wrapper library.You can use the class generator to create this wrapper for your cluster:
Or work with BuildConfig resources using the generic Resource class with kind="BuildConfig" and api_group="build.openshift.io".

Overview

BuildConfig is an OpenShift object that defines a build strategy for creating container images. BuildConfigs automate the process of building container images from source code using various build strategies (Source-to-Image, Docker, Custom, or Pipeline). API Group: build.openshift.io/v1
BuildConfig is an OpenShift-specific resource. Ensure your cluster has OpenShift installed to use this resource.

Class Definition

Constructor

Parameters

str
default:"None"
Name of the BuildConfig resource. If not provided, it must be specified in the YAML file.
str
default:"None"
Namespace where the BuildConfig will be created. Required for namespaced resources.
DynamicClient
default:"None"
Kubernetes dynamic client for API communication. If not provided, the default client will be used.
dict[str, Any]
default:"None"
Source definition for the build. Specifies where the build input comes from (Git repository, binary, Dockerfile, etc.).Example:
dict[str, Any]
default:"None"
Build strategy definition. Defines how the build is executed (Source, Docker, Custom, or JenkinsPipeline).Example for Source-to-Image:
dict[str, Any]
default:"None"
Output specification for the built image. Defines where the resulting image should be pushed.Example:
list[dict[str, Any]]
default:"None"
List of triggers that automatically start a new build. Common trigger types include ConfigChange, ImageChange, GitHub, and Generic webhooks.Example:
bool
default:"True"
If True, the resource will be automatically deleted when used as a context manager.
str
default:"None"
Path to a YAML file containing the BuildConfig definition. If provided, the BuildConfig will be created from this file.
int
default:"TIMEOUT_4MINUTES"
Timeout in seconds for delete operations. Defaults to 4 minutes.
Any
Additional keyword arguments passed to the parent NamespacedResource class. Common options include label and annotations.

Usage Examples

Source-to-Image Build

Create a BuildConfig using Source-to-Image strategy:

Docker Build Strategy

Create a BuildConfig using Docker build strategy:

Build with Environment Variables

Create a BuildConfig with environment variables for the build:

Creating from YAML

Create a BuildConfig from a YAML file:

Using Context Manager

Automatically clean up the BuildConfig after use:

Build Strategies

Source-to-Image (S2I)

Builds container images from source code by injecting code into a base builder image:

Docker Strategy

Builds container images using a Dockerfile:

Custom Strategy

Uses a custom builder image for specialized build processes:

Build Triggers

BuildConfigs support various trigger types to automatically start builds:

Configuration Change Trigger

Triggers a build when the BuildConfig is created or modified:

Image Change Trigger

Triggers a build when a base image changes:

Webhook Triggers

Triggers builds via GitHub or Generic webhooks:

See Also