OC(1)

πŸ“¦
version 4.22.0 Β· 2 versions
, in nixpkgs unstable

πŸ’– NAME πŸ’–

bestie, welcome to the OC(1) page: this is all about oc new-build β€” create a new build configuration ✨. Yes, the OC(1) manual-page girlies are in the Openshift CLI User Manuals, dated June 2016, and we are absolutely getting into it πŸ’….


πŸ¦‹ SYNOPSIS πŸ¦‹

oc new-build [OPTIONS]

✨ DESCRIPTION ✨

okay so oc new-build creates a new build by specifying source code. It’s giving β€œplease make me a build configuration” energy πŸ’–. This command will try to create a build configuration for your application using images and code that has a public repository. It will look up the images on the local container storage (if available), a container image registry, or an image stream.

If you specify a source code URL, it will set up a build that takes your source code and converts it into an image that can run inside of a pod. Local source must be in a git repository that has a remote repository that the server can see β€” no hidden-remote nonsense, bestie πŸ‘€.

Once the build configuration is created, a new build will be automatically triggered. You can use '%[1]s status' to check the progress 🫢.


πŸŽ€ OPTIONS πŸŽ€

  • --allow-missing-images=false β€” if true, it means referenced container images that cannot be found locally or in a registry should still be used.
  • --allow-missing-imagestream-tags=false β€” if true, it means image stream tags that don’t exist should still be used.
  • --allow-missing-template-keys=true β€” if true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
  • --binary=false β€” instead of expecting a source URL, set the build to expect binary contents. Will disable triggers.
  • --build-arg=[] β€” specify a key-value pair to pass to Docker during the build.
  • --build-config-map=[] β€” ConfigMap and destination to use as an input for the build.
  • --build-secret=[] β€” Secret and destination to use as an input for the build.
  • --code=[] β€” source code in the build configuration.
  • --context-dir="" β€” context directory to be used for the build.
  • -D, --dockerfile="" β€” specify the contents of a Dockerfile to build directly, implies --strategy=docker. Pass '-' to read from STDIN.
  • --dry-run=false β€” if true, show the result of the operation without performing it.
  • -e, --env=[] β€” specify a key-value pair for an environment variable to set into resulting image.
  • --env-file=[] β€” file containing key-value pairs of environment variables to set into each container.
  • --image=[] β€” name of a container image to use as a builder.
  • -i, --image-stream=[] β€” name of an image stream to use as a builder.
  • --import-mode="" β€” imports the full manifest list of a tag when set to 'PreserveOriginal'. Defaults to 'Legacy'.
  • --insecure-registry=false β€” if true, it means the referenced container images are on insecure registries and should bypass certificate checking.
  • -l, --labels="" β€” label to set in all generated resources.
  • --name="" β€” set name to use for generated build artifacts.
  • --no-output=false β€” if true, the build output will not be pushed anywhere.
  • -o, --output="" β€” output format. One of: (json, yaml, kyaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
  • --output-version="" β€” the preferred API versions of the output objects.
  • --push-secret="" β€” the name of an existing secret that should be used for pushing the output image.
  • -a, --show-all=false β€” when printing, show all resources (default hide terminated pods.)
  • --show-labels=false β€” when printing, show all labels as the last column (default hide labels column)
  • --show-managed-fields=false β€” if true, keep the managedFields when printing objects in JSON or YAML format.
  • --source-image="" β€” specify an image to use as source for the build. You must also specify --source-image-path.
  • --source-image-path="" β€” specify the file or directory to copy from the source image and its destination in the build directory. Format: [source]:[destination-dir].
  • --source-secret="" β€” the name of an existing secret that should be used for cloning a private git repository.
  • --strategy= β€” specify the build strategy to use if you don’t want to detect (docker|pipeline|source). NOTICE: the pipeline strategy is deprecated; consider using Jenkinsfiles directly on Jenkins or OpenShift Pipelines. 🫠
  • --template="" β€” 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].
  • --to="" β€” push built images to this image stream tag (or container image repository if --to-docker is set).
  • --to-docker=false β€” if true, have the build output push to a Docker repository.
bestie, quick reminder: --source-image is a package deal β€” you also need --source-image-path, no cap πŸ’….

🌈 OPTIONS INHERITED FROM PARENT COMMANDS 🌈

  • --as="" β€” username to impersonate for the operation. User could be a regular user or a service account in a namespace.
  • --as-group=[] β€” group to impersonate for the operation; this flag can be repeated to specify multiple groups.
  • --as-uid="" β€” UID to impersonate for the operation.
  • --as-user-extra=[] β€” user extras to impersonate for the operation; this flag can be repeated to specify multiple values for the same key.
  • --cache-dir="/homeless-shelter/.kube/cache" β€” default cache directory.
  • --certificate-authority="" β€” path to a cert file for the certificate authority.
  • --client-certificate="" β€” path to a client certificate file for TLS.
  • --client-key="" β€” path to a client key file for TLS.
  • --cluster="" β€” the name of the kubeconfig cluster to use.
  • --context="" β€” the name of the kubeconfig context to use.
  • --disable-compression=false β€” if true, opt-out of response compression for all requests to the server.
  • --insecure-skip-tls-verify=false β€” if true, the server’s certificate will not be checked for validity. This will make your HTTPS connections insecure 😭.
  • --kubeconfig="" β€” path to the kubeconfig file to use for CLI requests.
  • --kuberc="" β€” path to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.
  • --match-server-version=false β€” require server version to match client version.
  • -n, --namespace="" β€” if present, the namespace scope for this CLI request.
  • --profile="none" β€” name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex).
  • --profile-output="profile.pprof" β€” name of the file to write the profile to.
  • --request-timeout="0" β€” 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="" β€” the address and port of the Kubernetes API server.
  • --tls-server-name="" β€” server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used.
  • --token="" β€” bearer token for authentication to the API server.
  • --user="" β€” the name of the kubeconfig user to use.
  • --warnings-as-errors=false β€” treat warnings received from the server as errors and exit with a non-zero exit code.

🌸 EXAMPLE 🌸

# Create a build config based on the source code in the current git repository (with a public
# remote) and a container image
oc new-build . --image=repo/langimage

# Create a NodeJS build config based on the provided [image] [source code] combination
oc new-build centos/nodejs-8-centos7 https://github.com/sclorg/nodejs-ex.git

# Create a build config from a remote repository using its beta2 branch
oc new-build https://github.com/openshift/ruby-hello-world#beta2

# Create a build config using a Dockerfile specified as an argument
oc new-build -D $'FROM centos:7\nRUN yum install -y httpd'

# Create a build config from a remote repository and add custom environment variables
oc new-build https://github.com/openshift/ruby-hello-world -e RACK_ENV=development

# Create a build config from a remote private repository and specify which existing secret to use
oc new-build https://github.com/youruser/yourgitrepo --source-secret=yoursecret

# Create a build config using  an image with the full manifest list to create an app and override application artifacts' names
oc new-build --image=myregistry.com/mycompany/image --name=private --import-mode=PreserveOriginal

# Create a build config from a remote repository and inject the npmrc into a build
oc new-build https://github.com/openshift/ruby-hello-world --build-secret npmrc:.npmrc

# Create a build config from a remote repository and inject environment data into a build
oc new-build https://github.com/openshift/ruby-hello-world --build-config-map env:config

# Create a build config that gets its input from a remote repository and another container image
oc new-build https://github.com/openshift/ruby-hello-world --source-image=openshift/jenkins-1-centos7 --source-image-path=/var/lib/jenkins:tmp

πŸ‘€ SEE ALSO πŸ‘€


🧚 HISTORY 🧚

June 2016, ported from the Kubernetes man-doc generator β€” iconic origin story, honestly πŸŽ€.


later, bestie 🫢 β€” footer/source/version moment: Openshift Β· Openshift CLI User Manuals Β· date June 2016 Β· page OC(1) πŸ’…βœ¨

πŸ“¦ where this page comes from