- In your Git repository browser click the Code button and copy the HTTPS URL for the repo you want to build.
- In the BuildConfig form, replace the example Git URI with your Sock Shop repo URL and set the BuildConfig name (for example
sock-shop). - Verify the Git branch (for example
masterormain) and choose the build strategy (commonlySourcefor S2I/source builds).
The important piece that actually provides the build environment is the builder image referenced in
spec.strategy.from (or other from locations). In OpenShift this commonly references an ImageStreamTag (for example nodejs:14 or s2i-ruby:2.7) — the builder image runs the build steps and produces the application image.
The BuildConfig ties your source repository to a builder image (ImageStreamTag). That’s why a BuildConfig takes your code and creates a container image by using another container image as the build environment.
oc new-app can create an ImageStream, a BuildConfig, a Deployment (or DeploymentConfig), and a Service for you when you point it at a Git repository:
oc new-app output:
gowebapi) — demonstrating that OpenShift can create BuildConfigs automatically when creating an application from source.
If your Git repo is private,
oc new-app or the BuildConfig will need credentials or a secret to access the repository. Make sure to create and reference the appropriate secret in spec.source before starting the build.oc start-build to manually start a build from a BuildConfig:
Summary / Best practices
- Create or edit a BuildConfig to point at your Git repo and choose an appropriate builder ImageStreamTag (the
fromimage). - Use the console or
occommands (oc new-app,oc start-build,oc logs -f) to create, trigger, and monitor builds. - Check BuildConfig Events in the console to confirm success or view errors.
- For private repos, add the necessary credentials/Secrets and reference them in the BuildConfig before starting builds.