@@ -26,18 +26,24 @@ inputs:
2626 namespace :
2727 description : " The namespace in which to deploy the Helm chart and application"
2828 required : true
29- values-file :
30- description : " Path to the Helm values file"
31- required : true
3229 image-tag :
3330 description : " Tag of the container image"
3431 default : " latest"
35- timeout :
36- description : " Timeout for the Helm command"
37- default : " 5m"
3832 working-directory :
3933 description : " The working directory"
4034 default : " ."
35+ values-file :
36+ description : " Path to the Helm values file"
37+ required : true
38+ grafana-dashboards-folder :
39+ description : " Folder containing Grafana dashboards"
40+ default : " dashboards"
41+ grafana-alerts-folder :
42+ description : " Folder containing Grafana alerts"
43+ default : " alerts"
44+ timeout :
45+ description : " Timeout for the Helm command"
46+ default : " 5m"
4147
4248runs :
4349 using : " composite"
@@ -69,15 +75,45 @@ runs:
6975 yq -i '.appVersion = "${{ github.sha }}" | .appVersion style="double"' \
7076 ${{ inputs.helm-package }}/Chart.yaml
7177
78+ - name : Collect Grafana dashboards and alerts
79+ id : grafana-files
80+ shell : bash
81+ working-directory : ${{ inputs.working-directory }}
82+ run : |
83+ SET_FILE_ARGS=""
84+
85+ if [[ -d "${{ inputs.grafana-dashboards-folder }}" ]] && [[ "$(ls -A "${{ inputs.grafana-dashboards-folder }}")" ]]; then
86+ i=0
87+ for f in "${{ inputs.grafana-dashboards-folder }}"/*; do
88+ if [[ -f "$f" ]]; then
89+ SET_FILE_ARGS+=" --set-file grafana.dashboards[$i]=$f"
90+ ((i++))
91+ fi
92+ done
93+ fi
94+
95+ if [[ -d "${{ inputs.grafana-alerts-folder }}" ]] && [[ "$(ls -A "${{ inputs.grafana-alerts-folder }}")" ]]; then
96+ i=0
97+ for f in "${{ inputs.grafana-alerts-folder }}"/*; do
98+ if [[ -f "$f" ]]; then
99+ SET_FILE_ARGS+=" --set-file grafana.alerts[$i]=$f"
100+ ((i++))
101+ fi
102+ done
103+ fi
104+
105+ echo "set-file-args=$SET_FILE_ARGS" >> $GITHUB_OUTPUT
106+
72107 - name : Deploy Helm chart
73108 shell : bash
74109 working-directory : ${{ inputs.working-directory }}
75110 env :
76111 HELM_DRIVER : configmaps
77112 run : |
78113 helm upgrade --wait --install ${{ inputs.release-name }} ./${{ inputs.helm-package }} \
79- --namespace ${{ inputs.namespace }} \
80114 --history-max 10 \
81- --values ${{ inputs.values-file }} \
82115 --atomic --timeout ${{ inputs.timeout }} \
83- --set image.tag=${{ inputs.image-tag }}
116+ --set image.tag=${{ inputs.image-tag }} \
117+ --namespace ${{ inputs.namespace }} \
118+ --values ${{ inputs.values-file }} \
119+ ${{ steps.grafana-files.outputs.set-file-args }}
0 commit comments