Skip to content

Commit

Permalink
Merge pull request #827 from gabemontero/toggle-slave-images-by-clust…
Browse files Browse the repository at this point in the history
…er-version

adjust agent config based on cluster version; augment readme around r…
  • Loading branch information
openshift-merge-robot authored Mar 28, 2019
2 parents 4fa7769 + 8e9f28e commit 85b0254
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
19 changes: 19 additions & 0 deletions 2/contrib/jenkins/kube-slave-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,25 @@ if [[ `grep CentOS /etc/redhat-release` ]]; then
NODEJS_SLAVE=${NODEJS_SLAVE_IMAGE:-openshift/jenkins-agent-nodejs-8-centos7:${JENKINS_SLAVE_IMAGE_TAG}}
MAVEN_SLAVE=${MAVEN_SLAVE_IMAGE:-openshift/jenkins-agent-maven-35-centos7:${JENKINS_SLAVE_IMAGE_TAG}}
fi
# if the master is running the rhel image, but we are on a pre-3.11 cluster, use the non-TBR images.
if [[ `grep Enterprise /etc/redhat-release` ]]; then
versions=`oc version`
echo "OpenShift client and server versions are ${versions}"
countForInPodCheck=`echo $versions | awk -F"v3" '{print NF-1}'`
# if 2 instance of 'v3', then we are running in a pre3.11 pod;
# in the 3.11 image `oc`, the server version reporting only lists kubernetes 1.11
if [ "${countForInPodCheck}" -eq "2" ]; then
NODEJS_SLAVE=${NODEJS_SLAVE_IMAGE:-registry.access.redhat.com/openshift3/jenkins-agent-nodejs-8-rhel7:${JENKINS_SLAVE_IMAGE_TAG}}
MAVEN_SLAVE=${MAVEN_SLAVE_IMAGE:-registry.access.redhat.com/openshift3/jenkins-agent-maven-35-rhel7:${JENKINS_SLAVE_IMAGE_TAG}}
fi
countForV311Check=`echo $versions | awk -F"v3.11" '{print NF-1}'`
# the very latest `oc` from origin/release-3.11 does have two v3.11 lines;
# reset back if the jenkins 3.11 image ever picks up this level of `oc`
if [ "${countForInPodCheck}" -eq "2" ]; then
NODEJS_SLAVE=${NODEJS_SLAVE_IMAGE:-registry.redhat.io/openshift3/jenkins-agent-nodejs-8-rhel7:${JENKINS_SLAVE_IMAGE_TAG}}
MAVEN_SLAVE=${MAVEN_SLAVE_IMAGE:-registry.redhat.io/openshift3/jenkins-agent-maven-35-rhel7:${JENKINS_SLAVE_IMAGE_TAG}}
fi
fi

JENKINS_SERVICE_NAME=${JENKINS_SERVICE_NAME:-JENKINS}
JENKINS_SERVICE_NAME=`echo ${JENKINS_SERVICE_NAME} | tr '[a-z]' '[A-Z]' | tr '-' '_'`
Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ Choose either the CentOS7 or RHEL7 based image:
$ make build TARGET=rhel7 VERSION=2
```
Also note, as of 3.11, the RHEL images are hosted at registry.redhat.io as well. This is the terms based
registry and requires credentials for access. See [Transitioning the Red Hat container registry](https://www.redhat.com/en/blog/transitioning-red-hat-container-registry) for details:
* registry.redhat.io/openshift3/jenkins-2-rhel7:v3.11
* registry.redhat.io/openshift3/jenkins-agent-nodejs-8-rhel7:v3.11
* registry.redhat.io/openshift3/jenkins-agent-maven-35-rhel7:v3.11
* registry.redhat.io/openshift3/jenkins-slave-base-rhel7:v3.11
The openshift cluster install for 3.11 will insure that credentials are provided and subsequently available on the nodes
in the cluster to facilitate image pulling.
* **CentOS7 based image**
The images are available on DockerHub. An example download command is:
Expand Down Expand Up @@ -148,6 +158,17 @@ your nodes depending when the images were pulled. Starting with the 3.7 release
in the future. But if you started using this image prior to 3.7, verification of your Kubernetes plugin configurations for the image pull
policy used is warranted to guarantee consistency around what image is being used on each of your nodes.
Jenkins security advisories, the "master" image from this repository, and the `oc` binary
---------------------------------
Any security advisory related updates to Jenkins core or the plugins we include in the OpenShift Jenkins master image will only occur in the v3.11 and v4.x branches of this repository.
We do support running the v3.11 version of the master image against older v3.x (as far back as v3.4) OpenShift clusters if you want to pick up Jenkins security advisory updates. Per the prior section, we advise that you import a version of `oc` into your Jenkins installation that matches your OpenShift cluster via the "Global Tool Configuration" option in Jenkins either via the UI, CLI, or groovy init scripts.
Our OpenShift Client Plugin has some documentation on doing this [here](https://github.com/openshift/jenkins-client-plugin#setting-up-jenkins-nodes).
Also note for the RHEL image, the v3.11 image examines whether it is running in an OpenShift Pod and what version the cluster is at. If the cluster is at a version prior to v3.11, the Maven and NodeJS agent example configuration for the kubernetes plugin will point to registry.access.redhat.com for
the image setting. If the cluster is at v3.11, the image setting will point to the terms based registry at registry.access.io.
Plugins
---------------------------------
Expand Down

0 comments on commit 85b0254

Please sign in to comment.