OpenShift Plugin for Jenkins (jenkins-plugin)

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

External

Internal

Overview

This is the oldest Jenkins/OpenShift integration plugin, which executes inside Jenkins and implements a series of REST flows that interface with the OpenShift master server via its exposed API. This plugin does not require the oc binary to be present on the host that executes the plugin logic. Other plugin that may be used starting with OpenShift 3.7 is OpenShift Jenkins Pipeline DSL Plugin (jenkins-client-plugin). The "OpenShift Plugin for Jenkins" is currently in maintenance mode.

Pipeline Examples

Pipeline DSL

The pipeline can be scripted or can be specified in a declarative format. A scripted DSL element looks like this:

openshiftBuild(buildConfig: 'something')

A declared DSL element looks like this:

openshiftBuild bldCfg: 'something', verbose: 'true', ...

Optional configuration parameter that apply to all DSL steps are:

  • 'apiURL' - the URL of the OpenShift API endpoint. If nothing is specified, the plugin will inspect KUBERNETES_SERVICE_HOST environment variable and if the variable is not set, the default is "https://openshift.default.svc.cluster.local" See Master API.
  • 'namespace' - the name of the project the objects the DSL refers to are stored in. If nothing is specified, the plugin will inspect PROJECT_NAME environment variable.
  • 'authToken'
  • 'verbose' - for verbose logging.

Pipeline DSL Example

https://github.com/NovaOrdis/playground/blob/master/openshift/jenkins-plugin/Jenkinsfile-jenkins-plugin-DSL.groovy

openshiftBuild

https://github.com/openshift/jenkins-plugin#trigger-openshift-build

Trigger a build based on the specified build configuration. Equivalent with oc start-build.

openshiftBuild bldCfg: 'name_of_the_BuildConfig_to_start'

openshiftDeploy

https://github.com/openshift/jenkins-plugin#trigger-openshift-deployment

Trigger a deployment based on the specified deployment configuration.

openshiftDeploy depCfg: 'name_of_the_DeployConfig_to_start'

openshiftExec

https://github.com/openshift/jenkins-plugin#run-openshift-exec

Run a command in a pod.

openshiftExec pod: 'name_of_the_pod', command: '...'

openshiftCreateResource

https://github.com/openshift/jenkins-plugin#create-openshift-resources

Run a command in a pod.

openshiftExec json|yaml|jsonyaml: '...'

openshiftDeleteResourceByJsonYaml

https://github.com/openshift/jenkins-plugin#delete-openshift-resources-from-jsonyaml

openshiftDeleteResourceByLabels

https://github.com/openshift/jenkins-plugin#delete-openshift-resources-using-labels

openshiftDeleteResourceByKey

https://github.com/openshift/jenkins-plugin#delete-openshift-resources-by-key

openshiftScale

https://github.com/openshift/jenkins-plugin#scale-openshift-deployment

openshiftTag

https://github.com/openshift/jenkins-plugin#tag-openshift-image

openshiftVerifyBuild

https://github.com/openshift/jenkins-plugin#verify-openshift-build

openshiftVerifyDeployment

https://github.com/openshift/jenkins-plugin#verify-openshift-deployment

openshiftVerifyService

https://github.com/openshift/jenkins-plugin#verify-openshift-service

openshiftImageStream

https://github.com/openshift/jenkins-plugin#imagestreams-scm