1. Introduction
OpenShift automates container builds using two key resources: BuildConfig and ImageStreams.
Together, they provide a powerful CI/CD workflow that automatically rebuilds and deploys images whenever source code or base images change. This enables development teams to achieve seamless, automated build pipelines without external tools.
2. ๐๏ธ What Is BuildConfig?
A BuildConfig (BC) is a custom OpenShift resource that defines how an image should be built from source.
๐ง Key Build Strategies
-
Source-to-Image (S2I) — Converts source code into an image using language-specific builders
-
Docker Build — Builds using a Dockerfile
-
Custom Build — Allows defining your own builder logic
๐ Sample BuildConfig YAML
This BuildConfig automatically builds a new NodeJS app image whenever the Git repository changes.
3. ๐ผ๏ธ What Is an ImageStream?
An ImageStream (IS) tracks changes to images and can trigger builds or deployments accordingly.
โจ Benefits of ImageStreams
-
Decouples image tags from external registries
-
Enables automatic rebuilds when base images update
-
Integrates tightly with BuildConfig and DeploymentConfig
๐ Trigger Example
This tells OpenShift to automatically rebuild/redeploy when the associated image changes.
4. ๐ Workflow Overview
Here’s how the BuildConfig + ImageStream automation works:
-
Developer pushes code to Git.
-
ImageStream detects the updated image tag or Git change.
-
BuildConfig triggers a new build.
-
A new image is created and stored in the internal registry.
-
DeploymentConfig or Deployment updates automatically.
This forms the core of OpenShift’s native CI/CD pipeline.
5. ๐งช Troubleshooting Tips
Check build logs
Inspect ImageStream status
Validate triggers in BuildConfig
6. โ Best Practices
โ๏ธ Use S2I for language-based applications
โ๏ธ Tag images cleanly (:dev, :stage, :prod)
โ๏ธ Secure Git credentials using Secrets
โ๏ธ Enable ImageChange triggers for auto-build workflows
โ๏ธ Use Webhooks for instant build triggers from GitHub/GitLab
FAQs (0)
Sign in to ask a question. You can read FAQs without logging in.