diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9cb43c4..376bf53 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -105,3 +105,30 @@ jobs: - uses: actions/checkout@v5 - name: Push to deploy branch run: git push origin HEAD:deploy --force + notify: + if: always() + needs: [deploy] + runs-on: ubuntu-latest + steps: + - name: Notify success + if: needs.deploy.result == 'success' + run: | + curl -s \ + -H "Title: CI: Deploy succeeded" \ + -H "Priority: low" \ + -H "Tags: white_check_mark" \ + -H "Actions: view, Open workflow run, ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ + -H "Markdown: yes" \ + -d "Commit \`${GITHUB_SHA::7}\` deployed successfully." \ + https://ntfy.sh/splitleaf + - name: Notify failure + if: needs.deploy.result != 'success' + run: | + curl -s \ + -H "Title: CI: Deploy failed" \ + -H "Priority: default" \ + -H "Tags: rotating_light" \ + -H "Actions: view, Open workflow run, ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ + -H "Markdown: yes" \ + -d "Commit \`${GITHUB_SHA::7}\` failed to deploy." \ + https://ntfy.sh/splitleaf diff --git a/modules/nixos/services/alertmanager.nix b/modules/nixos/services/alertmanager.nix index 295e2e7..4a2dcd8 100644 --- a/modules/nixos/services/alertmanager.nix +++ b/modules/nixos/services/alertmanager.nix @@ -75,6 +75,17 @@ in notification = { topic = "splitleaf"; priority = "default"; + templates.title = ''{{ index .Annotations "summary" }}''; + tags = [ + { + condition = ''status == "resolved"''; + tag = "white_check_mark"; + } + { + condition = ''status == "firing"''; + tag = "rotating_light"; + } + ]; }; }; }; diff --git a/modules/nixos/services/prometheus.nix b/modules/nixos/services/prometheus.nix index 182a70c..f9984b5 100644 --- a/modules/nixos/services/prometheus.nix +++ b/modules/nixos/services/prometheus.nix @@ -89,7 +89,10 @@ in expr = "up == 0"; for = "2m"; labels.severity = "critical"; - annotations.summary = "Instance {{ $labels.instance }} down"; + annotations = { + summary = "{{ $labels.instance }} is DOWN"; + description = "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 2 minutes."; + }; }; }; }