diff --git a/.gitea/workflows/haven-notify.yaml b/.gitea/workflows/haven-notify.yaml index bfcbb4a..ab05d9e 100644 --- a/.gitea/workflows/haven-notify.yaml +++ b/.gitea/workflows/haven-notify.yaml @@ -10,80 +10,32 @@ on: workflow_dispatch: {} env: - REGISTRY_HOST: git.ivanch.me - REGISTRY_USERNAME: ivanch - IMAGE_NOTIFY: ${{ env.REGISTRY_HOST }}/ivanch/haven-notify - KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }} + IMAGE: git.ivanch.me/ivanch/haven-notify jobs: - build_haven_notify: + build: name: Build Haven Notify Image - runs-on: ubuntu-22.04 - + runs-on: ubuntu-amd64 steps: - name: Check out repository - uses: actions/checkout@v2 - - - name: Log in to Container Registry - run: | - echo "${{ secrets.REGISTRY_PASSWORD }}" \ - | docker login "${{ env.REGISTRY_HOST }}" \ - -u "${{ env.REGISTRY_USERNAME }}" \ - --password-stdin - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + uses: actions/checkout@v4 - name: Build and Push Multi-Arch Image - uses: docker/build-push-action@v6 + uses: https://git.ivanch.me/ivanch/pipeline-actions/build-and-push@main with: - push: true - context: haven-notify - platforms: linux/amd64,linux/arm64 - tags: | - ${{ env.IMAGE_NOTIFY }}:latest + image: ${{ env.IMAGE }} + registry_password: ${{ secrets.REGISTRY_PASSWORD }} + ssh_key: ${{ secrets.SSH_KEY_DOCKERBUILD }} + build_context: haven-notify - deploy_haven_notify: + deploy: name: Deploy Haven Notify (internal) runs-on: ubuntu-amd64 - needs: build_haven_notify + needs: build steps: - - name: Check KUBE_CONFIG validity - run: | - if [ -z "${KUBE_CONFIG}" ] || [ "${KUBE_CONFIG}" = "" ] || [ "${KUBE_CONFIG// }" = "" ]; then - echo "KUBE_CONFIG is not set or is empty." - exit 1 - fi - - - name: Check out repository - uses: actions/checkout@v2 - - - name: Download and install dependencies - run: | - apt-get update -y - apt-get install -y curl - curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" - install -m 0755 kubectl /usr/local/bin/kubectl - kubectl version --client - - - name: Set up kubeconfig - run: | - cd haven-notify/deploy - echo "$KUBE_CONFIG" > kubeconfig.yaml - env: - KUBE_CONFIG: ${{ env.KUBE_CONFIG }} - - - name: Check connection to cluster - run: | - cd haven-notify/deploy - kubectl --kubeconfig=kubeconfig.yaml cluster-info - - - name: Apply haven-notify deployment - run: | - cd haven-notify/deploy - kubectl --kubeconfig=kubeconfig.yaml apply -f haven-notify.yaml - - - name: Rollout restart haven-notify - run: | - cd haven-notify/deploy - kubectl --kubeconfig=kubeconfig.yaml rollout restart deployment/haven-notify \ No newline at end of file + - name: Rollout Restart Haven Notify + uses: https://git.ivanch.me/ivanch/pipeline-actions/deploy-restart@main + with: + kube_config: ${{ secrets.KUBE_CONFIG }} + deployment_name: haven-notify + namespace: default diff --git a/.gitea/workflows/main.yaml b/.gitea/workflows/main.yaml index 9d5165f..39954a2 100644 --- a/.gitea/workflows/main.yaml +++ b/.gitea/workflows/main.yaml @@ -3,7 +3,7 @@ on: [push] jobs: check-scripts-syntax: - runs-on: ubuntu-latest + runs-on: ubuntu-amd64 steps: - name: Check out repository code uses: actions/checkout@v4 diff --git a/.gitea/workflows/test-automated-nfs-backup.yaml b/.gitea/workflows/test-automated-nfs-backup.yaml index 9bebfeb..b1e1fc2 100644 --- a/.gitea/workflows/test-automated-nfs-backup.yaml +++ b/.gitea/workflows/test-automated-nfs-backup.yaml @@ -9,7 +9,7 @@ on: jobs: test-automated-nfs-backup: - runs-on: ubuntu-latest + runs-on: ubuntu-amd64 steps: - name: Check out repository code uses: actions/checkout@v4 diff --git a/haven-notify/README.md b/haven-notify/README.md index 2576be3..65a126b 100644 --- a/haven-notify/README.md +++ b/haven-notify/README.md @@ -86,11 +86,11 @@ It's built in Go and can be deployed as a container or managed service. ``` ### Kubernetes -Deployment manifest is available at `deploy/haven-notify.yaml`. +The Deployment/Service/Ingress manifest lives in the **`haven`** homelab repo at `infra/haven-notify.yaml` (this repo only holds the Go source + Dockerfile + CI). 1. Edit the manifest to set your environment variables. -2. Create a generic secret named `WEBHOOK_URL` with `discord-webhook=your_webhook_url`: - - `kubectl create secret generic WEBHOOK_URL --from-literal=discord-webhook= -n ` -3. Apply deployment: +2. Create a generic secret named `discord-webhook` with `HAVEN_WEBHOOK_URL=your_webhook_url`: + - `kubectl create secret generic discord-webhook --from-literal=HAVEN_WEBHOOK_URL= -n ` +3. Apply deployment (from the `haven` repo): ```sh - kubectl apply -f deploy/haven-notify.yaml + kubectl apply -f infra/haven-notify.yaml ```