OpenShift Pipeline
OpenShift Jenkins Client Plug-in
The must be installed on your Jenkins master so the OpenShift DSL will be available to use within the JenkinsFile for your application. This plug-in is installed and enabled by default when using the OpenShift Jenkins image.
For more information about installing and configuring this plug-in, see Configuring Pipeline Execution.
The OpenShift Jenkins Client Plug-in provides a fluent-styled DSL for communicating with the OpenShift API from within the Jenkins slaves. The OpenShift DSL is based on Groovy syntax and provides methods for controlling the lifecycle of your application such as create, build, deploy, and delete.
The full details of the API are embedded within the plug-in’s online documentation within a running Jenkins instance. To find it:
Create a new Pipeline Item.
Click Pipeline Syntax below the DSL text area.
In order to take advantage of the OpenShift Pipelines within your project, you will must use the . This strategy defaults to using a at the root of your source repository, but also provides the following configuration options:
A
jenkinsfilePath
field within your BuildConfig that references the location of thejenkinsfile
to use relative to the sourcecontextDir
.
For more detailed information about the Jenkins Pipeline Strategy, see Pipeline Strategy Options.
Jenkinsfile
The jenkinsfile
utilizes the standard groovy language syntax to allow fine grained control over the configuration, build, and deployment of your application.
The jenkinsfile
can be supplied in one of the following ways:
A file located within your source code repository.
Embedded as part of your build configuration using the
jenkinsfile
field.
When using the first option, the jenkinsfile
must be included in your applications source code repository at one of the following locations:
A file name specified via the
jenkinsfilePath
field of theJenkinsPiplineStrategy
section of your BuildConfig, which is relative to the sourcecontextDir
if supplied, otherwise it defaults to the root of the repository.
The jenkinsfile
is executed on the Jenkins slave pod, which must have the OpenShift Client binaries available if you intend to use the OpenShift DSL.
For a full walkthrough of building and deploying an application with Jenkins Pipeline, see Jenkins Pipeline Tutorial.
Advanced Topics
When a Pipeline build configuration is created, OpenShift checks to see if there is currently a Jenkins master pod provisioned in the current project. If no Jenkins master is found, one is automatically created. If this behavior is not desirable, or if you would like to use a Jenkins server external to OpenShift, you can disable it.
See Configuring Pipeline Execution for more information.
The is also pre-installed in the official Jenkins image. This plug-in allows the Jenkins master to create slave pods on OpenShift and delegate running jobs to them to achieve scalability as well as providing pods with specific runtimes for specific jobs.
For more detailed information on configuring slave pods using the Kubernetes Plug-in, see Kubernetes Plug-in.