OC(1)
π NAME
oc start-build β start a new build, bestie β¨
β¨ SYNOPSIS
oc start-build [OPTIONS]
πΈ DESCRIPTION
Okay so, this command starts a build. That's it. That's the vibe π
It starts a fresh new build for whatever build config you hand it, or, plot twist, it copies an existing build if you slide in --from-build=<name>. And if you want to actually watch the thing do its little thing, pass the --follow flag and you'll see the output from the build streaming at you live π
Also, you can pass a file, a directory, or a whole source code repository straight into the build with the --from-file, --from-dir, or --from-repo flags. The contents get streamed to the build and override the current build source settings β like, fully take over. When you're using --from-repo, the --commit flag lets you control which branch, tag, or commit gets sent to the server. And if you pass --from-file, that file gets placed in the root of an empty directory with the same filename. ngl that's kind of iconic π¦
You can also pass a http or https url to --from-file and --from-archive β but (and this is the important part, don't skip it) authentication is not supported, and for https the certificate must be valid and recognized by your system. No cap, don't come crying to me if your cert is expired π
Heads up: builds triggered from binary input will not preserve the source on the server. So rebuilds triggered by base image changes will use the source specified on the build config. Lowkey important. Remember it π«Ά
π OPTIONS
--allow-missing-template-keysβ defaulttrue. If true, ignore any errors in templates when a field or map key is missing in the template. Only applies togolangandjsonpathoutput formats.--build-argβ default[]. Specify a key-value pair to pass to Docker during the build.--build-loglevelβ default"". Specify the log level for the build log output.--commitβ default"". Specify the source code commit identifier the build should use; requires a build based on a Git repository.-e,--envβ default[]. Specify a key-value pair for an environment variable to set for the build container.--excludeβ default(^|/)\.git(/|$). When using the--from-diroption: regular expression for selecting files from the source tree to exclude from the build; the default excludes the'.git'directory (see β¨https://golang.org/pkg/regexpβ© for syntax, but note that""will be interpreted as allow all files and exclude no files). Yes, empty string means everything gets in, so be careful π«£-F,--followβ defaultfalse. Start a build and watch its logs until it completes or fails. Main character energy π--from-archiveβ default"". An archive (tar,tar.gz,zip) to be extracted before the build and used as the binary input.--from-buildβ default"". Specify the name of a build which should be re-run.--from-dirβ default"". A directory to archive and use as the binary input for a build.--from-fileβ default"". A file to use as the binary input for the build; example apom.xmlorDockerfile. Will be the only file in the build source.--from-repoβ default"". The path to a local source code repository to use as the binary input for a build.--from-webhookβ default"". Specify a generic webhook URL for an existing build config to trigger.--git-post-receiveβ default"". The contents of the post-receive hook to trigger a build.--git-repositoryβ default"". The path to the git repository for post-receive; defaults to the current directory.--incrementalβ defaultfalse. Overrides the incremental setting in a source-strategy build, ignored if not specified.--list-webhooksβ default"". List the webhooks for the specified build config or build; accepts'all','generic', or'github'.--no-cacheβ defaultfalse. Overrides the noCache setting in a docker-strategy build, ignored if not specified.-o,--outputβ default"". Output format. One of: (json,yaml,kyaml,name,go-template,go-template-file,template,templatefile,jsonpath,jsonpath-as-json,jsonpath-file).--show-managed-fieldsβ defaultfalse. If true, keep the managedFields when printing objects in JSON or YAML format.--templateβ default"". Template string or path to template file to use when-o=go-template,-o=go-template-file. The template format is golang templates [ β¨http://golang.org/pkg/text/template/#pkg-overviewβ© ].-w,--waitβ defaultfalse. Wait for a build to complete and exit with a non-zero return code if the build fails. Fr fr, it will exit non-zero if things go sideways π
π«Ά OPTIONS INHERITED FROM PARENT COMMANDS
These are the ones your oc parent command already had, and they got passed down like a family heirloom π
--asβ default"". Username to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-groupβ default[]. Group to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uidβ default"". UID to impersonate for the operation.--as-user-extraβ default[]. User extras to impersonate for the operation, this flag can be repeated to specify multiple values for the same key.--cache-dirβ default/homeless-shelter/.kube/cache. Default cache directory.--certificate-authorityβ default"". Path to a cert file for the certificate authority.--client-certificateβ default"". Path to a client certificate file for TLS.--client-keyβ default"". Path to a client key file for TLS.--clusterβ default"". The name of the kubeconfig cluster to use.--contextβ default"". The name of the kubeconfig context to use.--disable-compressionβ defaultfalse. If true, opt-out of response compression for all requests to the server.--insecure-skip-tls-verifyβ defaultfalse. If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. β οΈ Like, actually insecure. You've been warned.--kubeconfigβ default"". Path to the kubeconfig file to use for CLI requests.--kubercβ default"". Path to the kuberc file to use for preferences. This can be disabled by exportingKUBECTL_KUBERC=falsefeature gate or turning off the featureKUBERC=off.--match-server-versionβ defaultfalse. Require server version to match client version.-n,--namespaceβ default"". If present, the namespace scope for this CLI request.--profileβ defaultnone. Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex).--profile-outputβ defaultprofile.pprof. Name of the file to write the profile to.--request-timeoutβ default0. The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g.1s,2m,3h). A value of zero means don't timeout requests.-s,--serverβ default"". The address and port of the Kubernetes API server.--tls-server-nameβ default"". Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used.--tokenβ default"". Bearer token for authentication to the API server.--userβ default"". The name of the kubeconfig user to use.--warnings-as-errorsβ defaultfalse. Treat warnings received from the server as errors and exit with a non-zero exit code.
π¦ EXAMPLE
Here's the part where it all clicks, bestie π§
# Starts build from build config "hello-world"
oc start-build hello-world
# Starts build from a previous build "hello-world-1"
oc start-build --from-build=hello-world-1
# Use the contents of a directory as build input
oc start-build hello-world --from-dir=src/
# Send the contents of a Git repository to the server from tag 'v2'
oc start-build hello-world --from-repo=../hello-world --commit=v2
# Start a new build for build config "hello-world" and watch the logs until the build
# completes or fails
oc start-build hello-world --follow
# Start a new build for build config "hello-world" and wait until the build completes. It
# exits with a non-zero return code if the build fails
oc start-build hello-world --wait
π SEE ALSO
β HISTORY
June 2016, Ported from the Kubernetes man-doc generator.
Okay that's the whole page π slay. Quick sign-off so you know where this came from: it's the Openshift CLI User Manuals version of this page (the Openshift source line at the bottom), from June 2016 β that's all the footer said, so that's all I'm giving you π Bye bestie, go start some builds! π¦
π¦ where this page comes from
- nixpkgs unstable: openshift 4.22.0-202605222050
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms