You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/images-other-jenkins-config-kubernetes.adoc
+66-5Lines changed: 66 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@
7
7
8
8
The {product-title} Jenkins image includes the pre-installed link:https://wiki.jenkins-ci.org/display/JENKINS/Kubernetes+Plugin[Kubernetes plug-in] that allows Jenkins agents to be dynamically provisioned on multiple container hosts using Kubernetes and {product-title}.
9
9
10
-
To use the Kubernetes plug-in, {product-title} provides images that are suitable for use as Jenkins agents including the Base, Maven, and Node.js images.
10
+
To use the Kubernetes plug-in, {product-title} provides images that are suitable for use as Jenkins agents, including the Base, Maven, and Node.js images.
11
11
12
12
Both the Maven and Node.js agent images are automatically configured as Kubernetes pod template images within the {product-title} Jenkins image configuration for the Kubernetes plug-in. That configuration includes labels for each of the images that can be applied to any of your Jenkins jobs under their Restrict where this project can be run setting. If the label is applied, jobs run under an {product-title} pod running the respective agent image.
13
13
@@ -25,12 +25,12 @@ The name and image references of the image stream or image stream tag are mapped
25
25
26
26
[NOTE]
27
27
====
28
-
Do not log in to the Jenkins console and modify the pod template configuration. If you do so after the pod template is created, and the {product-title} Sync plug-in detects that the image associated with the image stream or image stream tag has changed, it replaces the pod template and overwrites those configuration changes. You cannot merge a new configuration with the existing configuration.
28
+
Do not log in to the Jenkins console and change the pod template configuration. If you do so after the pod template is created, and the {product-title} Sync plug-in detects that the image associated with the image stream or image stream tag has changed, it replaces the pod template and overwrites those configuration changes. You cannot merge a new configuration with the existing configuration.
29
29
30
30
Consider the config map approach if you have more complex configuration needs.
31
31
====
32
32
33
-
When it finds a config map with the appropriate label, it assumes that any values in the key-value data payload of the config map contains Extensible Markup Language (XML) that is consistent with the configuration format for Jenkins and the Kubernetes plug-in pod templates. A key differentiator to note when using config maps, instead of image streams or image stream tags, is that you can control all the parameters of the Kubernetes plug-in pod template.
33
+
When it finds a config map with the appropriate label, it assumes that any values in the key-value data payload of the config map contain Extensible Markup Language (XML) that is consistent with the configuration format for Jenkins and the Kubernetes plug-in pod templates. One key benefit of using config maps, rather than image streams or image stream tags, is that you can control all the parameters of the Kubernetes plug-in pod template.
The following example shows two containers that reference image streams that are present in the `openshift` namespace. One container handles the JNLP contract for launching Pods as Jenkins Agents. The other container uses an image with tools for building code in a particular coding language:
If you log in to the Jenkins console and make further changes to the pod template configuration after the pod template is created, and the {product-title} Sync plug-in detects that the config map has changed, it will replace the pod template and overwrite those configuration changes. You cannot merge a new configuration with the existing configuration.
82
143
83
-
Do not log in to the Jenkins console and modify the pod template configuration. If you do so after the pod template is created, and the {product-title} Sync plug-in detects that the image associated with the image stream or image stream tag has changed, it replaces the pod template and overwrites those configuration changes. You cannot merge a new configuration with the existing configuration.
144
+
Do not log in to the Jenkins console and change the pod template configuration. If you do so after the pod template is created, and the {product-title} Sync plug-in detects that the image associated with the image stream or image stream tag has changed, it replaces the pod template and overwrites those configuration changes. You cannot merge a new configuration with the existing configuration.
84
145
85
146
Consider the config map approach if you have more complex configuration needs.
86
147
====
@@ -94,4 +155,4 @@ The following rules apply:
94
155
* Either creating appropriately labeled or annotated `ConfigMap`, `ImageStream`, or `ImageStreamTag` objects, or the adding of labels after their initial creation, leads to creating of a `PodTemplate` in the Kubernetes-plugin configuration.
95
156
* In the case of the `PodTemplate` by config map form, changes to the config map data for the `PodTemplate` are applied to the `PodTemplate` settings in the Kubernetes plug-in configuration and overrides any changes that were made to the `PodTemplate` through the Jenkins UI between changes to the config map.
96
157
97
-
To use a container image as a Jenkins agent, the image must run the agent as an entrypoint. For more details about this, refer to the official https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds#Distributedbuilds-Launchslaveagentheadlessly[Jenkins documentation].
158
+
To use a container image as a Jenkins agent, the image must run the agent as an entry point. For more details, see the official https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds#Distributedbuilds-Launchslaveagentheadlessly[Jenkins documentation].
Copy file name to clipboardExpand all lines: modules/images-other-jenkins-create-service.adoc
+10-1Lines changed: 10 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@
7
7
8
8
Templates provide parameter fields to define all the environment variables with predefined default values. {product-title} provides templates to make creating a new Jenkins service easy. The Jenkins templates should be registered in the default `openshift` project by your cluster administrator during the initial cluster setup.
9
9
10
-
The two available templates both define deployment configuration and a service. The templates differ in their storage strategy, which affects whether or not the Jenkins content persists across a pod restart.
10
+
The two available templates both define deployment configuration and a service. The templates differ in their storage strategy, which affects whether the Jenkins content persists across a pod restart.
Copy file name to clipboardExpand all lines: modules/images-other-jenkins-env-var.adoc
+18-3Lines changed: 18 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,16 +70,15 @@ By default, the JVM sets the initial heap size.
70
70
|Default: `300000` - 5 minutes
71
71
72
72
|`OVERRIDE_PV_CONFIG_WITH_IMAGE_CONFIG`
73
-
|When running this image with an {product-title} persistent volume (PV) for the Jenkins configuration directory, the transfer of configuration from the image to the PV is performed only the first time the image starts because the PV is assigned when the persistent volume claim (PVC) is created. If you create a custom image that extends this image and updates configuration in the custom image after the initial startup, the configuration is not copied over unless you set this environment variable to `true`.
73
+
|When running this image with an {product-title} persistent volume (PV) for the Jenkins configuration directory, the transfer of configuration from the image to the PV is performed only the first time the image starts because the PV is assigned when the persistent volume claim (PVC) is created. If you create a custom image that extends this image and updates the configuration in the custom image after the initial startup, the configuration is not copied over unless you set this environment variable to `true`.
74
74
|Default: `false`
75
75
76
76
|`OVERRIDE_PV_PLUGINS_WITH_IMAGE_PLUGINS`
77
77
|When running this image with an {product-title} PV for the Jenkins configuration directory, the transfer of plug-ins from the image to the PV is performed only the first time the image starts because the PV is assigned when the PVC is created. If you create a custom image that extends this image and updates plug-ins in the custom image after the initial startup, the plug-ins are not copied over unless you set this environment variable to `true`.
78
78
|Default: `false`
79
79
80
80
|`ENABLE_FATAL_ERROR_LOG_FILE`
81
-
|When running this image with an {product-title} PVC for the Jenkins configuration directory, this environment variable allows the fatal error
82
-
log file to persist when a fatal error occurs. The fatal error file is saved at `/var/lib/jenkins/logs`.
81
+
|When running this image with an {product-title} PVC for the Jenkins configuration directory, this environment variable allows the fatal error log file to persist when a fatal error occurs. The fatal error file is saved at `/var/lib/jenkins/logs`.
83
82
|Default: `false`
84
83
85
84
|`NODEJS_SLAVE_IMAGE`
@@ -90,4 +89,20 @@ log file to persist when a fatal error occurs. The fatal error file is saved at
90
89
|Setting this value overrides the image used for the default maven agent pod configuration. A related image stream tag named `jenkins-agent-maven` is in the project. This variable must be set before Jenkins starts the first time for it to have an effect.
|Setting this value overrides the image used for the `jnlp` container in the sample Kubernetes plug-in pod templates provided with this image. Otherwise, the image from the `jenkins-agent-base:latest` image stream tag in the `openshift` namespace is used.
|Setting this value overrides the image used for the `java-builder` container in the `java-builder` sample Kubernetes plug-in pod templates provided with this image. Otherwise, the image from the `java:latest` image stream tag in the `openshift` namespace is used.
|Setting this value overrides the image used for the `nodejs-builder` container in the `nodejs-builder` sample Kubernetes plug-in pod templates provided with this image. Otherwise, the image from the `nodejs:latest` image stream tag in the `openshift` namespace is used.
Copy file name to clipboardExpand all lines: modules/images-other-jenkins-kubernetes-plugin.adoc
+48-1Lines changed: 48 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@ items:
54
54
- type: ConfigChange
55
55
----
56
56
57
-
It is also possible to override the specification of the dynamically created Jenkins agent pod. The following is a modification to the previous example, which overrides the container memory and specifies an environment variable.
57
+
It is also possible to override the specification of the dynamically created Jenkins agent pod. The following is a modification to the preceding example, which overrides the container memory and specifies an environment variable.
58
58
59
59
.Sample `BuildConfig` that the Jenkins Kubernetes Plug-in, specifying memory limit and environment variable
60
60
[source,yaml]
@@ -100,3 +100,50 @@ spec:
100
100
<9> The node stanza references the name of the defined pod template.
101
101
102
102
By default, the pod is deleted when the build completes. This behavior can be modified with the plug-in or within a pipeline Jenkinsfile.
103
+
104
+
Upstream Jenkins has more recently introduced a YAML declarative format for defining a `podTemplate` pipeline DSL in-line with your pipelines. An example of this format, using the sample `java-builder` pod template that is defined in the {product-title} Jenkins image:
{product-title} provides three images that are suitable for use as Jenkins agents: the `Base`, `Maven`, and `Node.js` images.
8
+
{product-title} provides Base, Maven, and Node.js images for use as Jenkins agents.
9
9
10
-
The first is a base image for Jenkins agents:
10
+
The Base image for Jenkins agents does the following:
11
11
12
-
* It pulls in both the required tools, headless Java, the Jenkins JNLP client, and the useful ones including `git`, `tar`, `zip`, and `nss` among others.
13
-
* It establishes the JNLP agent as the entrypoint.
14
-
* It includes the `oc` client tooling for invoking command line operations from within Jenkins jobs.
15
-
* It provides Dockerfiles for both Red Hat Enterprise Linux (RHEL) and `localdev` images.
12
+
* Pulls in both the required tools, headless Java, the Jenkins JNLP client, and the useful ones, including `git`, `tar`, `zip`, and `nss`, among others.
13
+
* Establishes the JNLP agent as the entry point.
14
+
* Includes the `oc` client tooling for invoking command line operations from within Jenkins jobs.
15
+
* Provides Dockerfiles for both Red Hat Enterprise Linux (RHEL) and `localdev` images.
16
16
17
-
Two more images that extend the base image are also provided:
18
-
19
-
* Maven v3.5 image
20
-
* Node.js v10 image and Node.js v12 image
21
-
22
-
The Maven and Node.js Jenkins agent images provide Dockerfiles for the Universal Base Image (UBI) that you can reference when building new agent images. Also note the `contrib` and `contrib/bin` subdirectories. They allow for the insertion of configuration files and executable scripts for your image.
17
+
The Maven v3.5, Node.js v10, and Node.js v12 images extend the Base image. They provide Dockerfiles for the Universal Base Image (UBI) that you can reference when building new agent images. Also note the `contrib` and `contrib/bin` subdirectories, which enable you to insert configuration files and executable scripts for your image.
23
18
24
19
[IMPORTANT]
25
20
====
26
-
Use and extend an appropriate agent image version for the your of {product-title}. If the `oc` client version that is embedded in the agent image is not compatible with the {product-title} version, unexpected behavior can result.
21
+
Use a version of the agent image that is appropriate for your {product-title} release version. Embedding an `oc` client version that is not compatible with the {product-title} version can cause unexpected behavior.
27
22
====
28
23
24
+
The {product-title} Jenkins image also defines the following sample Pod templates to illustrate how you can use these agent images with the Jenkins Kubernetes plug-in:
25
+
26
+
- The `maven` pod template, which uses a single container that uses the {product-title} Maven Jenkins agent image.
27
+
- The `nodejs` pod template, which uses a single container that uses the {product-title} Node.js Jenkins agent image.
28
+
- The `java-builder` pod template, which employs two containers. One is the `jnlp` container, which uses the {product-title} Base agent image and handles the JNLP contract for starting and stopping Jenkins agents. The second is the `java` container which uses the `java` {product-title} Sample ImageStream, which contains the various Java binaries, including the Maven binary `mvn`, for building code.
29
+
- The `nodejs-builder` pod template, which employs two containers. One is the `jnlp` container, which uses the {product-title} Base agent image and handles the JNLP contract for starting and stopping Jenkins agents. The second is the `nodejs` container which uses the `nodejs` {product-title} Sample ImageStream, which contains the various Node.js binaries, including the `npm` binary, for building code.
0 commit comments