Table: openshift_build - Query OpenShift Builds using SQL
OpenShift Builds are a part of the OpenShift Container Platform build system, which provides a consistent method of turning application source code into a running containerized application. The build system captures source code from a version control system, processes it into a new container image, and pushes it to a container image registry. It supports several strategies to produce images.
Table Usage Guide
The openshift_build
table provides insights into the build configurations within OpenShift Container Platform. As a DevOps engineer, explore build-specific details through this table, including the build strategy, source, status, and output. Utilize it to track the progress of builds, understand the build strategies being used, and verify the output of completed builds.
Examples
Basic info
Analyze the settings to understand the overall performance and status of your OpenShift builds. This query helps to pinpoint specific instances where builds may have failed or been cancelled, providing insights to improve system efficiency and stability.
select uid, name, namespace, start_timestamp, reason, phase, cancelled, duration, completion_timestampfrom openshift_build;
select uid, name, namespace, start_timestamp, reason, phase, cancelled, duration, completion_timestampfrom openshift_build;
List incomplete builds
Discover the segments that are still in progress within your OpenShift environment. This query is useful for tracking ongoing processes and identifying any builds that may be stalled or delayed.
select uid, name, namespace, start_timestamp, reason, phase, cancelled, duration, completion_timestampfrom openshift_buildwhere phase <> 'Complete';
select uid, name, namespace, start_timestamp, reason, phase, cancelled, duration, completion_timestampfrom openshift_buildwhere phase <> 'Complete';
List cancelled builds
Explore which builds have been cancelled in OpenShift to understand the reasons behind it and analyze the duration and time of cancellation. This helps in identifying any recurring issues and taking proactive measures to improve build success rates.
select uid, name, namespace, start_timestamp, reason, phase, cancelled, duration, completion_timestampfrom openshift_buildwhere cancelled;
select uid, name, namespace, start_timestamp, reason, phase, cancelled, duration, completion_timestampfrom openshift_buildwhere cancelled = 1;
List common specs of the builds
Explore the common specifications of different builds to understand their unique configurations and phases. This can aid in identifying patterns or irregularities in build setups, thereby facilitating improved management and optimization of resources.
select uid, name, namespace, phase, jsonb_pretty(common_spec) as common_specfrom openshift_build;
select uid, name, namespace, phase, common_specfrom openshift_build;
Get trigger details of the builds
Analyze the settings to understand the stages and conditions that initiate specific builds in a system. This can help in identifying the triggers and resolving any issues related to the build process.
select uid, name, namespace, phase, jsonb_pretty(triggered_by) as triggered_byfrom openshift_build;
select uid, name, namespace, phase, triggered_byfrom openshift_build;
Get stage details of the builds
Analyze the stages of various builds to understand their progress and status, which can be useful for managing and optimizing build processes within an OpenShift environment.
select uid, name, namespace, phase, jsonb_pretty(stages) as stagesfrom openshift_build;
select uid, name, namespace, phase, stagesfrom openshift_build;
Schema for openshift_build
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
annotations | jsonb | Annotations is an unstructured key-value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. | |
cancelled | boolean | Cancelled describes if a cancel event was triggered for the build. | |
common_spec | jsonb | CommonSpec is the information that represents a build. | |
completion_timestamp | timestamp with time zone | It is a timestamp representing the server time when this Build was finished, whether that build failed or succeeded. It reflects the time at which the Pod running the Build terminated. | |
conditions | text | Conditions represent the latest available observations of a build's current state. | |
config | jsonb | It is an ObjectReference to the BuildConfig this Build is based on. | |
creation_timestamp | timestamp with time zone | CreationTimestamp is a timestamp representing the server time when this object was created. | |
deletion_grace_period_seconds | bigint | Number 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_timestamp | timestamp with time zone | DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. | |
duration | bigint | Duration contains time.Duration object describing build time. | |
finalizers | jsonb | Must 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_name | text | GenerateName is an optional prefix, used by the server, to generate a unique name only if the Name field has not been provided. | |
generation | bigint | A sequence number representing a specific generation of the desired state. | |
labels | jsonb | Map 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. | |
log_snippet | text | It is the last few lines of the build log. This value is only set for builds that failed. | |
message | text | Message is a human-readable message indicating details about why the build has this status. | |
name | text | = | Name of the object. Name must be unique within a namespace. |
namespace | text | = | Namespace defines the space within which each name must be unique. |
output | jsonb | Output describes the Docker image the build has produced. | |
output_docker_image_reference | text | It contains a reference to the Docker image that will be built by this build. Its value is computed from Build.Spec.Output.To, and should include the registry address, so that it can be used to push and pull the image. | |
owner_references | jsonb | List 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. | |
phase | text | Phase is the point in the build lifecycle. Possible values are New, Pending, Running, Complete, Failed, Error, and Cancelled. | |
reason | text | Reason is a brief CamelCase string that describes any failure and is meant for machine parsing and tidy display in the CLI. | |
resource_version | text | An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
stages | jsonb | Stages contain details about each stage that occurs during the build including start time, duration (in milliseconds), and the steps that occurred within each stage. | |
start_timestamp | timestamp with time zone | It is a timestamp representing the server time when this Build started running in a Pod. | |
title | text | Title of the resource. | |
triggered_by | jsonb | It describes which triggers started the most recent update to the build configuration and contains information about those triggers. | |
uid | text | UID 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