turbot/openshift
steampipe plugin install openshift

Table: openshift_build_config - Query OpenShift Build Configurations using SQL

OpenShift Build Configurations are a key resource in the OpenShift platform that defines the parameters for building an application. They specify the source code repository, the build strategy (Docker, Source-to-Image, or Custom), and the output image. Build Configurations also specify triggers, which cause a new build to be run automatically when certain events occur.

Table Usage Guide

The openshift_build_config table provides insights into the configuration details of builds within the OpenShift platform. As a DevOps engineer or system administrator, explore build-specific details through this table, including the source code repository, build strategy, output image, and triggers. Utilize it to manage and monitor the build process, ensuring that builds are configured correctly and running as expected.

Examples

Basic info

Explore which OpenShift build configurations have been created and their respective run policies. This can help in understanding the frequency of successful builds, thereby aiding in optimizing the build process.

select
uid,
name,
namespace,
run_policy,
creation_timestamp,
successful_builds_history_limit
from
openshift_build_config;
select
uid,
name,
namespace,
run_policy,
creation_timestamp,
successful_builds_history_limit
from
openshift_build_config;

List build configs present in the default namespace

Explore the build configurations present in the default workspace to understand the build policies, creation times, and history limits of successful builds. This can be useful in managing and optimizing your build processes.

select
uid,
name,
namespace,
run_policy,
creation_timestamp,
successful_builds_history_limit
from
openshift_build_config
where
namespace = 'default';
select
uid,
name,
namespace,
run_policy,
creation_timestamp,
successful_builds_history_limit
from
openshift_build_config
where
namespace = 'default';

List build configs with default run policy

Explore which build configurations are using the default 'Serial' run policy. This can help in managing and optimizing build processes in an OpenShift environment.

select
uid,
name,
namespace,
run_policy,
creation_timestamp,
successful_builds_history_limit
from
openshift_build_config
where
run_policy = 'Serial';
select
uid,
name,
namespace,
run_policy,
creation_timestamp,
successful_builds_history_limit
from
openshift_build_config
where
run_policy = 'Serial';

List build configs created in the last 30 days

Explore the recently created build configurations to understand their run policies and success rates. This can help assess the efficiency of your configurations and identify areas for improvement.

select
uid,
name,
namespace,
run_policy,
creation_timestamp,
successful_builds_history_limit
from
openshift_build_config
where
creation_timestamp >= now() - interval '30' day;
select
uid,
name,
namespace,
run_policy,
creation_timestamp,
successful_builds_history_limit
from
openshift_build_config
where
creation_timestamp >= datetime('now', '-30 day');

List common specs of the build configs

Discover the common specifications of your build configurations in OpenShift to better understand and manage your application's build process. This can be particularly useful for identifying potential areas of optimization or troubleshooting issues.

select
uid,
name,
namespace,
jsonb_pretty(common_spec) as common_spec
from
openshift_build_config;
select
uid,
name,
namespace,
common_spec
from
openshift_build_config;

Get triggers of the build configs

Explore which build configurations in your Openshift environment have triggers set up. This can help you understand and manage automated build processes in your system.

select
uid,
name,
namespace,
jsonb_pretty(triggers) as triggers
from
openshift_build_config;
select
uid,
name,
namespace,
triggers
from
openshift_build_config;

List builds associated with a particular build config

Explore which builds are linked to a specific configuration to understand their performance and status. This is beneficial for assessing the efficiency of different configurations and identifying any potential issues.

select
b.uid,
b.name,
b.namespace,
b.start_timestamp,
b.reason,
b.phase,
b.cancelled,
b.duration,
b.completion_timestamp
from
openshift_build as b,
jsonb_array_elements(owner_references) as ref,
openshift_build_config as c
where
ref ->> 'uid' = c.uid
and c.name = 'config_name';
select
b.uid,
b.name,
b.namespace,
b.start_timestamp,
b.reason,
b.phase,
b.cancelled,
b.duration,
b.completion_timestamp
from
openshift_build as b,
json_each(b.owner_references) as ref,
openshift_build_config as c
where
json_extract(ref.value, '$.uid') = c.uid
and c.name = 'config_name';

Schema for openshift_build_config

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
annotationsjsonbAnnotations is an unstructured key-value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata.
common_specjsonbCommonSpec is the desired build specification.
creation_timestamptimestamp with time zoneCreationTimestamp is a timestamp representing the server time when this object was created.
deletion_grace_period_secondsbigintNumber of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set.
deletion_timestamptimestamp with time zoneDeletionTimestamp is RFC 3339 date and time at which this resource will be deleted.
failed_builds_history_limitbigintIt is the number of old failed builds to retain. If not specified, all failed builds are retained.
finalizersjsonbMust be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed.
generate_nametextGenerateName is an optional prefix, used by the server, to generate a unique name only if the Name field has not been provided.
generationbigintA sequence number representing a specific generation of the desired state.
image_change_triggersjsonbImageChangeTriggers captures the runtime state of any ImageChangeTrigger specified in the BuildConfigSpec, including the value reconciled by the OpenShift APIServer for the lastTriggeredImageID.
labelsjsonbMap of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services.
last_versionbigintLast version is used to inform about the number of last triggered builds.
nametext=Name of the object. Name must be unique within a namespace.
namespacetext=Namespace defines the space within which each name must be unique.
owner_referencesjsonbList of objects depended by this object. If all objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.
resource_versiontextAn opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed.
run_policytextRunPolicy describes how the new build created from this build configuration will be scheduled for execution. This is optional, if not specified we default to Serial.
successful_builds_history_limitbigintIt is the number of old successful builds to retain. If not specified, all successful builds are retained.
titletextTitle of the resource.
triggersjsonbTriggers determine how new Builds can be launched from a BuildConfig. If no triggers are defined, a new build can only occur as a result of an explicit client build creation.
uidtextUID is the unique in time and space value for this object.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- openshift

You can pass the configuration to the command with the --config argument:

steampipe_export_openshift --config '<your_config>' openshift_build_config