{{- define "override_config_map" }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "jenkins.fullname" . }}
data:
config.xml: |-
{{ .Values.Master.ImageTag }}
0
NORMAL
{{ .Values.Master.UseSecurity }}
true
false
${JENKINS_HOME}/workspace/${ITEM_FULLNAME}
${ITEM_ROOTDIR}/builds
kubernetes
{{- if .Values.Agent.Enabled }}
default
2147483647
0
{{- $local := dict "first" true }}
{{- range $key, $value := .Values.Agent.NodeSelector }}
{{- if not $local.first }},{{- end }}
{{- $key }}={{ $value }}
{{- $_ := set $local "first" false }}
{{- end }}
EXCLUSIVE
{{- range $index, $volume := .Values.Agent.volumes }}
{{- range $key, $value := $volume }}{{- if not (eq $key "type") }}
<{{ $key }}>{{ $value }}{{ $key }}>
{{- end }}{{- end }}
{{- end }}
jnlp
{{ .Values.Agent.Image }}:{{ .Values.Agent.ImageTag }}
{{- if .Values.Agent.Privileged }}
true
{{- else }}
false
{{- end }}
{{ .Values.Agent.AlwaysPullImage }}
/home/jenkins
${computer.jnlpmac} ${computer.name}
false
{{.Values.Agent.Cpu}}
{{.Values.Agent.Memory}}
{{.Values.Agent.Cpu}}
{{.Values.Agent.Memory}}
JENKINS_URL
http://{{ template "jenkins.fullname" . }}:{{.Values.Master.ServicePort}}{{ default "" .Values.Master.JenkinsUriPrefix }}
{{- if .Values.Agent.ImagePullSecret }}
{{ .Values.Agent.ImagePullSecret }}
{{- else }}
{{- end }}
{{- end -}}
{{- if .Values.Pod.Enabled }}
{{ .Values.Pod.Label }}
2147483647
0
{{- $local := dict "first" true }}
{{- range $key, $value := .Values.Pod.NodeSelector }}
{{- if not $local.first }},{{- end }}
{{- $key }}={{ $value }}
{{- $_ := set $local "first" false }}
{{- end }}
NORMAL
{{- range $index, $volume := .Values.Pod.volumes }}
{{- range $key, $value := $volume }}{{- if not (eq $key "type") }}
<{{ $key }}>{{ $value }}{{ $key }}>
{{- end }}{{- end }}
{{- end }}
{{ .Values.Pod.Label }}
{{ .Values.Pod.Image }}:{{ .Values.Pod.ImageTag }}
{{- if .Values.Pod.Privileged }}
true
{{- else }}
false
{{- end }}
{{ .Values.Pod.AlwaysPullImage }}
/home/jenkins
{{ .Values.Pod.Command }}
{{ .Values.Pod.Args }}
{{- if .Values.Pod.TTY }}
true
{{- else }}
false
{{- end }}
{{.Values.Pod.Cpu}}
{{.Values.Pod.Memory}}
{{.Values.Pod.Cpu}}
{{.Values.Pod.Memory}}
PGP_PASSPHRASE
molgenis-pipeline-env-secret
pgpPassphrase
PGP_SECRETKEY
keyfile:/root/.m2/key.asc
SONAR_TOKEN
molgenis-pipeline-env-secret
sonarToken
CODECOV_TOKEN
molgenis-pipeline-env-secret
codecovToken
GITHUB_TOKEN
molgenis-pipeline-env-secret
githubToken
{{- if .Values.Pod.ImagePullSecret }}
{{ .Values.Pod.ImagePullSecret }}
{{- else }}
{{- end }}
{{- end -}}
https://kubernetes.default
false
{{ .Release.Namespace }}
http://{{ template "jenkins.fullname" . }}:{{.Values.Master.ServicePort}}{{ default "" .Values.Master.JenkinsUriPrefix }}
{{ template "jenkins.fullname" . }}-agent:50000
10
5
0
0
5
0
All
false
false
All
50000
{{- range .Values.Master.DisabledAgentProtocols }}
{{ . }}
{{- end }}
{{- if .Values.Master.CSRF.DefaultCrumbIssuer.Enabled }}
{{- if .Values.Master.CSRF.DefaultCrumbIssuer.ProxyCompatability }}
true
{{- end }}
{{- end }}
true
{{- if .Values.Master.ScriptApproval }}
scriptapproval.xml: |-
{{- range $key, $val := .Values.Master.ScriptApproval }}
{{ $val }}
{{- end }}
{{- end }}
jenkins.CLI.xml: |-
{{- if .Values.Master.CLI }}
true
{{- else }}
false
{{- end }}
apply_config.sh: |-
mkdir -p /usr/share/jenkins/ref/secrets/;
echo "false" > /usr/share/jenkins/ref/secrets/slave-to-master-security-kill-switch;
cp -n /var/jenkins_config/config.xml /var/jenkins_home;
cp -n /var/jenkins_config/jenkins.CLI.xml /var/jenkins_home;
{{- if .Values.Master.InstallPlugins }}
# Install missing plugins
cp /var/jenkins_config/plugins.txt /var/jenkins_home;
rm -rf /usr/share/jenkins/ref/plugins/*.lock
/usr/local/bin/install-plugins.sh `echo $(cat /var/jenkins_home/plugins.txt)`;
# Copy plugins to shared volume
cp -n /usr/share/jenkins/ref/plugins/* /var/jenkins_plugins;
{{- end }}
{{- if .Values.Master.ScriptApproval }}
cp -n /var/jenkins_config/scriptapproval.xml /var/jenkins_home/scriptApproval.xml;
{{- end }}
{{- if .Values.Master.InitScripts }}
mkdir -p /var/jenkins_home/init.groovy.d/;
cp -n /var/jenkins_config/*.groovy /var/jenkins_home/init.groovy.d/
{{- end }}
{{- if .Values.Master.CredentialsXmlSecret }}
cp -n /var/jenkins_credentials/credentials.xml /var/jenkins_home;
{{- end }}
{{- if .Values.Master.SecretsFilesSecret }}
cp -n /var/jenkins_secrets/* /usr/share/jenkins/ref/secrets;
{{- end }}
{{- if .Values.Master.Jobs }}
for job in $(ls /var/jenkins_jobs); do
mkdir -p /var/jenkins_home/jobs/$job
cp -n /var/jenkins_jobs/$job /var/jenkins_home/jobs/$job/config.xml
done
{{- end }}
{{- range $key, $val := .Values.Master.InitScripts }}
init{{ $key }}.groovy: |-
{{ $val | indent 4 }}
{{- end }}
plugins.txt: |-
{{- if .Values.Master.InstallPlugins }}
{{- range $index, $val := .Values.Master.InstallPlugins }}
{{ $val | indent 4 }}
{{- end }}
{{- end }}
{{- end }}