OpenShift Build Operations: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 11: Line 11:
=Create a Build Configuration=
=Create a Build Configuration=


  [[oc new-build]] --binary=true --name=some-binary -i=redhat-openjdk18-openshift
==Source Build==
 
  [[oc new-build]]


Create a build configuration based on source code in the current git repository.
Create a build configuration based on source code in the current git repository.


Options:
==Binary Build==
 
[[oc new-build]] --binary=true --name=some-binary -i=redhat-openjdk18-openshift


* --binary=true makes sure that restrictions associated with binary builds are enforced.
--binary=true makes sure that restrictions associated with binary builds are enforced.


==Source Clone Secret==
==Source Clone Secret==

Revision as of 18:06, 25 November 2017

Internal

Overview

Builds

Create a Build Configuration

Source Build

oc new-build

Create a build configuration based on source code in the current git repository.

Binary Build

oc new-build --binary=true --name=some-binary -i=redhat-openjdk18-openshift

--binary=true makes sure that restrictions associated with binary builds are enforced.

Source Clone Secret

oc set build-secret --source bc/<build-configuration-name'> <secret-name>

Then the secret can be added to the build configuration:

oc new-build .../example.git --build-secret <secret-name>

Manually Start the Build Process

 oc start-build <buildConfig-name>

The name of a previous build can be specified - it will be used as a starting point.

Options:

  • --from-file
  • --from-dir
  • --from-repo
  • --from-archive

View Builds for Project

oc get builds
NAME          TYPE      FROM          STATUS                    STARTED             DURATION
bookstore-1   Source    Git@ad0abda   Failed (AssembleFailed)   About an hour ago   2m43s
bookstore-2   Source    Git@ad0abda   Failed (AssembleFailed)   12 minutes ago      2m16s

Each build has an associated build pod, whose names can be obtained with:

oc get pods
NAME                      READY     STATUS    RESTARTS   AGE
bookstore-1-build         0/1       Error     0          57m
bookstore-2-build         0/1       Error     0          13m

View Build Logs

View build logs associated with a build object:

oc logs [-f] builds/<build-name>

If -f|--follow is used, it specifies that the logs should be streamed.

Viewing the build logs in this manner is similar to following the build pod's logs.

Stop a Build in Progress

oc cancel-build

Delete a Build

oc delete build/<build-name> 

where the build name is among those returned by oc get builds.

Build and Deploy a JEE Application

Build and Deploy a JEE Application