Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 45 additions & 9 deletions helm-deploy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,24 @@ inputs:
namespace:
description: "The namespace in which to deploy the Helm chart and application"
required: true
values-file:
description: "Path to the Helm values file"
required: true
image-tag:
description: "Tag of the container image"
default: "latest"
timeout:
description: "Timeout for the Helm command"
default: "5m"
working-directory:
description: "The working directory"
default: "."
values-file:
description: "Path to the Helm values file"
required: true
grafana-dashboards-folder:
description: "Folder containing Grafana dashboards"
default: "dashboards"
grafana-alerts-folder:
description: "Folder containing Grafana alerts"
default: "alerts"
timeout:
description: "Timeout for the Helm command"
default: "5m"

runs:
using: "composite"
Expand Down Expand Up @@ -69,15 +75,45 @@ runs:
yq -i '.appVersion = "${{ github.sha }}" | .appVersion style="double"' \
${{ inputs.helm-package }}/Chart.yaml

- name: Collect Grafana dashboards and alerts
id: grafana-files
shell: bash
working-directory: ${{ inputs.working-directory }}
run: |
SET_FILE_ARGS=""

if [[ -d "${{ inputs.grafana-dashboards-folder }}" ]] && [[ "$(ls -A "${{ inputs.grafana-dashboards-folder }}")" ]]; then
i=0
for f in "${{ inputs.grafana-dashboards-folder }}"/*; do
if [[ -f "$f" ]]; then
SET_FILE_ARGS+=" --set-file grafana.dashboards[$i]=$f"
((i++))
fi
done
fi

if [[ -d "${{ inputs.grafana-alerts-folder }}" ]] && [[ "$(ls -A "${{ inputs.grafana-alerts-folder }}")" ]]; then
i=0
for f in "${{ inputs.grafana-alerts-folder }}"/*; do
if [[ -f "$f" ]]; then
SET_FILE_ARGS+=" --set-file grafana.alerts[$i]=$f"
((i++))
fi
done
fi

echo "set-file-args=$SET_FILE_ARGS" >> $GITHUB_OUTPUT

- name: Deploy Helm chart
shell: bash
working-directory: ${{ inputs.working-directory }}
env:
HELM_DRIVER: configmaps
run: |
helm upgrade --wait --install ${{ inputs.release-name }} ./${{ inputs.helm-package }} \
--namespace ${{ inputs.namespace }} \
--history-max 10 \
--values ${{ inputs.values-file }} \
--atomic --timeout ${{ inputs.timeout }} \
--set image.tag=${{ inputs.image-tag }}
--set image.tag=${{ inputs.image-tag }} \
--namespace ${{ inputs.namespace }} \
--values ${{ inputs.values-file }} \
${{ steps.grafana-files.outputs.set-file-args }}