diff --git a/.gitea/workflows/deploy-rules.yml b/.gitea/workflows/deploy-rules.yml new file mode 100644 index 0000000..6367758 --- /dev/null +++ b/.gitea/workflows/deploy-rules.yml @@ -0,0 +1,33 @@ +name: Deploy alert rules + +on: + push: + branches: [main] + paths: + - 'rules/**' + +jobs: + deploy: + runs-on: alpine + steps: + - name: Install tools + run: | + apk add --no-cache curl bash git openssh-client openssl nodejs + curl -LO "https://dl.k8s.io/release/$(curl -Ls https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + chmod +x kubectl && mv kubectl /usr/local/bin/ + + - uses: actions/checkout@v4 + + - name: Configure kubeconfig + run: | + mkdir -p $HOME/.kube + echo "${{ secrets.KUBECONFIG }}" | base64 -d > $HOME/.kube/config + chmod 600 $HOME/.kube/config + + - name: Deploy rules + run: kubectl apply -f rules/ -n monitoring + + - name: Verify + run: | + sleep 10 + kubectl get prometheusrule -n monitoring