This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.Questo contenuto non è disponibile nella lingua selezionata.
Chapter 3. Builds and Images
3.1. BuildConfigs Copia collegamentoCollegamento copiato negli appunti!
3.1.1. Description of Resource Copia collegamentoCollegamento copiato negli appunti!
Build configurations define a build process for new Docker images. There are three types of builds possible - a Docker build using a Dockerfile, a Source-to-Image build that uses a specially prepared base image that accepts source code that it can make runnable, and a custom build that can run arbitrary Docker images as a base and accept the build parameters. Builds run on the cluster and on completion are pushed to the Docker registry specified in the "output" section. A build can be triggered via a webhook, when the base image changes, or when a user manually requests a new build be created.
Each build created by a build configuration is numbered and refers back to its parent configuration. Multiple builds can be triggered at once. Builds that do not have "output" set can be used to test code or run a verification build.
3.1.2. Creating a New BuildConfig Copia collegamentoCollegamento copiato negli appunti!
3.1.2.1. Request Breakdown Copia collegamentoCollegamento copiato negli appunti!
Creating a new buildconfig requires one request:
-
A POST request to the
buildconfigssubresource of the namespace.
The POST request uses a BuildConfig configuration in the request body. The following example uses a BuildConfig for the Jboss Developer kitchensink quickstart found at https://github.com/jboss-developer/jboss-eap-quickstarts.
3.1.2.2. POST Request to Create a New BuildConfig Copia collegamentoCollegamento copiato negli appunti!
Request Header
Request Body
3.1.3. Listing All BuildConfigs in an Environment Copia collegamentoCollegamento copiato negli appunti!
3.1.3.1. Request Breakdown Copia collegamentoCollegamento copiato negli appunti!
Listing all the buildconfigs in an environment requires one request:
-
A GET request to the
buildconfigsresource.
The GET request returns the BuildConfigList, listing the details of all buildconfigs in the environment.
3.1.3.2. GET Request to Return All BuildConfigs in an Environment Copia collegamentoCollegamento copiato negli appunti!
Request Header
3.1.4. Listing all BuildConfigs in a Namespace Copia collegamentoCollegamento copiato negli appunti!
3.1.4.1. Request Breakdown Copia collegamentoCollegamento copiato negli appunti!
Listing all the buildconfigs in a namespace requires one request:
-
A GET request to the
buildconfigssubresource of the namespace.
The GET request returns the BuildConfigList, listing the details of all buildconfigs in the namespace.
3.1.4.2. GET Request to Return BuildConfigs in Namespace Copia collegamentoCollegamento copiato negli appunti!
Request Header
3.1.5. Listing a Specific BuildConfig Configuration Copia collegamentoCollegamento copiato negli appunti!
3.1.5.1. Request Breakdown Copia collegamentoCollegamento copiato negli appunti!
Listing a specific buildconfig configuration requires one request:
-
A GET request to the buildconfig name in the
buildconfigssubresource of the namespace.
The GET request returns the BuildConfig configuration for the specified build.
3.1.5.2. GET Request to Return Specific BuildConfig Configuration Copia collegamentoCollegamento copiato negli appunti!
Request Header
3.1.6. Deleting a BuildConfig Copia collegamentoCollegamento copiato negli appunti!
3.1.6.1. Request Breakdown Copia collegamentoCollegamento copiato negli appunti!
Deleting a buildconfig requires one request:
-
A DELETE request to the buildconfig name in the
buildconfigssubresource of the namespace.
The DELETE request returns a code: 200 and the buildconfig is deleted.
3.1.6.2. DELETE Request to Delete BuildConfig Copia collegamentoCollegamento copiato negli appunti!
Request Header
3.2. Builds Copia collegamentoCollegamento copiato negli appunti!
3.2.1. Description of Resource Copia collegamentoCollegamento copiato negli appunti!
A build is the process of transforming input parameters into a resulting object. Most often, the process is used to transform input parameters or source code into a runnable image. A BuildConfig object is the definition of the entire build process.
3.2.2. Listing All Builds in an Environment Copia collegamentoCollegamento copiato negli appunti!
3.2.2.1. Request Breakdown Copia collegamentoCollegamento copiato negli appunti!
Listing all the builds in an environment requires one request:
-
A GET request to the
buildsresource.
The GET request returns the BuildList, listing the details of all builds in the environment.
3.2.2.2. GET Request to Return All Builds in an Environment Copia collegamentoCollegamento copiato negli appunti!
Request Header
3.2.3. Listing all Builds in a Namespace Copia collegamentoCollegamento copiato negli appunti!
3.2.3.1. Request Breakdown Copia collegamentoCollegamento copiato negli appunti!
Listing all the builds in a namespace requires one request:
-
A GET request to the
buildssubresource of the namespace.
The GET request returns the BuildList, listing the details of all builds in the namespace.
3.2.3.2. GET Request to Return Builds in Namespace Copia collegamentoCollegamento copiato negli appunti!
Request Header
3.2.4. Listing a Specific Build Configuration Copia collegamentoCollegamento copiato negli appunti!
3.2.4.1. Request Breakdown Copia collegamentoCollegamento copiato negli appunti!
Listing a specific build configuration requires one request:
-
A GET request to the build name in the
buildssubresource of the namespace.
The GET request returns the Build configuration for the specified build.
3.2.4.2. GET Request to Return Specific Build Configuration Copia collegamentoCollegamento copiato negli appunti!
Request Header
3.2.5. Starting a Build Copia collegamentoCollegamento copiato negli appunti!
3.2.5.1. Request Breakdown Copia collegamentoCollegamento copiato negli appunti!
Starting a build requires one request:
-
A POST request to the
instantiatesubresource of theBuildConfigname.
The POST request returns a BuildConfig configuration.
3.2.5.2. POST Request to Start a Build Copia collegamentoCollegamento copiato negli appunti!
Request Header
Request Body
3.2.6. Cancelling a Build Copia collegamentoCollegamento copiato negli appunti!
3.2.6.1. Request Breakdown Copia collegamentoCollegamento copiato negli appunti!
Cancelling a build consists of two requests:
-
A GET request to the build name in the
buildssubresource of the namespace. -
A PUT request with an added
cancelledfield to the build name in thebuildssubresource of the namespace.
The GET request returns a Build configuration.
The GET request is optional if an updated Build configuration can otherwise be provided for the PUT request.
Include a spec: status: cancelled parameter with value true in the Build configuration. Send the updated configuration as the request body in a PUT request to the build name.
3.2.6.2. GET Request to Return Build Configuration Copia collegamentoCollegamento copiato negli appunti!
Request Header
3.2.6.3. PUT Request to Cancel a Build Copia collegamentoCollegamento copiato negli appunti!
Request Header
Request Body Snippet
...
spec:
status:
cancelled: "true"
...
...
spec:
status:
cancelled: "true"
...
3.2.7. Deleting a Build Copia collegamentoCollegamento copiato negli appunti!
3.2.7.1. Request Breakdown Copia collegamentoCollegamento copiato negli appunti!
Deleting a build requires one request:
-
A DELETE request to the build name in the
buildssubresource of the namespace.
The DELETE request returns a code: 200 and the build is deleted.
3.2.7.2. DELETE Request to Delete Build Copia collegamentoCollegamento copiato negli appunti!
Request Header
3.3. Images Copia collegamentoCollegamento copiato negli appunti!
3.3.1. Description of Resource Copia collegamentoCollegamento copiato negli appunti!
An image is a binary that includes all of the requirements for running a single container, as well as metadata describing its needs and capabilities.
3.3.2. Creating an Image Copia collegamentoCollegamento copiato negli appunti!
3.3.2.1. Request Breakdown Copia collegamentoCollegamento copiato negli appunti!
Creating a new image requires one request:
-
A POST request to the
imagessubresource of the namespace.
The POST request uses an Image configuration in the request body.
3.3.2.2. POST Request to Create a New Image Copia collegamentoCollegamento copiato negli appunti!
Request Header
Request Body
apiVersion: v1
kind: Image
metadata:
name: {$IMAGE}
dockerImageReference: registry.access.redhat.com/openshift3/jenkins-1-rhel7@sha256:9a370e38aca93da91bda03107f74fc245b169a8c642daf431a93289f44e187a0
apiVersion: v1
kind: Image
metadata:
name: {$IMAGE}
dockerImageReference: registry.access.redhat.com/openshift3/jenkins-1-rhel7@sha256:9a370e38aca93da91bda03107f74fc245b169a8c642daf431a93289f44e187a0
3.3.3. Listing All Images in a Cluster Copia collegamentoCollegamento copiato negli appunti!
3.3.3.1. Request Breakdown Copia collegamentoCollegamento copiato negli appunti!
Listing all the images in a cluster requires one request:
-
A GET request to the
imagesresource.
The GET request returns the ImageList, listing the details of all images in the cluster.
3.3.3.2. GET Request to Return All Images in a Cluster Copia collegamentoCollegamento copiato negli appunti!
Request Header
3.3.4. Listing a Specific Image Configuration Copia collegamentoCollegamento copiato negli appunti!
3.3.4.1. Request Breakdown Copia collegamentoCollegamento copiato negli appunti!
Listing a specific image configuration in a cluster requires one request:
-
A GET request to the
sha256:-prefixed image hash in theimagesresource.
The GET request returns the Image configuration for the specified image.
3.3.4.2. GET Request to Return Specific Image Configuration Copia collegamentoCollegamento copiato negli appunti!
Request Header
3.3.5. Deleting an Image Copia collegamentoCollegamento copiato negli appunti!
3.3.5.1. Request Breakdown Copia collegamentoCollegamento copiato negli appunti!
Deleting an Image requires one request:
-
A DELETE request to the
sha256:-prefixed image hash in theimagesresource.
The DELETE request returns a code: 200 and the Image is deleted.
3.3.5.2. DELETE Request to Delete Image Copia collegamentoCollegamento copiato negli appunti!
Request Header
3.4. Image Streams Copia collegamentoCollegamento copiato negli appunti!
3.4.1. Description of Resource Copia collegamentoCollegamento copiato negli appunti!
An ImageStream stores a mapping of tags to images, metadata overrides that are applied when images are tagged in a stream, and an optional reference to a Docker image repository on a registry.
3.4.2. Creating a New Image Stream Copia collegamentoCollegamento copiato negli appunti!
3.4.2.1. Request Breakdown Copia collegamentoCollegamento copiato negli appunti!
Creating a new image stream requires one request:
-
A POST request to the
imagestreamssubresource of the namespace.
The POST request uses an ImageStream configuration in the request body.
3.4.2.2. POST Request to Create a New Image Stream Copia collegamentoCollegamento copiato negli appunti!
Request Header
Request Body
3.4.3. Importing an Image Stream Copia collegamentoCollegamento copiato negli appunti!
3.4.3.1. Request Breakdown Copia collegamentoCollegamento copiato negli appunti!
Importing an image stream requires one request:
-
A POST request to the
imagestreamimportssubresource of the namespace.
The POST request uses an ImageStreamImport configuration in the request body.
The following example imports the ruby-23-rhel7:latest image into a namespace as a custom imagestream.
3.4.3.2. POST Request to Create a New Image Stream Copia collegamentoCollegamento copiato negli appunti!
Request Header
Request Body
3.4.4. Listing All Image Streams in a Cluster Copia collegamentoCollegamento copiato negli appunti!
3.4.4.1. Request Breakdown Copia collegamentoCollegamento copiato negli appunti!
Listing all the image streams in a cluster requires one request:
-
A GET request to the
imagestreamsresource.
The GET request returns the ImageStreamList, listing the details of all image streams in the cluster.
3.4.4.2. GET Request to Return All Image Streams in a Cluster Copia collegamentoCollegamento copiato negli appunti!
Request Header
3.4.5. Listing all Image Streams in a Namespace Copia collegamentoCollegamento copiato negli appunti!
3.4.5.1. Request Breakdown Copia collegamentoCollegamento copiato negli appunti!
Listing all the image streams in a namespace requires one request:
-
A GET request to the
imagestreamssubresource of the namespace.
The GET request returns the ImageStreamList, listing the details of all image streams in the namespace.
3.4.5.2. GET Request to Return Image Streams in Namespace Copia collegamentoCollegamento copiato negli appunti!
Request Header
3.4.6. Listing a Specific Image Stream Configuration Copia collegamentoCollegamento copiato negli appunti!
3.4.6.1. Request Breakdown Copia collegamentoCollegamento copiato negli appunti!
Listing a specific image stream configuration requires one request:
-
A GET request to the image stream name in the
imagestreamssubresource of the namespace.
The GET request returns the ImageStream configuration for the specified image stream.
3.4.6.2. GET Request to Return Specific Image Stream Configuration Copia collegamentoCollegamento copiato negli appunti!
Request Header
3.4.7. Deleting an Image Stream Copia collegamentoCollegamento copiato negli appunti!
3.4.7.1. Request Breakdown Copia collegamentoCollegamento copiato negli appunti!
Deleting a image stream requires one request:
-
A DELETE request to the image stream name in the
imagestreamssubresource of the namespace.
The DELETE request returns a code: 200 and the image stream is deleted.
3.4.7.2. DELETE Request to Delete Image Stream Copia collegamentoCollegamento copiato negli appunti!
Request Header
3.5. Image Stream Tags Copia collegamentoCollegamento copiato negli appunti!
3.5.1. Description of Resource Copia collegamentoCollegamento copiato negli appunti!
An ImageStreamTag represents an Image that is retrieved by tag name from an ImageStream.
3.5.2. Adding an Image Stream Tag Copia collegamentoCollegamento copiato negli appunti!
3.5.2.1. Request Breakdown Copia collegamentoCollegamento copiato negli appunti!
Adding a tag to an image stream requires one request:
-
A PUT request to the image stream tag name in the
imagestreamtagssubresource of the namespace.
The PUT request uses an ImageStreamTag configuration in the request body.
The following example adds an image stream tag to the default ruby image stream in the openshift namespace.
3.5.2.2. PUT Request to Add an Image Stream Tag Copia collegamentoCollegamento copiato negli appunti!
Request Header
Request Body
3.5.3. Deleting an Image Stream Tag Copia collegamentoCollegamento copiato negli appunti!
3.5.3.1. Request Breakdown Copia collegamentoCollegamento copiato negli appunti!
Deleting an image stream tag requires one request:
-
A DELETE request to the image stream tag name in the
imagestreamtagssubresource of the namespace.
The DELETE request returns a code: 200 and the image stream tag is deleted.
The following example deletes the image stream tag, added in the previous example, from the default ruby image stream in the openshift namespace.
3.5.3.2. DELETE Request to Delete Image Stream Tag Copia collegamentoCollegamento copiato negli appunti!
Request Header