Skip to content

Commit cf61d01

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 cf61d01

File tree

5 files changed

+60
-42
lines changed

5 files changed

+60
-42
lines changed

deploy

Lines changed: 2 additions & 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,7 @@ 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)
60+
params['JENKINS_IMAGE_STREAM_TAG'] = "upstream"
6261

6362
print("Parameters:")
6463
for k, v in params.items():

manifests/jenkins-images.yaml

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

manifests/jenkins-s2i.yaml

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,33 @@ 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
15+
- description: Name of the ImageStreamTag to be used for the Jenkins image.
16+
name: JENKINS_IMAGE_STREAM_TAG
17+
value: latest
2118

2219
# Here's what the flow looks like when no cert is required:
2320
#
2421
# ┌──────────────────────────────────────────────┐ ┌─────────────┐ ┌─────────────┐
2522
# │ imagestream │ │ buildconfig │ │ imagestream │
26-
#openshift/jenkins:scheduled-upgrade-redeploy ├──►│ jenkins-s2i ├──►│ jenkins:2 │
23+
# │ jenkins:latest ├──►│ jenkins-s2i ├──►│ jenkins:2 │
2724
# └──────────────────────────────────────────────┘ └─────────────┘ └─────────────┘
2825
#
2926
# ┌────────────────────────────────────────────────┐
3027
# │ imagestream │
31-
#openshift/jenkins-agent-base:scheduled-upgrade
28+
# │ jenkins-agent-base:latest
3229
# └────────────────────────────────────────────────┘
3330
#
3431
# And with cert required (see `jenkins-with-cert.yaml`):
3532
#
36-
# ┌──────────────────────────────────────────────┐ ┌───────────────────┐ ┌────────────────┐ ┌─────────────┐ ┌─────────────┐
37-
# │ imagestream │ │ buildconfig │ │ imagestream │ │ buildconfig │ │ imagestream │
38-
#openshift/jenkins:scheduled-upgrade-redeploy ├──►│ jenkins-with-cert ├──►│ jenkins:latest ├──►│ jenkins-s2i ├──►│ jenkins:2 │
39-
# └──────────────────────────────────────────────┘ └───────────────────┘ └────────────────┘ └─────────────┘ └─────────────┘
33+
# ┌──────────────────────────────────────────────┐ ┌───────────────────┐ ┌──────────────────┐ ┌─────────────┐ ┌─────────────┐
34+
# │ imagestream │ │ buildconfig │ │ imagestream │ │ buildconfig │ │ imagestream │
35+
# │ jenkins:latest ├──►│ jenkins-with-cert ├──►│ jenkins:upstream ├──►│ jenkins-s2i ├──►│ jenkins:2 │
36+
# └──────────────────────────────────────────────┘ └───────────────────┘ └──────────────────┘ └─────────────┘ └─────────────┘
4037
#
41-
# ┌────────────────────────────────────────────────┐ ┌──────────────────────────────┐ ┌───────────────────────────┐
42-
# │ imagestream │ │ buildconfig │ │ imagestream │
43-
#openshift/jenkins-agent-base:scheduled-upgrade ├──►│ jenkins-agent-base-with-cert ├──►│ jenkins-agent-base:latest
44-
# └────────────────────────────────────────────────┘ └──────────────────────────────┘ └───────────────────────────┘
38+
# ┌────────────────────────────────────────────────┐ ┌──────────────────────────────┐ ┌─────────────────────────────
39+
# │ imagestream │ │ buildconfig │ │ imagestream
40+
# │ jenkins-agent-base:scheduled-upgrade ├──►│ jenkins-agent-base-with-cert ├──►│ jenkins-agent-base:upstream
41+
# └────────────────────────────────────────────────┘ └──────────────────────────────┘ └─────────────────────────────
4542

4643
objects:
4744

@@ -70,8 +67,7 @@ objects:
7067
sourceStrategy:
7168
from:
7269
kind: ImageStreamTag
73-
name: ${JENKINS_S2I_SRC_IMAGESTREAM_NAME}
74-
namespace: ${JENKINS_S2I_SRC_IMAGESTREAM_NAMESPACE}
70+
name: jenkins:${JENKINS_IMAGE_STREAM_TAG}
7571
env:
7672
- name: JENKINS_UC_DOWNLOAD
7773
value: 'https://archives.jenkins.io'
@@ -82,10 +78,3 @@ objects:
8278
name: jenkins:2
8379
successfulBuildsHistoryLimit: 2
8480
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: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,12 @@ objects:
3232
dockerStrategy:
3333
from:
3434
kind: ImageStreamTag
35-
name: jenkins:scheduled-upgrade-redeploy
36-
namespace: openshift
35+
name: jenkins:latest
3736
forcePull: true
3837
output:
3938
to:
4039
kind: ImageStreamTag
41-
name: jenkins:latest
40+
name: jenkins:upstream
4241
successfulBuildsHistoryLimit: 2
4342
failedBuildsHistoryLimit: 2
4443
triggers:
@@ -63,13 +62,12 @@ objects:
6362
dockerStrategy:
6463
from:
6564
kind: ImageStreamTag
66-
name: jenkins-agent-base:scheduled-upgrade
67-
namespace: openshift
65+
name: jenkins-agent-base:latest
6866
forcePull: true
6967
output:
7068
to:
7169
kind: ImageStreamTag
72-
name: jenkins-agent-base:latest
70+
name: jenkins-agent-base:upstream
7371
successfulBuildsHistoryLimit: 2
7472
failedBuildsHistoryLimit: 2
7573
triggers:

manifests/jenkins.yaml

Lines changed: 4 additions & 8 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=image-registry.openshift-image-registry.svc:5000/${NAMESPACE}/jenkins-agent-base:${JENKINS_IMAGE_STREAM_TAG}
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,7 +172,7 @@ objects:
172172
- jenkins
173173
from:
174174
kind: ImageStreamTag
175-
name: ${JENKINS_IMAGE_STREAM_TAG}
175+
name: jenkins:2
176176
namespace: ${NAMESPACE}
177177
lastTriggeredImage: ""
178178
type: ImageChange
@@ -255,12 +255,8 @@ parameters:
255255
- description: The OpenShift Namespace where the Jenkins ImageStream resides.
256256
displayName: Jenkins ImageStream Namespace
257257
name: NAMESPACE
258-
value: openshift
258+
value: fedora-coreos-pipeline
259259
# 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
264260
- description: Whether to perform memory intensive, possibly slow, synchronization
265261
with the Jenkins Update Center on start. If true, the Jenkins core update monitor
266262
and site warnings monitor are disabled.
@@ -270,7 +266,7 @@ parameters:
270266
- description: Name of the ImageStreamTag to be used for the Jenkins image.
271267
displayName: Jenkins ImageStreamTag
272268
name: JENKINS_IMAGE_STREAM_TAG
273-
value: jenkins:2
269+
value: upstream
274270
- description: When a fatal error occurs, an error log is created with information
275271
and the state obtained at the time of the fatal error.
276272
displayName: Fatal Error Log File

0 commit comments

Comments
 (0)