forked from openshift/openshift-docs
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add using images Jenkins and PR14030 follow-up
- Loading branch information
Showing
37 changed files
with
1,095 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// Module included in the following assemblies: | ||
// | ||
// * images/using_images/images-other-jenkins-agent.adoc | ||
|
||
[id="images-other-jenkins-agent-env-var_{context}"] | ||
= Jenkins agent environment variables | ||
|
||
Each Jenkins agent container can be configured with the following environment | ||
variables. | ||
|
||
[options="header"] | ||
|=== | ||
| Variable | Definition | Example values and settings | ||
|
||
|`JAVA_MAX_HEAP_PARAM`, | ||
`CONTAINER_HEAP_PERCENT`, | ||
`JENKINS_MAX_HEAP_UPPER_BOUND_MB` | ||
|These values control the maximum heap size of the Jenkins JVM. If | ||
`JAVA_MAX_HEAP_PARAM` is set, its value takes | ||
precedence. Otherwise, the maximum heap size is dynamically calculated as | ||
`CONTAINER_HEAP_PERCENT` of the container | ||
memory limit, optionally capped at `JENKINS_MAX_HEAP_UPPER_BOUND_MB` MiB. | ||
|
||
By default, the maximum heap size of the Jenkins JVM is set to 50% of the | ||
container memory limit with no cap. | ||
|`JAVA_MAX_HEAP_PARAM` example setting: `-Xmx512m` | ||
|
||
`CONTAINER_HEAP_PERCENT` default: `0.5`, or 50% | ||
|
||
`JENKINS_MAX_HEAP_UPPER_BOUND_MB` example setting: `512 MiB` | ||
|
||
|`JAVA_INITIAL_HEAP_PARAM`, | ||
`CONTAINER_INITIAL_PERCENT` | ||
|These values control the initial heap size of the Jenkins JVM. If | ||
`JAVA_INITIAL_HEAP_PARAM` is set, its value takes | ||
precedence. Otherwise, the initial heap size is dynamically calculated as | ||
`CONTAINER_INITIAL_PERCENT` of the | ||
dynamically calculated maximum heap size. | ||
|
||
By default, the JVM sets the initial heap size. | ||
|`JAVA_INITIAL_HEAP_PARAM` example setting: `-Xms32m` | ||
|
||
`CONTAINER_INITIAL_PERCENT` example setting: `0.1`, or 10% | ||
|
||
|`CONTAINER_CORE_LIMIT` | ||
|If set, specifies an integer number of cores used for sizing numbers of internal | ||
JVM threads. | ||
|Example setting: `2` | ||
|
||
|`JAVA_TOOL_OPTIONS` | ||
|Specifies options to apply to all JVMs running in this container. It is not | ||
recommended to override this value. | ||
|Default: `-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Dsun.zip.disableMemoryMapping=true` | ||
|
||
|`JAVA_GC_OPTS` | ||
|Specifies Jenkins JVM garbage collection parameters. It is not recommended to | ||
override this value. | ||
|Default: `-XX:+UseParallelGC -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90` | ||
|
||
|`JENKINS_JAVA_OVERRIDES` | ||
|Specifies additional options for the Jenkins JVM. These options are appended to | ||
all other options, including the Java options above, and can be used to override | ||
any of them, if necessary. Separate each additional option with a space; if any | ||
option contains space characters, escape them with a backslash. | ||
|Example settings: `-Dfoo -Dbar`; `-Dfoo=first\ value -Dbar=second\ value` | ||
|
||
|=== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Module included in the following assemblies: | ||
// | ||
// * images/using_images/images-other-jenkins-agent.adoc | ||
|
||
[id="images-other-jenkins-agent-gradle_{context}"] | ||
= Jenkins agent Gradle builds | ||
|
||
Hosting Gradle builds in the Jenkins agent on {product-title} presents | ||
additional complications because in addition to the Jenkins JNLP agent and | ||
Gradle JVMs, Gradle spawns a third JVM to run tests if they are specified. | ||
|
||
|
||
The following settings are suggested as a starting point for running Gradle | ||
builds in a memory constrained Jenkins agent on {product-title}. You can modify | ||
these settings as required. | ||
|
||
* Ensure the long-lived Gradle daemon is disabled by adding | ||
`org.gradle.daemon=false` to the `gradle.properties` file. | ||
* Disable parallel build execution by ensuring `org.gradle.parallel=true` is not | ||
set in the `gradle.properties` file and that `--parallel` is not set as a command | ||
line argument. | ||
* To prevent Java compilations running out-of-process, set `java { options.fork = | ||
false }` in the `build.gradle` file . | ||
* Disable multiple additional test processes by ensuring | ||
`test { maxParallelForks = 1 }` is set in the `build.gradle` file. | ||
* Override the Gradle JVM memory parameters by the `GRADLE_OPTS`, `JAVA_OPTS` or | ||
`JAVA_TOOL_OPTIONS` environment. | ||
variables. | ||
* Set the maximum heap size and JVM arguments for any Gradle test JVM by defining | ||
the `maxHeapSize` and `jvmArgs` settings in `build.gradle`, or though the | ||
`-Dorg.gradle.jvmargs` command line argument. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Module included in the following assemblies: | ||
// | ||
// * images/using_images/images-other-jenkins-agent.adoc | ||
|
||
[id="images-other-jenkins-agent-images_{context}"] | ||
= Jenkins agent images | ||
|
||
The {product-title} Jenkins agent images are available on `quay.io` or | ||
`registry.redhat.io`. | ||
|
||
Jenkins images are available through the Red Hat Registry: | ||
|
||
---- | ||
$ docker pull regsitry.redhat.io/openshift4/ose-jenkins:<v4.1.4> | ||
$ docker pull regsitry.redhat.io/openshift4/ose-jenkins-agent-nodejs:<v4.1.4> | ||
$ docker pull regsitry.redhat.io/openshift4/ose-jenkins-agent-maven:<v4.1.4> | ||
$ docker pull regsitry.redhat.io/openshift4/ose-jenkins-agent-base:<v4.1.4> | ||
---- | ||
|
||
To use these images, you can either access them directly from `quay.io` or | ||
`registry.redhat.io` or push them into your {product-title} container image | ||
registry. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Module included in the following assemblies: | ||
// | ||
// * images/using_images/images-other-jenkins-agent.adoc | ||
|
||
[id="images-other-jenkins-agent-memory_{context}"] | ||
= Jenkins agent memory requirements | ||
|
||
A JVM is used in all Jenkins agents to host the Jenkins JNLP agent as well as | ||
to run any Java applications such as `javac`, Maven, or Gradle. | ||
|
||
For memory efficiency, the Jenkins image dynamically uses a 32-bit | ||
JVM if it runs in a container with a memory limit under 2 GiB by default. The | ||
JVM choice applies by default both for the Jenkins JNLP agent as well as for any | ||
other Java processes within the agent container. | ||
|
||
By default, the Jenkins JNLP agent JVM uses 50% of the container memory limit for | ||
its heap. This value can be modified by the `CONTAINER_HEAP_PERCENT` | ||
environment variable. It can also be capped at an upper limit or overridden | ||
entirely. | ||
|
||
By default any other processes run in the Jenkins agent container, such as | ||
shell scripts or `oc` commands run from pipelines, cannot use more | ||
than the remaining 50% memory limit without provoking an OOM kill. | ||
|
||
By default, each further JVM process that runs in a Jenkins agent container uses | ||
up to 25% of the container memory limit for it's heap. It might be necessary to | ||
tune this limit for many build workloads. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Module included in the following assemblies: | ||
// | ||
// * images/using_images/images-other-jenkins-agent.adoc | ||
|
||
[id="images-other-jenkins-agent-pod-retention_{context}"] | ||
= Jenkins agent pod retention | ||
|
||
Jenkins agent pods, also known as slave pods, are deleted by default after the | ||
build completes or is stopped. This behavior can be changed by the Kubernetes | ||
plug-in _Pod Retention_ setting. Pod retention can be set for all Jenkins | ||
builds, with overrides for each pod template. The following behaviors are | ||
supported: | ||
|
||
* `Always` keeps the build pod regardless of build result. | ||
* `Default` uses the plug-in value (pod template only). | ||
* `Never` always deletes the pod. | ||
* `On Failure` keeps the pod if it fails during the build. | ||
|
||
You can override pod retention in the pipeline Jenkinsfile: | ||
|
||
[source,groovy] | ||
---- | ||
podTemplate(label: "mypod", | ||
cloud: "openshift", | ||
inheritFrom: "maven", | ||
podRetention: onFailure(), <1> | ||
containers: [ | ||
... | ||
]) { | ||
node("mypod") { | ||
... | ||
} | ||
} | ||
---- | ||
<1> Allowed values for `podRetention` are `never()`, `onFailure()`, `always()`, | ||
and `default()`. | ||
|
||
[WARNING] | ||
==== | ||
Pods that are kept might continue to run and count against resource quotas. | ||
==== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Module included in the following assemblies: | ||
// | ||
// * images/using_images/images-other-jenkins.adoc | ||
|
||
[id="images-other-jenkins-auth_{context}"] | ||
= Jenkins authentication | ||
|
||
Jenkins authentication is used by default if the image is run directly, without | ||
using a template. | ||
|
||
The first time Jenkins starts, the configuration is created along with the | ||
administrator user and password. The default user credentials are `admin` and | ||
`password`. Configure the default password by setting the `JENKINS_PASSWORD` | ||
environment variable when using, and only when using, standard Jenkins | ||
authentication. | ||
|
||
.Procedure | ||
|
||
* Create a Jenkins application that uses standard Jenkins authentication: | ||
+ | ||
---- | ||
$ oc new-app -e \ | ||
JENKINS_PASSWORD=<password> \ | ||
openshift4/ose-jenkins | ||
---- |
Oops, something went wrong.