Skip to content

Commit 6c648e8

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 6c648e8

File tree

5 files changed

+61
-60
lines changed

5 files changed

+61
-60
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 & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,17 @@ 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

@@ -70,22 +51,14 @@ objects:
7051
sourceStrategy:
7152
from:
7253
kind: ImageStreamTag
73-
name: ${JENKINS_S2I_SRC_IMAGESTREAM_NAME}
74-
namespace: ${JENKINS_S2I_SRC_IMAGESTREAM_NAMESPACE}
54+
name: jenkins:withcert
7555
env:
7656
- name: JENKINS_UC_DOWNLOAD
7757
value: 'https://archives.jenkins.io'
7858
forcePull: true
7959
output:
8060
to:
8161
kind: ImageStreamTag
82-
name: jenkins:2
62+
name: jenkins:latest
8363
successfulBuildsHistoryLimit: 2
8464
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: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ objects:
2020
FROM overridden
2121
COPY cert/data /etc/pki/ca-trust/source/anchors/root-ca.crt
2222
USER root
23-
RUN update-ca-trust
23+
RUN if grep 'dummy' /etc/pki/ca-trust/source/anchors/root-ca.crt; then \
24+
rm /etc/pki/ca-trust/source/anchors/root-ca.crt; \
25+
else \
26+
update-ca-trust; \
27+
fi
2428
# restore previous user ID
2529
# https://github.com/openshift/jenkins/blob/7bae76f4412d28c18ed2b33aaf73306734b7f6d5/2/Dockerfile.rhel8#L107
2630
USER 1001
@@ -32,13 +36,12 @@ objects:
3236
dockerStrategy:
3337
from:
3438
kind: ImageStreamTag
35-
name: jenkins:scheduled-upgrade-redeploy
36-
namespace: openshift
39+
name: jenkins:upstream
3740
forcePull: true
3841
output:
3942
to:
4043
kind: ImageStreamTag
41-
name: jenkins:latest
44+
name: jenkins:withcert
4245
successfulBuildsHistoryLimit: 2
4346
failedBuildsHistoryLimit: 2
4447
triggers:
@@ -54,7 +57,11 @@ objects:
5457
dockerfile: |
5558
FROM overridden
5659
COPY cert/data /etc/pki/ca-trust/source/anchors/root-ca.crt
57-
RUN update-ca-trust
60+
RUN if grep 'dummy' /etc/pki/ca-trust/source/anchors/root-ca.crt; then \
61+
rm /etc/pki/ca-trust/source/anchors/root-ca.crt; \
62+
else \
63+
update-ca-trust; \
64+
fi
5865
secrets:
5966
- destinationDir: cert
6067
secret:
@@ -63,8 +70,7 @@ objects:
6370
dockerStrategy:
6471
from:
6572
kind: ImageStreamTag
66-
name: jenkins-agent-base:scheduled-upgrade
67-
namespace: openshift
73+
name: jenkins-agent-base:upstream
6874
forcePull: true
6975
output:
7076
to:

manifests/jenkins.yaml

Lines changed: 3 additions & 13 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: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
@@ -255,22 +254,13 @@ parameters:
255254
- description: The OpenShift Namespace where the Jenkins ImageStream resides.
256255
displayName: Jenkins ImageStream Namespace
257256
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
257+
value: fedora-coreos-pipeline
264258
- description: Whether to perform memory intensive, possibly slow, synchronization
265259
with the Jenkins Update Center on start. If true, the Jenkins core update monitor
266260
and site warnings monitor are disabled.
267261
displayName: Disable memory intensive administrative monitors
268262
name: DISABLE_ADMINISTRATIVE_MONITORS
269263
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
274264
- description: When a fatal error occurs, an error log is created with information
275265
and the state obtained at the time of the fatal error.
276266
displayName: Fatal Error Log File

0 commit comments

Comments
 (0)