From b2dbbc029afc3acea06cedd5b2a8848be172cebf Mon Sep 17 00:00:00 2001 From: Fleur Kelpin Date: Wed, 27 Jun 2018 16:54:50 +0200 Subject: [PATCH] Add molgenis-maven pod template --- molgenis-jenkins/templates/config.tpl | 260 ++++++++++++++++++++++++++ molgenis-jenkins/values.yaml | 2 +- 2 files changed, 261 insertions(+), 1 deletion(-) diff --git a/molgenis-jenkins/templates/config.tpl b/molgenis-jenkins/templates/config.tpl index e69de29..998a71d 100644 --- a/molgenis-jenkins/templates/config.tpl +++ b/molgenis-jenkins/templates/config.tpl @@ -0,0 +1,260 @@ +{{- 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 }} + NORMAL + +{{- range $index, $volume := .Values.Agent.volumes }} + +{{- range $key, $value := $volume }}{{- if not (eq $key "type") }} + <{{ $key }}>{{ $value }} +{{- 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 }} + + + + + + + false + false + false + 2147483647 + 100 + 0 + 0 + + + EXCLUSIVE + false + + false + + + + /var/run/docker.sock + /var/run/docker.sock + + + + + maven + webhost12.service.rug.nl/molgenis/molgenis-maven:latest + false + true + /home/jenkins + /bin/sh -c + cat + true + + + + + + + + + 0 + 0 + 0 + 0 + 0 + + + + + + + + +{{- 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 }} \ No newline at end of file diff --git a/molgenis-jenkins/values.yaml b/molgenis-jenkins/values.yaml index cd770cc..02af41a 100644 --- a/molgenis-jenkins/values.yaml +++ b/molgenis-jenkins/values.yaml @@ -67,6 +67,6 @@ jenkins: # useful to manage encryption keys used for credentials.xml for instance (such as # master.key and hudson.util.Secret) # SecretsFilesSecret: jenkins-secrets - CustomConfigMap: false + CustomConfigMap: true rbac: install: true \ No newline at end of file