# helm_charts_install-plugins.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ template "sonarqube.fullname" . }}-install-plugins
  labels:
    app: {{ template "sonarqube.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
data:
  install_plugins.sh: |-
    cd {{ .Values.sonarqubeFolder }}/extensions/plugins/tmp
    {{- if .Values.plugins.install }}
      {{ range $index, $val := .Values.plugins.install }}echo {{ $val | quote }} >> plugins.txt
      {{ end }}
      cat plugins.txt | xargs -n 1 -P 8 wget --no-check-certificate
      rm plugins.txt
    {{- end }}