Skip to content

Commit b835e06

Browse files
committed
Switch Jenkins image tracking to registry tag due to Samples Operator deprecation
Starting with OpenShift 4.13, the Cluster Samples Operator has been downsized and no longer provides updates for non-S2I images like Jenkins. The `latest` tracked tag was pointing to an image that hadn't been updated in over two years. This commit updates the image reference to follow the specific registry tag directly (registry.redhat.io/ocp-tools-4/jenkins-rhel9:v4.17.0), ensuring we get the latest maintained version going forward. To archive this we need to create our own ImageStreams for both the Jenkins base image and the Jenkins agent image, replacing the deprecated Samples Operator content. Signed-off-by: Renata Ravanelli <rravanel@redhat.com>
1 parent 4f828f2 commit b835e06

File tree

5 files changed

+62
-69
lines changed

5 files changed

+62
-69
lines changed

deploy

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def get_username():
4747

4848

4949
def process_template(args):
50-
templates = ['pipeline.yaml', 'jenkins-s2i.yaml']
50+
templates = ['pipeline.yaml', 'jenkins-images.yaml', 'jenkins-s2i.yaml']
5151

5252
params = {}
5353
if args.pipeline:
@@ -57,8 +57,6 @@ def process_template(args):
5757
params.update(params_from_git_refspec(args.pipecfg, 'PIPECFG'))
5858
if has_additional_root_ca(args):
5959
templates += ['jenkins-with-cert.yaml']
60-
params['JENKINS_S2I_SRC_IMAGESTREAM_NAME'] = "jenkins:latest"
61-
params['JENKINS_S2I_SRC_IMAGESTREAM_NAMESPACE'] = get_current_namespace(args)
6260

6361
print("Parameters:")
6462
for k, v in params.items():

manifests/jenkins-images.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
apiVersion: template.openshift.io/v1
2+
kind: Template
3+
metadata:
4+
name: jenkins-images-template
5+
objects:
6+
- apiVersion: image.openshift.io/v1
7+
kind: ImageStream
8+
metadata:
9+
name: jenkins-agent-base
10+
spec:
11+
tags:
12+
- name: upstream
13+
from:
14+
kind: DockerImage
15+
name: registry.redhat.io/ocp-tools-4/jenkins-agent-base-rhel9:v4.17.0
16+
importPolicy:
17+
scheduled: true
18+
referencePolicy:
19+
type: Local
20+
21+
- apiVersion: image.openshift.io/v1
22+
kind: ImageStream
23+
metadata:
24+
name: jenkins
25+
spec:
26+
tags:
27+
- name: upstream
28+
from:
29+
kind: DockerImage
30+
name: registry.redhat.io/ocp-tools-4/jenkins-rhel9:v4.17.0
31+
importPolicy:
32+
scheduled: true
33+
referencePolicy:
34+
type: Local

manifests/jenkins-s2i.yaml

Lines changed: 10 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -12,45 +12,21 @@ parameters:
1212
- description: Git branch/tag reference for Jenkins S2I
1313
name: JENKINS_S2I_REF
1414
value: main
15-
- description: Source imagestream
16-
name: JENKINS_S2I_SRC_IMAGESTREAM_NAME
17-
value: jenkins:scheduled-upgrade-redeploy
18-
- description: Namespace of source imagestream
19-
name: JENKINS_S2I_SRC_IMAGESTREAM_NAMESPACE
20-
value: openshift
2115

22-
# Here's what the flow looks like when no cert is required:
2316
#
24-
# ┌──────────────────────────────────────────────┐ ┌─────────────┐ ┌─────────────┐
25-
# │ imagestream │ │ buildconfig │ │ imagestream │
26-
#openshift/jenkins:scheduled-upgrade-redeploy ├──►│ jenkins-s2i ├──►│ jenkins:2
27-
# └──────────────────────────────────────────────┘ └─────────────┘ └─────────────┘
17+
# ┌──────────────────┐ ┌───────────────────┐ ┌──────────────────┐ ┌─────────────┐ ┌────────────────┐
18+
# │ imagestream │ buildconfig │ imagestream │ │ buildconfig │ │ imagestream
19+
# │ jenkins:upstream ├──►│ jenkins-with-cert ├──►│ jenkins:withcert ├──►│ jenkins-s2i ├──►│ jenkins:latest
20+
# └──────────────────┘ └───────────────────┘ └──────────────────┘ └─────────────┘ └────────────────┘
2821
#
29-
# ┌────────────────────────────────────────────────┐
30-
# │ imagestream │
31-
# │ openshift/jenkins-agent-base:scheduled-upgrade │
32-
# └────────────────────────────────────────────────┘
33-
#
34-
# And with cert required (see `jenkins-with-cert.yaml`):
35-
#
36-
# ┌──────────────────────────────────────────────┐ ┌───────────────────┐ ┌────────────────┐ ┌─────────────┐ ┌─────────────┐
37-
# │ imagestream │ │ buildconfig │ │ imagestream │ │ buildconfig │ │ imagestream │
38-
# │ openshift/jenkins:scheduled-upgrade-redeploy ├──►│ jenkins-with-cert ├──►│ jenkins:latest ├──►│ jenkins-s2i ├──►│ jenkins:2 │
39-
# └──────────────────────────────────────────────┘ └───────────────────┘ └────────────────┘ └─────────────┘ └─────────────┘
40-
#
41-
# ┌────────────────────────────────────────────────┐ ┌──────────────────────────────┐ ┌───────────────────────────┐
42-
# │ imagestream │ │ buildconfig │ │ imagestream │
43-
# │ openshift/jenkins-agent-base:scheduled-upgrade ├──►│ jenkins-agent-base-with-cert ├──►│ jenkins-agent-base:latest │
44-
# └────────────────────────────────────────────────┘ └──────────────────────────────┘ └───────────────────────────┘
22+
# ┌─────────────────────────────┐ ┌──────────────────────────────┐ ┌───────────────────────────┐
23+
# │ imagestream │ │ buildconfig │ │ imagestream │
24+
# │ jenkins-agent-base:upstream ├──►│ jenkins-agent-base-with-cert ├──►│ jenkins-agent-base:latest │
25+
# └─────────────────────────────┘ └──────────────────────────────┘ └───────────────────────────┘
4526

4627
objects:
4728

4829
### JENKINS CONTROLLER ###
49-
50-
- apiVersion: v1
51-
kind: ImageStream
52-
metadata:
53-
name: jenkins
5430
- kind: BuildConfig
5531
apiVersion: v1
5632
metadata:
@@ -70,22 +46,14 @@ objects:
7046
sourceStrategy:
7147
from:
7248
kind: ImageStreamTag
73-
name: ${JENKINS_S2I_SRC_IMAGESTREAM_NAME}
74-
namespace: ${JENKINS_S2I_SRC_IMAGESTREAM_NAMESPACE}
49+
name: jenkins:withcert
7550
env:
7651
- name: JENKINS_UC_DOWNLOAD
7752
value: 'https://archives.jenkins.io'
7853
forcePull: true
7954
output:
8055
to:
8156
kind: ImageStreamTag
82-
name: jenkins:2
57+
name: jenkins:latest
8358
successfulBuildsHistoryLimit: 2
8459
failedBuildsHistoryLimit: 2
85-
86-
### JENKINS AGENT ###
87-
88-
- apiVersion: v1
89-
kind: ImageStream
90-
metadata:
91-
name: jenkins-agent-base

manifests/jenkins-with-cert.yaml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# This template is instantiated only if an additional root CA is needed. Note it
1+
# This template is always required to create the jenkins and jenkins-agent-base
2+
# ImageStreams with the new tags that will be used later.
23
# doesn't actually need to be a template (there are no parameters), but the way
34
# `deploy` currently works expects it as a template.
45

@@ -20,7 +21,11 @@ objects:
2021
FROM overridden
2122
COPY cert/data /etc/pki/ca-trust/source/anchors/root-ca.crt
2223
USER root
23-
RUN update-ca-trust
24+
RUN if grep -q 'dummy' /etc/pki/ca-trust/source/anchors/root-ca.crt; then \
25+
rm /etc/pki/ca-trust/source/anchors/root-ca.crt; \
26+
else \
27+
update-ca-trust; \
28+
fi
2429
# restore previous user ID
2530
# https://github.com/openshift/jenkins/blob/7bae76f4412d28c18ed2b33aaf73306734b7f6d5/2/Dockerfile.rhel8#L107
2631
USER 1001
@@ -32,13 +37,12 @@ objects:
3237
dockerStrategy:
3338
from:
3439
kind: ImageStreamTag
35-
name: jenkins:scheduled-upgrade-redeploy
36-
namespace: openshift
40+
name: jenkins:upstream
3741
forcePull: true
3842
output:
3943
to:
4044
kind: ImageStreamTag
41-
name: jenkins:latest
45+
name: jenkins:withcert
4246
successfulBuildsHistoryLimit: 2
4347
failedBuildsHistoryLimit: 2
4448
triggers:
@@ -54,7 +58,11 @@ objects:
5458
dockerfile: |
5559
FROM overridden
5660
COPY cert/data /etc/pki/ca-trust/source/anchors/root-ca.crt
57-
RUN update-ca-trust
61+
RUN if grep -q 'dummy' /etc/pki/ca-trust/source/anchors/root-ca.crt; then \
62+
rm /etc/pki/ca-trust/source/anchors/root-ca.crt; \
63+
else \
64+
update-ca-trust; \
65+
fi
5866
secrets:
5967
- destinationDir: cert
6068
secret:
@@ -63,8 +71,7 @@ objects:
6371
dockerStrategy:
6472
from:
6573
kind: ImageStreamTag
66-
name: jenkins-agent-base:scheduled-upgrade
67-
namespace: openshift
74+
name: jenkins-agent-base:upstream
6875
forcePull: true
6976
output:
7077
to:

manifests/jenkins.yaml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ objects:
100100
-Dfile.encoding=UTF-8
101101
-Dorg.jenkinsci.plugins.durabletask.BourneShellScript.HEARTBEAT_CHECK_INTERVAL=900
102102
-Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true
103-
-Dorg.csanchez.jenkins.plugins.kubernetes.pipeline.PodTemplateStepExecution.defaultImage=image-registry.openshift-image-registry.svc:5000/${AGENT_NAMESPACE}/jenkins-agent-base:latest
103+
-Dorg.csanchez.jenkins.plugins.kubernetes.pipeline.PodTemplateStepExecution.defaultImage=jenkins-agent-base:latest
104104
-Dorg.csanchez.jenkins.plugins.kubernetes.pipeline.PodTemplateStepExecution.defaultContainer.defaultCpuRequest=1
105105
-Dorg.csanchez.jenkins.plugins.kubernetes.pipeline.PodTemplateStepExecution.defaultContainer.defaultMemoryRequest=512Mi
106106
-Dorg.csanchez.jenkins.plugins.kubernetes.pipeline.PodTemplateStepExecution.defaultContainer.defaultCpuLimit=1
@@ -172,8 +172,7 @@ objects:
172172
- jenkins
173173
from:
174174
kind: ImageStreamTag
175-
name: ${JENKINS_IMAGE_STREAM_TAG}
176-
namespace: ${NAMESPACE}
175+
name: jenkins:latest
177176
lastTriggeredImage: ""
178177
type: ImageChange
179178
- type: ConfigChange
@@ -252,25 +251,12 @@ parameters:
252251
required: true
253252
# DELTA: changed from 1Gi
254253
value: 25Gi
255-
- description: The OpenShift Namespace where the Jenkins ImageStream resides.
256-
displayName: Jenkins ImageStream Namespace
257-
name: NAMESPACE
258-
value: openshift
259-
# DELTA: add separate agent namespace parameter
260-
- description: The OpenShift Namespace where the Jenkins Agent ImageStream resides.
261-
displayName: Jenkins Agent ImageStream Namespace
262-
name: AGENT_NAMESPACE
263-
value: openshift
264254
- description: Whether to perform memory intensive, possibly slow, synchronization
265255
with the Jenkins Update Center on start. If true, the Jenkins core update monitor
266256
and site warnings monitor are disabled.
267257
displayName: Disable memory intensive administrative monitors
268258
name: DISABLE_ADMINISTRATIVE_MONITORS
269259
value: "false"
270-
- description: Name of the ImageStreamTag to be used for the Jenkins image.
271-
displayName: Jenkins ImageStreamTag
272-
name: JENKINS_IMAGE_STREAM_TAG
273-
value: jenkins:2
274260
- description: When a fatal error occurs, an error log is created with information
275261
and the state obtained at the time of the fatal error.
276262
displayName: Fatal Error Log File

0 commit comments

Comments
 (0)