Skip to content

Switch Jenkins image tracking to registry tag due to Samples Operator… … deprecation #1151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -532,12 +532,6 @@ using a development cluster, it normally isn't, and you can drop it. For
the Fedora prod cluster, use `ocs-storagecluster-ceph-rbd` as shown
above.

If using an additional root CA certificate, then you will also need to
specify the `AGENT_NAMESPACE` parameter to yours, e.g.:

```
--param=AGENT_NAMESPACE=fedora-coreos-pipeline \
```

Now, create the Jenkins configmap:

Expand Down Expand Up @@ -586,6 +580,10 @@ This will create:
3. the Jenkins agent BuildConfig (if a root CA cert was provided),
4. the jenkins-config configmap.

Note: If you are working with the Fedora staging pipeline, specify the
`staging` branch for the pipecfg: `--pipecfg
https://github.com/coreos/fedora-coreos-pipeline@staging`.

If a root CA cert was provided, we need to build the base images that
will bake in the cert in the controller and agent:

Expand All @@ -600,6 +598,12 @@ We can now start an S2I build of the Jenkins controller:
oc start-build --follow jenkins-s2i
```

If you added the root CA:
```
oc start-build jenkins-s2i --follow -e JENKINS_IMAGE_STREAM_TAG=upstream
```


Once the Jenkins controller image is built, Jenkins should start up (verify
with `oc get pods`). Once the pod is marked READY, you should be able to
login to the Jenkins UI at https://jenkins-$NAMESPACE.$CLUSTER_URL/
Expand Down
5 changes: 2 additions & 3 deletions deploy
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def get_username():


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

params = {}
if args.pipeline:
Expand All @@ -57,8 +57,7 @@ def process_template(args):
params.update(params_from_git_refspec(args.pipecfg, 'PIPECFG'))
if has_additional_root_ca(args):
templates += ['jenkins-with-cert.yaml']
params['JENKINS_S2I_SRC_IMAGESTREAM_NAME'] = "jenkins:latest"
params['JENKINS_S2I_SRC_IMAGESTREAM_NAMESPACE'] = get_current_namespace(args)
params['JENKINS_IMAGE_STREAM_TAG'] = "upstream"

print("Parameters:")
for k, v in params.items():
Expand Down
34 changes: 34 additions & 0 deletions manifests/jenkins-images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: template.openshift.io/v1
kind: Template
metadata:
name: jenkins-images-template
objects:
- apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
name: jenkins-agent-base
spec:
tags:
- name: latest
from:
kind: DockerImage
name: registry.redhat.io/ocp-tools-4/jenkins-agent-base-rhel9:v4.17.0
importPolicy:
scheduled: true
referencePolicy:
type: Local

- apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
name: jenkins
Comment on lines +22 to +24
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we have two imagestreams named jenkins. The other one is on line 50 of jenkins-s2i.yaml. I think one of them has to go.

spec:
tags:
- name: latest
from:
kind: DockerImage
name: registry.redhat.io/ocp-tools-4/jenkins-rhel9:v4.17.0
importPolicy:
scheduled: true
referencePolicy:
type: Local
39 changes: 14 additions & 25 deletions manifests/jenkins-s2i.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,33 @@ parameters:
- description: Git branch/tag reference for Jenkins S2I
name: JENKINS_S2I_REF
value: main
- description: Source imagestream
name: JENKINS_S2I_SRC_IMAGESTREAM_NAME
value: jenkins:scheduled-upgrade-redeploy
- description: Namespace of source imagestream
name: JENKINS_S2I_SRC_IMAGESTREAM_NAMESPACE
value: openshift
- description: Name of the ImageStreamTag to be used for the Jenkins image.
name: JENKINS_IMAGE_STREAM_TAG
value: latest

# Here's what the flow looks like when no cert is required:
#
# ┌──────────────────────────────────────────────┐ ┌─────────────┐ ┌─────────────┐
# │ imagestream │ │ buildconfig │ │ imagestream │
# │ openshift/jenkins:scheduled-upgrade-redeploy ├──►│ jenkins-s2i ├──►│ jenkins:2 │
# │ jenkins:latest ├──►│ jenkins-s2i ├──►│ jenkins:2 │
# └──────────────────────────────────────────────┘ └─────────────┘ └─────────────┘
#
# ┌────────────────────────────────────────────────┐
# │ imagestream │
# │ openshift/jenkins-agent-base:scheduled-upgrade
# │ jenkins-agent-base:latest
# └────────────────────────────────────────────────┘
#
# And with cert required (see `jenkins-with-cert.yaml`):
#
# ┌──────────────────────────────────────────────┐ ┌───────────────────┐ ┌────────────────┐ ┌─────────────┐ ┌─────────────┐
# │ imagestream │ │ buildconfig │ │ imagestream │ │ buildconfig │ │ imagestream │
# │ openshift/jenkins:scheduled-upgrade-redeploy ├──►│ jenkins-with-cert ├──►│ jenkins:latest ├──►│ jenkins-s2i ├──►│ jenkins:2 │
# └──────────────────────────────────────────────┘ └───────────────────┘ └────────────────┘ └─────────────┘ └─────────────┘
# ┌──────────────────────────────────────────────┐ ┌───────────────────┐ ┌──────────────────┐ ┌─────────────┐ ┌─────────────┐
# │ imagestream │ │ buildconfig │ │ imagestream │ │ buildconfig │ │ imagestream │
# │ jenkins:latest ├──►│ jenkins-with-cert ├──►│ jenkins:upstream ├──►│ jenkins-s2i ├──►│ jenkins:2 │
# └──────────────────────────────────────────────┘ └───────────────────┘ └──────────────────┘ └─────────────┘ └─────────────┘
#
# ┌────────────────────────────────────────────────┐ ┌──────────────────────────────┐ ┌───────────────────────────┐
# │ imagestream │ │ buildconfig │ │ imagestream │
# │ openshift/jenkins-agent-base:scheduled-upgrade ├──►│ jenkins-agent-base-with-cert ├──►│ jenkins-agent-base:latest
# └────────────────────────────────────────────────┘ └──────────────────────────────┘ └───────────────────────────┘
# ┌────────────────────────────────────────────────┐ ┌──────────────────────────────┐ ┌─────────────────────────────
# │ imagestream │ │ buildconfig │ │ imagestream
# │ jenkins-agent-base:scheduled-upgrade ├──►│ jenkins-agent-base-with-cert ├──►│ jenkins-agent-base:upstream
# └────────────────────────────────────────────────┘ └──────────────────────────────┘ └─────────────────────────────

objects:

Expand Down Expand Up @@ -70,8 +67,7 @@ objects:
sourceStrategy:
from:
kind: ImageStreamTag
name: ${JENKINS_S2I_SRC_IMAGESTREAM_NAME}
namespace: ${JENKINS_S2I_SRC_IMAGESTREAM_NAMESPACE}
name: jenkins:${JENKINS_IMAGE_STREAM_TAG}
env:
- name: JENKINS_UC_DOWNLOAD
value: 'https://archives.jenkins.io'
Expand All @@ -82,10 +78,3 @@ objects:
name: jenkins:2
successfulBuildsHistoryLimit: 2
failedBuildsHistoryLimit: 2

### JENKINS AGENT ###

- apiVersion: v1
kind: ImageStream
metadata:
name: jenkins-agent-base
10 changes: 4 additions & 6 deletions manifests/jenkins-with-cert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,12 @@ objects:
dockerStrategy:
from:
kind: ImageStreamTag
name: jenkins:scheduled-upgrade-redeploy
namespace: openshift
name: jenkins:latest
forcePull: true
output:
to:
kind: ImageStreamTag
name: jenkins:latest
name: jenkins:upstream
successfulBuildsHistoryLimit: 2
failedBuildsHistoryLimit: 2
triggers:
Expand All @@ -63,13 +62,12 @@ objects:
dockerStrategy:
from:
kind: ImageStreamTag
name: jenkins-agent-base:scheduled-upgrade
namespace: openshift
name: jenkins-agent-base:latest
forcePull: true
output:
to:
kind: ImageStreamTag
name: jenkins-agent-base:latest
name: jenkins-agent-base:upstream
successfulBuildsHistoryLimit: 2
failedBuildsHistoryLimit: 2
triggers:
Expand Down
12 changes: 4 additions & 8 deletions manifests/jenkins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ objects:
-Dfile.encoding=UTF-8
-Dorg.jenkinsci.plugins.durabletask.BourneShellScript.HEARTBEAT_CHECK_INTERVAL=900
-Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true
-Dorg.csanchez.jenkins.plugins.kubernetes.pipeline.PodTemplateStepExecution.defaultImage=image-registry.openshift-image-registry.svc:5000/${AGENT_NAMESPACE}/jenkins-agent-base:latest
-Dorg.csanchez.jenkins.plugins.kubernetes.pipeline.PodTemplateStepExecution.defaultImage=image-registry.openshift-image-registry.svc:5000/${NAMESPACE}/jenkins-agent-base:${JENKINS_IMAGE_STREAM_TAG}
-Dorg.csanchez.jenkins.plugins.kubernetes.pipeline.PodTemplateStepExecution.defaultContainer.defaultCpuRequest=1
-Dorg.csanchez.jenkins.plugins.kubernetes.pipeline.PodTemplateStepExecution.defaultContainer.defaultMemoryRequest=512Mi
-Dorg.csanchez.jenkins.plugins.kubernetes.pipeline.PodTemplateStepExecution.defaultContainer.defaultCpuLimit=1
Expand Down Expand Up @@ -172,7 +172,7 @@ objects:
- jenkins
from:
kind: ImageStreamTag
name: ${JENKINS_IMAGE_STREAM_TAG}
name: jenkins:2
namespace: ${NAMESPACE}
lastTriggeredImage: ""
type: ImageChange
Expand Down Expand Up @@ -255,12 +255,8 @@ parameters:
- description: The OpenShift Namespace where the Jenkins ImageStream resides.
displayName: Jenkins ImageStream Namespace
name: NAMESPACE
value: openshift
value: fedora-coreos-pipeline
Comment on lines 255 to +258
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not needed anymore since we'll be operating in our own namespace?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which means we can also delete namespace: ${NAMESPACE} above in this file.

# DELTA: add separate agent namespace parameter
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete

Suggested change
# DELTA: add separate agent namespace parameter

- description: The OpenShift Namespace where the Jenkins Agent ImageStream resides.
displayName: Jenkins Agent ImageStream Namespace
name: AGENT_NAMESPACE
value: openshift
- description: Whether to perform memory intensive, possibly slow, synchronization
with the Jenkins Update Center on start. If true, the Jenkins core update monitor
and site warnings monitor are disabled.
Expand All @@ -270,7 +266,7 @@ parameters:
- description: Name of the ImageStreamTag to be used for the Jenkins image.
displayName: Jenkins ImageStreamTag
name: JENKINS_IMAGE_STREAM_TAG
value: jenkins:2
value: upstream
- description: When a fatal error occurs, an error log is created with information
and the state obtained at the time of the fatal error.
displayName: Fatal Error Log File
Expand Down