ci: align workflows with pipeline-actions composite actions
All checks were successful
Check scripts syntax / check-scripts-syntax (push) Successful in 3s
Test automated-nfs-backup / test-automated-nfs-backup (push) Successful in 3s
Haven Notify Build and Deploy / Build Haven Notify Image (push) Successful in 22s
Haven Notify Build and Deploy / Deploy Haven Notify (internal) (push) Successful in 10s
All checks were successful
Check scripts syntax / check-scripts-syntax (push) Successful in 3s
Test automated-nfs-backup / test-automated-nfs-backup (push) Successful in 3s
Haven Notify Build and Deploy / Build Haven Notify Image (push) Successful in 22s
Haven Notify Build and Deploy / Deploy Haven Notify (internal) (push) Successful in 10s
- haven-notify.yaml: replace hand-rolled build+deploy (broken docker/build-push-action remote-builder path) with pipeline-actions build-and-push + deploy-restart; full Gitea uses: URLs; ubuntu-amd64. - main.yaml / test-automated-nfs-backup.yaml: runner label ubuntu-latest -> ubuntu-amd64. - haven-notify/README.md: point to infra/haven-notify.yaml in the haven repo; fix secret name to discord-webhook/HAVEN_WEBHOOK_URL.
This commit is contained in:
@@ -10,80 +10,32 @@ on:
|
|||||||
workflow_dispatch: {}
|
workflow_dispatch: {}
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY_HOST: git.ivanch.me
|
IMAGE: git.ivanch.me/ivanch/haven-notify
|
||||||
REGISTRY_USERNAME: ivanch
|
|
||||||
IMAGE_NOTIFY: ${{ env.REGISTRY_HOST }}/ivanch/haven-notify
|
|
||||||
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_haven_notify:
|
build:
|
||||||
name: Build Haven Notify Image
|
name: Build Haven Notify Image
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-amd64
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- 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
|
|
||||||
|
|
||||||
- name: Build and Push Multi-Arch Image
|
- 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:
|
with:
|
||||||
push: true
|
image: ${{ env.IMAGE }}
|
||||||
context: haven-notify
|
registry_password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
platforms: linux/amd64,linux/arm64
|
ssh_key: ${{ secrets.SSH_KEY_DOCKERBUILD }}
|
||||||
tags: |
|
build_context: haven-notify
|
||||||
${{ env.IMAGE_NOTIFY }}:latest
|
|
||||||
|
|
||||||
deploy_haven_notify:
|
deploy:
|
||||||
name: Deploy Haven Notify (internal)
|
name: Deploy Haven Notify (internal)
|
||||||
runs-on: ubuntu-amd64
|
runs-on: ubuntu-amd64
|
||||||
needs: build_haven_notify
|
needs: build
|
||||||
steps:
|
steps:
|
||||||
- name: Check KUBE_CONFIG validity
|
- name: Rollout Restart Haven Notify
|
||||||
run: |
|
uses: https://git.ivanch.me/ivanch/pipeline-actions/deploy-restart@main
|
||||||
if [ -z "${KUBE_CONFIG}" ] || [ "${KUBE_CONFIG}" = "" ] || [ "${KUBE_CONFIG// }" = "" ]; then
|
with:
|
||||||
echo "KUBE_CONFIG is not set or is empty."
|
kube_config: ${{ secrets.KUBE_CONFIG }}
|
||||||
exit 1
|
deployment_name: haven-notify
|
||||||
fi
|
namespace: default
|
||||||
|
|
||||||
- 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
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ on: [push]
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-scripts-syntax:
|
check-scripts-syntax:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-amd64
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository code
|
- name: Check out repository code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-automated-nfs-backup:
|
test-automated-nfs-backup:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-amd64
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository code
|
- name: Check out repository code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|||||||
@@ -86,11 +86,11 @@ It's built in Go and can be deployed as a container or managed service.
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Kubernetes
|
### 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.
|
1. Edit the manifest to set your environment variables.
|
||||||
2. Create a generic secret named `WEBHOOK_URL` with `discord-webhook=your_webhook_url`:
|
2. Create a generic secret named `discord-webhook` with `HAVEN_WEBHOOK_URL=your_webhook_url`:
|
||||||
- `kubectl create secret generic WEBHOOK_URL --from-literal=discord-webhook=<your_webhook_url> -n <namespace>`
|
- `kubectl create secret generic discord-webhook --from-literal=HAVEN_WEBHOOK_URL=<your_webhook_url> -n <namespace>`
|
||||||
3. Apply deployment:
|
3. Apply deployment (from the `haven` repo):
|
||||||
```sh
|
```sh
|
||||||
kubectl apply -f deploy/haven-notify.yaml
|
kubectl apply -f infra/haven-notify.yaml
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user