Fix BuildConfig Failed OpenShift¶
Introduction¶
OpenShift builds convert source code or Dockerfile input into an image and usually publish it to an ImageStreamTag. Troubleshooting starts with the BuildConfig, then the latest Build, logs, and output image.
Symptoms¶
Typical symptoms include failed pods, route errors, denied requests, unhealthy operators, or command errors that repeat after retries.
Common Causes¶
- Checking the Deployment before confirming the build produced an image.
- Using --follow and missing the final Build status.
- Forgetting that a BuildConfig trigger may start a new build automatically.
Step 1: Check the Current Status¶
oc get buildconfig web -n app
oc start-build web -n app --follow
oc logs -f build/web-1 -n app
oc get imagestreamtag web:latest -n app
Example output:
NAME TYPE FROM LATEST
web Source Git@main 1
NAME TYPE FROM STATUS STARTED DURATION
web-1 Source Git@main Complete 2 minutes ago 1m10s
Step 2: Inspect Logs and Events¶
oc describe buildconfig web -n app
oc logs build/web-1 -n app
oc get istag web:latest -n app
Step 3: Verify Configuration¶
Compare the object selectors, service account, image reference, route target, or operator status with the failing symptom. In OpenShift, events often show the exact admission, scheduling, pull, SCC, or route reason.
Example YAML¶
apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
name: web
spec:
source:
git:
uri: https://github.com/example/web.git
strategy:
sourceStrategy:
from:
kind: ImageStreamTag
name: nodejs:18-ubi8
output:
to:
kind: ImageStreamTag
name: web:latest
Step 4: Apply the Fix¶
Apply the smallest targeted fix: correct the selector, update the route or service port, link the pull secret, grant the specific RBAC or SCC permission, or repair the unhealthy operator dependency.
Step 5: Confirm the Problem Is Resolved¶
Run the verification commands again and confirm the status, events, and user-facing test all agree.
Common Mistakes¶
- Checking the Deployment before confirming the build produced an image.
- Using --follow and missing the final Build status.
- Forgetting that a BuildConfig trigger may start a new build automatically.
Quick Checklist¶
- Confirm the active project.
- Inspect the exact object named in the error.
- Read recent events.
- Apply one focused fix.
- Verify status after the change.
Related Guides¶
Summary¶
Fix BuildConfig Failed OpenShift requires matching the symptom to the OpenShift object that owns it. Use oc status commands, events, logs, and focused verification so the fix is tied to evidence.