jenkins

by joaquinito2051

Helm chartv1.0.14App v2.222.1

A Helm chart for deploying Jenkins on OpenShift with some additional build agents and plugins

About this chart

Jenkins

Jenkins is an open source automation server which enables developers around the world to reliably build, test, and deploy their software.

Introduction

This chart helps you to create a Jenkins master and agents on Openshift cluster. It also allows you to customize them based on your needs.

Installing Jenkins

To install Jenkins on your current namespace:

helm template -f jenkins/values.yaml jenkins | oc apply -f-

The above command deploys Jenkins on a cluster in the default configuration. The configuration section lists the parameters that can be configured during installation.

Configuration

The following table lists the configurable parameters of the Jenkins chart and their default values.

Jenkins Master

ParameterDescriptionDefault
appNameName of the applicationjenkins
routeEnable openshift routetrue
source_secret.nameName of the secret objectgit-auth
source_secret.usernameUsername of the git accountidm-sa
source_secret.passwordPassword of the git accountthisisdefinitelymypassword
sealed_secret.nameName of the secret objectnexus-password
sealed_secret.usernameEncrypted username dataAgBd8kR+KbG+FiOpYP4SlR80npiNiZI...
sealed_secret.passwordEncrypted password dataAgBd8kR+KbG+FiOpYP4SlR80npiNiZI...
deployment.openshiftauthEnable Openshift OAuth for Jenkins mastertrue
deployment.imagestream.nameImagestream name for Jenkins masterjenkins
deployment.imagestream.tagImagestream tag for Jenkins masterlatest
deployment.limits.memory_requestStarting request of memory that Jenkins master use2Gi
deployment.limits.memory_limitMaximum amount of memory Jenkins master use6Gi
deployment.limits.cpu_requestStarting request of cpu that Jenkins master use500m
deployment.limits.cpu_limitMaximum amount of memory Jenkins master use1
deployment.env_varsEnvironment variables for Jenkins master''
persistence.accessModesAccess mode for Jenkins PV''
persistence.volumeSizeVolume size for Jenkins PV''
services.jenkins.port_namePort name of service for Jenkins masterweb
services.jenkins.portPort of Jenkins master service80
services.jenkins.target_portTarget port of Jenkins master service8080
services.jenkins.selectorSelector for Jenkins master service to match with Jenkins master deploymentjenkins
services.jenkins.annotationsJenkins service annotationservice.alpha.openshift.io/dependencies
services.jenkins-jnlp.port_namePort name of service for Jenkins JNLPagent
services.jenkins-jnlp.portPort of Jenkins master service50000
services.jenkins-jnlp.target_portTarget port of Jenkins JNLP service50000
services.jenkins-jnlp.selectorSelector for Jenkins JNLP service to match with Jenkins master deploymentjenkins
buildconfigs.nameBuild and ImageStream name''
buildconfigs.name.strategy_typeBuild strategy type for JenkinsDocker
buildconfigs.name.source_repoGit repo URL for customhttps://github.com/redhat-cop/containers-quickstarts
buildconfigs.name.source_repo_refGit Reference of custom Jenkinsmaster
buildconfigs.name.source_context_dirThe directory in the source repository where Jenkins master docker build is/
buildconfigs.name.builder_image_kindBuilder image kindImageStreamTag
buildconfigs.name.builder_image_nameBuilder image name for custom build''
buildconfigs.name.builder_image_tagBuilder image tag for custom build''
roleThe value of role value for Jenkins Agent ImageStream. It is used for Jenkins sync plugin to discover agents automaticallyjenkins-slave
configAsCode.configMapThe name of the ConfigMap to create and associate with the Jenkins Deployment in order to be used for Configuration-as-Codenull
configAsCode.bodyThe body content of the configuration-as-code which will be stored in the ConfigMap, mounted in the Jenkins pod, and read in as Configuration by the Configuration-as-Code pluginnull

Environment Variables

There are additional environment variables you can set to customize your Jenkins based on your needs. You can update these values on your values file.

VariableDescriptionDefault
JVM_ARCHJava VM architecturex86_64
DISABLE_ADMINISTRATIVE_MONITORSDisable memory intensive administrative monitorsfalse
ENABLE_FATAL_ERROR_LOG_FILEEnable fatal error log filefalse
JENKINS_OPTSJenkins arguments--sessionTimeout=0
SLACK_BASE_URLSlack base url''
SLACK_ROOMDefault Slack channel''
SLACK_TOKEN_CREDENTIAL_IDSlack token credential ID''
SLACK_TEAMDefault Slack team''
SHARED_LIB_REPOJenkins Shared library repository name''
SHARED_LIB_NAMEJenkins Shared library name''
SHARED_LIB_REFJenkins Shared library reference''
SHARED_LIB_SECRETJenkins Shared library secret''
GITLAB_HOSTHttp address of the GitLab project''
GITLAB_TOKENGitLab API token to access repos and projects''
GITLAB_GROUP_NAMEGitLab group name where projects are storedrht-labs

Jenkins Agents

Following agents are created by default when you install the chart. They are designed to run in OpenShift as described here. You can find more details at containers-quickstarts repository.

  • jenkins-agent-ansible
  • jenkins-agent-arachni
  • jenkins-agent-argocd
  • jenkins-agent-conftest
  • jenkins-agent-erlang
  • jenkins-agent-golang
  • jenkins-agent-graalvm
  • jenkins-agent-gradle
  • jenkins-agent-helm
  • jenkins-agent-image-mgmt
  • jenkins-agent-mongodb
  • jenkins-agent-mvn
  • jenkins-agent-npm
  • jenkins-agent-python
  • jenkins-agent-ruby
  • jenkins-agent-rust

You can remove the ones you do not need by deleting the related imagestream and buildconfig blocks from values file.

Persistence

If you want to set your Jenkins as ephemeral, you should either remove the persistence block from your values file or set persistent value as below during the installation:

helm template --set persistence='' -f jenkins/values.yaml jenkins | oc apply -f-

Deploy jenkins with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has jenkins on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartjenkins is pinned at v1.0.14 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply