{{- $root := . -}}
{{ range .Values.jenkins.configuration.configurationAsCode }}
  {{ if .content }}
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .configMapName }}
  namespace: {{ $root.Values.jenkins.namespace }}
{{- with .content }}
data: {{ toYaml . | nindent 2 }}
{{- end }}
  {{ end }}
{{ end }}

{{ range .Values.jenkins.configuration.groovyScripts }}
  {{ if .content }}
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .configMapName }}
  namespace: {{ $root.Values.jenkins.namespace }}
{{- with .content }}
data: {{ toYaml . | nindent 2 }}
{{- end }}
  {{ end }}
{{ end }}