Jenkins Slave that enables various container and image management capabilities and is optimized for deployment to a Jenkins instance running in the OpenShift Container Platform.
Skopeo - A command utility for various operations on container images and image repositories.
A template is available providing the necessary OpenShift components to build and make the slave image available to be referenced by Jenkins.
Execute the following command to instantiate the template:
oc process -f ../../.openshift/templates/jenkins-slave-image-mgmt-template.yml | oc apply -f-
A new image build will be started automatically
The template contains an ImageStream that has been configured with the appropriate labels that will be picked up by newly deployed Jenkins instances.
For existing Jenkins servers, the slave can be added by using the following steps.
- Login to Jenkins
- Click on Manage Jenkins and then Configure System
- Under the Cloud section, locate the Kubernetes Plugin. Click the Add Pod Template dropdown and select **
- Enter the following details
- Name: jenkins-slave-image-mgmt
- Labels: jenkins-slave-image-mgmt
- Docker image
- Using the
oc
command line, runoc get is jenkins-slave-image-mgmt --template='{{ .status.dockerImageRepository }}'
. A value similar to 172.30.186.87:5000/jenkins/jenkins-slave-image-mgmt should be used
- Using the
- Jenkins slave root directory:
/tmp
- Click Save to apply the changes
The following provides an example of how to make use of the image within a Jenkins pipeline script to execute the inspect function of the skopeo command line tool:
node('jenkins-slave-image-mgmt') {
stage('Inspect Image') {
sh """
set +x
skopeo inspect docker://docker.io/fedora
"""
}
}