Skip to content

Commit d7d4f47

Browse files
committed
Allow plugin download to use an insecure repository
Adds JENKINS_UC_INSECURE documentation in README.md Adds JENKINS_UC_INSECURE param and env to the openshift templates
1 parent a6de19a commit d7d4f47

File tree

4 files changed

+45
-17
lines changed

4 files changed

+45
-17
lines changed

2/contrib/jenkins/install-plugins.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,11 @@ function download() {
191191
}
192192

193193
function doDownload() {
194-
local plugin version url jpi
194+
local plugin version url jpi curl_options
195195
plugin="$1"
196196
version="$2"
197197
jpi="$(getArchiveFilename "$plugin")"
198-
198+
curl_options=""
199199
# If plugin already exists and is the same version do not download
200200
if test -f "$jpi" && unzip -p "$jpi" META-INF/MANIFEST.MF | tr -d '\r' | grep "^Plugin-Version: ${version}$" > /dev/null; then
201201
echo "Using provided plugin: $plugin"
@@ -225,8 +225,15 @@ function doDownload() {
225225
url="$JENKINS_UC_DOWNLOAD/plugins/$plugin/$version/${plugin}.hpi"
226226
fi
227227

228+
229+
JENKINS_UC_INSECURE=${JENKINS_UC_INSECURE:-"false"}
230+
if [[ -n "$JENKINS_UC_INSECURE" && "$JENKINS_UC_INSECURE" != false ]]; then
231+
curl_options="${curl_options} -k"
232+
echo "Insecure flag has been set for URL: $url"
233+
fi
234+
228235
echo "Downloading plugin: $plugin from $url"
229-
curl --connect-timeout "${CURL_CONNECTION_TIMEOUT:-20}" --retry "${CURL_RETRY:-5}" --retry-delay "${CURL_RETRY_DELAY:-0}" --retry-max-time "${CURL_RETRY_MAX_TIME:-60}" -s -f -L "$url" -o "$jpi"
236+
curl $curl_options --connect-timeout "${CURL_CONNECTION_TIMEOUT:-20}" --retry "${CURL_RETRY:-5}" --retry-delay "${CURL_RETRY_DELAY:-0}" --retry-max-time "${CURL_RETRY_MAX_TIME:-60}" -s -f -L "$url" -o "$jpi"
230237
return $?
231238
}
232239

README.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ subscribed RHEL machine.
5656
$ make build TARGET=rhel7 VERSION=2
5757
```
5858

59-
Also note, as of 3.11, the RHEL images are hosted at registry.redhat.io as well. This is the terms based
59+
Also note, as of 3.11, the RHEL images are hosted at registry.redhat.io as well. This is the terms based
6060
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:
6161
* registry.redhat.io/openshift3/jenkins-2-rhel7:v3.11
6262
* registry.redhat.io/openshift3/jenkins-agent-nodejs-8-rhel7:v3.11
6363
* registry.redhat.io/openshift3/jenkins-agent-maven-35-rhel7:v3.11
6464
* registry.redhat.io/openshift3/jenkins-slave-base-rhel7:v3.11
65-
65+
6666
The openshift cluster install for 3.11 will ensure that credentials are provided and subsequently available on the nodes
6767
in the cluster to facilitate image pulling.
6868

@@ -89,13 +89,13 @@ on all provided versions of Jenkins.**
8989
If you are curious about the precise level of Jenkins for either `jenkins-2-centos7` or `jenkins-2-rhel7`, then
9090
you can execute:
9191

92-
92+
9393
$ docker run -it <image spec> /etc/alternatives/java -jar /usr/lib/jenkins/jenkins.war --version
94-
94+
9595

9696
For example:
9797

98-
98+
9999
$ docker run -it docker.io/openshift/jenkins-2-centos7:latest /etc/alternatives/java -jar /usr/lib/jenkins/jenkins.war --version
100100

101101
Installation (OpenShift V4)
@@ -107,12 +107,12 @@ Starting with v4.0, the images are only available on quay.io for public communit
107107
* quay.io/openshift/origin-jenkins-agent-maven:v4.0
108108
* quay.io/openshift/origin-jenkins-agent-base:v4.0
109109

110-
The images are also still available at the Red Hat Container Catalog for customers with subscriptions,
110+
The images are also still available at the Red Hat Container Catalog for customers with subscriptions,
111111
though with some changes in the naming.
112112

113113
As with the initial introduction in 3.11, given the [transitioning of the Red Hat container registry](https://www.redhat.com/en/blog/transitioning-red-hat-container-registry), the RHEL based images are available at both registry.access.redhat.com and registry.redhat.io.
114-
The terms based registry, registry.redhat.io, which requires credentials for access, is the strategic direction, and
115-
will be the only location for RHEL8 based content when that is available. The pull secret you obtain from try.openshift.com includes
114+
The terms based registry, registry.redhat.io, which requires credentials for access, is the strategic direction, and
115+
will be the only location for RHEL8 based content when that is available. The pull secret you obtain from try.openshift.com includes
116116
access to registry.redhat.io. The image pull specs are:
117117
* registry.redhat.io/openshift4/ose-jenkins:v4.0
118118
* registry.redhat.io/openshift4/ose-jenkins-agent-nodejs:v4.0
@@ -124,9 +124,9 @@ OpenShift v4 also removes the 32 bit JVM option. Only 64 bit will be provided f
124124
The `Dockerfile.rhel7` variants still exists, but as part of the `CentOS` vs. `RHEL` distinction no longer existing, the various `Dockerfile` files have been renamed to `Dockerfile.localdev` to more clearly denote that they are for builds on developers' local machines that most likely do not have a Red Hat subscription / entitlement. The `Dockerfile.localdev` variants are structured to allow building of the images on machines without `RHEL` subscriptions, even though the base images are no longer based on `CentOS`. Subscriptions are still required for use of `Dockerfile.rhel7`.
125125

126126
With any local builds, if for example you plan on submitting a PR to this repository, you still build the same way as with OpenShift v3 with respect to the `make` invocations.
127-
127+
128128
Be aware, no support in any way is provided for running images created from any of the `Dockerfile.localdev` files. And in fact the images hosted on both quay.io and the Red Hat Container Catalog are based off the `Dockerfile.rhel7` files.
129-
129+
130130

131131

132132
Environment variables
@@ -148,6 +148,7 @@ initialization by passing `-e VAR=VALUE` to the Docker run command.
148148
| `ENABLE_FATAL_ERROR_LOG_FILE` | When running this image with an OpenShift persistent volume claim for the Jenkins config directory, this environment variable allows the fatal error log file to persist if a fatal error occurs. The fatal error file will be located at `/var/lib/jenkins/logs`. |
149149
| `NODEJS_SLAVE_IMAGE` | Setting this value will override the image used for the default NodeJS agent pod configuration. For 3.x, the default NodeJS agent pod uses `docker.io/openshift/jenkins-agent-nodejs-8-centos7` or `registry.redhat.io/openshift3/jenkins-agent-nodejs-8-rhel7` depending whether you are running the centos or rhel version of the Jenkins image. This variable must be set before Jenkins starts the first time for it to have an effect. For 4.x, the image is included in the 4.0 payload via an imagestream in the openshift namespace, and the image spec points to the internal image registry. If you are running this image outside of OpenShift, you must either set this environment variable or manually update the setting to an accessible image spec. |
150150
| `MAVEN_SLAVE_IMAGE` | Setting this value overrides the image used for the default maven agent pod configuration. For 3.x, the default maven agent pod uses `docker.io/openshift/jenkins-agent-maven-35-centos7` or `registry.redhat.io/openshift3/jenkins-agent-maven-35-rhel7` depending whether you are running the centos or rhel version of the Jenkins image. For 4.x, the image is included in the 4.0 payload via an imagestream in the openshift namespace, and the image spec points to the internal image registry. If you are running this image outside of OpenShift, you must either set this environment variable or manually update the setting to an accessible image spec. This variable must be set before Jenkins starts the first time for it to have an effect. |
151+
| `JENKINS_UC_INSECURE` | When your Jenkins Update Center repository is using a self-signed certificate with an unknown Certificate Authority, this variable allows to bypass the repository's SSL certificate check. The variable applies to plugins downloads which may occur during Jenkins image build or if you build an extension of the jenkins image or if you run the jenkins image and leverage one of the options to download additional plugins (use of s2i whith plugins.txt or use of `INSTALL_PLUGINS` environment variable. |
151152

152153

153154

@@ -199,16 +200,16 @@ The `oc` binary is still included in the v4 images as well. And the same recomm
199200
Jenkins security advisories, the "master" image from this repository, and the `oc` binary
200201
---------------------------------
201202

202-
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
203+
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
203204
branches of this repository.
204205

205-
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
206+
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
206207
updates. Per the prior section, we advise that you import a version of `oc` into your Jenkins installation that matches your OpenShift
207208
cluster via the "Global Tool Configuration" option in Jenkins either via the UI, CLI, or groovy init scripts.
208209

209210
Our OpenShift Client Plugin has some documentation on doing this [here](https://github.com/openshift/jenkins-client-plugin#setting-up-jenkins-nodes).
210211

211-
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
212+
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
212213
the image setting. If the cluster is at v3.11, the image setting will point to the terms based registry at registry.access.io.
213214

214215

@@ -252,7 +253,7 @@ When PRs for this repository's `openshift-3*` branches are merged, they kick off
252253
Jenkins CI/CD server](https://ci.openshift.redhat.com/jenkins/view/All/job/push_jenkins_images/). When those builds complete,
253254
new versions of the CentOS7 based versions of the images produced by this repository are pushed to Docker Hub. See the top of the README for the precise list.
254255

255-
For v4.0, the job definitions for this repository in https://github.com/openshif/release result in our Prow based infrastructure to eventually
256+
For v4.0, the job definitions for this repository in https://github.com/openshif/release result in our Prow based infrastructure to eventually
256257
mirror the image content on quay.io.
257258

258259
#### Plugin installation for RHEL7 V3 and V4

openshift/templates/jenkins-ephemeral.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@
136136
{
137137
"name": "JNLP_SERVICE_NAME",
138138
"value": "${JNLP_SERVICE_NAME}"
139+
},
140+
{
141+
"name": "JENKINS_UC_INSECURE",
142+
"value": "${JENKINS_UC_INSECURE}"
139143
}
140144
],
141145
"resources": {
@@ -292,6 +296,12 @@
292296
"displayName": "Jenkins ImageStreamTag",
293297
"description": "Name of the ImageStreamTag to be used for the Jenkins image.",
294298
"value": "jenkins:2"
299+
},
300+
{
301+
"name": "JENKINS_UC_INSECURE",
302+
"displayName": "Allows use of Jenkins Update Center repository with invalid SSL certificate",
303+
"description": "Whether to allow use of a Jenkins Update Center that uses invalid certificate (self-signed, unknown CA). If any value other than 'false', certificate check is bypassed.",
304+
"value": "false"
295305
}
296306
]
297307
}

openshift/templates/jenkins-persistent.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@
157157
{
158158
"name": "ENABLE_FATAL_ERROR_LOG_FILE",
159159
"value": "${ENABLE_FATAL_ERROR_LOG_FILE}"
160+
},
161+
{
162+
"name": "JENKINS_UC_INSECURE",
163+
"value": "${JENKINS_UC_INSECURE}"
160164
}
161165
],
162166
"resources": {
@@ -326,6 +330,12 @@
326330
"displayName": "Fatal Error Log File",
327331
"description": "When a fatal error occurs, an error log is created with information and the state obtained at the time of the fatal error.",
328332
"value": "false"
333+
},
334+
{
335+
"name": "JENKINS_UC_INSECURE",
336+
"displayName": "Allows use of Jenkins Update Center repository with invalid SSL certificate",
337+
"description": "Whether to allow use of a Jenkins Update Center that uses invalid certificate (self-signed, unknown CA). If any value other than 'false', certificate check is bypassed.",
338+
"value": "false"
329339
}
330340
]
331341
}

0 commit comments

Comments
 (0)