table of contents
OC(1) | June 2016 | OC(1) |
NAME¶
oc new-build - Create a new build configuration
SYNOPSIS¶
oc new-build [OPTIONS]
DESCRIPTION¶
Create a new build by specifying source code.
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.
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, indicates that referenced container images that cannot be found
locally or in a registry should still be used.
--allow-missing-imagestream-tags=false
If true, indicates that 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 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, indicates that 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, 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.
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.
--cache-dir="/home/abuild/.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.
--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
Openshift CLI User Manuals | Openshift |