Creating a Jenkins z/OS image stream

You must create an internal OpenShift® Jenkins image stream that is based on the OpenShift Jenkins internal registry image. To do so, you can use S2I (Source-To-Image). The Jenkins custom image will then contain a consistent set of Jenkins plug-ins (such as the git, artifactory, and durable-task plug-ins) that are needed for z/OS® builds. It also allows to set the minimal required version of some plug-ins. For more information on how OpenShift build works, see Creating build inputs in the OpenShift Container Platform documentation.

To create a Jenkins image stream, you must run the following three steps:

  1. Install the required plug-ins.

    To build z/OS applications with Jenkins, you need some required plug-ins that are not installed by default in the OpenShift Jenkins image. Using S2I, you must create a folder. You can name it s2i for example. In this folder, create a file named plugins.txt with the following contents:

    git
    git-client
    durable-task
    artifactory
    openshift-sync:1.0.45
    ssh-slaves:1.31.5

    Note: The versions of the plugins might vary depending on your OpenShift version. If you work with a recent OpenShift version, you might need to indicate later versions of the plugins. The minimal versions of the plugins are the following ones:

    git:4.2.2
    git-client:3.4.2
    durable-task:1.34
    artifactory:3.7.0
    openshift-sync:1.0.45
    ssh-slaves:1.31.5
  2. Create an OpenShift build configuration and image stream.

    You must create an OpenShift build configuration and image stream to produce the Jenkins image stream that you will use later to create your Jenkins instance. To build the jenkins-zos:latest image, create an OpenShift build configuration file, jenkins-build-image.yaml for example, with the following contents:

    kind: ImageStream
    apiVersion: image.openshift.io/v1
    metadata:
      name: jenkins-zos
    ---
    kind: BuildConfig
    apiVersion: build.openshift.io/v1
    metadata:
      name: jenkins-build-pipeline
      labels:
        build: jenkins-build-pipeline
    spec:
      output:
        to:
          kind: ImageStreamTag
          name: 'jenkins-zos:latest'
      strategy:
        type: Source
        sourceStrategy:
          from:
            kind: ImageStreamTag
            namespace: openshift
            name: 'jenkins:2'
      source:
        type: Binary
  3. Implement the build that generates the Jenkins image stream.

    You must create a build to generate the z/OS Jenkins image stream that you will reuse later.
    To do so, enter the following commands to create the image stream using the oc client in the OpenShift Jenkins namespace, which is named jenkins in the following example.

    1. Create the namespace.

      oc create namespace jenkins
    2. Create the build configuration in OpenShift.

      oc apply -f jenkins-build-image.yaml -n jenkins
    3. Start the build to create the image stream.

      oc  start-build jenkins-build-pipeline --from-dir=./s2i --wait -n jenkins

You can follow the build in the OpenShift web console, as shown in the following screen capture:

The Jenkins build displayed in the OpenShift console

At this stage, you have a Jenkins image stream in the jenkins namespace. This image stream is ready to be used for z/OS development.

In the next steps, you will create a Jenkins instance in OpenShift from the image stream that you created.