Run Gitea workflow on Debian host runner
This commit is contained in:
parent
16053cc9f3
commit
4d22f68da5
|
|
@ -1,5 +1,5 @@
|
||||||
name: Homelab Main
|
name: Homelab Main
|
||||||
# Runner policy: k8s handles running-homelab updates; homelab-debian handles create/recreate operations.
|
# The Debian host runner is the supported online runner for this repository.
|
||||||
|
|
||||||
"on":
|
"on":
|
||||||
push:
|
push:
|
||||||
|
|
@ -9,16 +9,14 @@ name: Homelab Main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
validate:
|
validate:
|
||||||
runs-on: k8s
|
runs-on: homelab-debian
|
||||||
container: golang:1.23-bookworm
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install Toolchain (Python, Node)
|
- name: Check host toolchain
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
# Install PyYAML via apt (avoiding PEP 668)
|
command -v python3
|
||||||
apt-get update && apt-get install -y --no-install-recommends python3-yaml
|
command -v node
|
||||||
# Install Node 18 via binary (using gzipped tarball to avoid xz dependency)
|
python3 -c 'import yaml'
|
||||||
curl -fsSL https://nodejs.org/dist/v18.19.0/node-v18.19.0-linux-x64.tar.gz | tar -xz -C /usr/local --strip-components=1
|
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
|
|
@ -31,16 +29,11 @@ jobs:
|
||||||
./jeannie validate
|
./jeannie validate
|
||||||
|
|
||||||
running-update:
|
running-update:
|
||||||
runs-on: k8s
|
runs-on: homelab-debian
|
||||||
container: golang:1.23-bookworm
|
|
||||||
needs:
|
needs:
|
||||||
- validate
|
- validate
|
||||||
if: ${{ gitea.ref == 'refs/heads/main' }}
|
if: ${{ gitea.ref == 'refs/heads/main' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Install Toolchain (Python)
|
|
||||||
run: |
|
|
||||||
set -e
|
|
||||||
apt-get update && apt-get install -y --no-install-recommends python3-yaml
|
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
|
|
@ -55,7 +48,7 @@ jobs:
|
||||||
echo "Host-managed create/recreate change detected; Debian runner will handle it."
|
echo "Host-managed create/recreate change detected; Debian runner will handle it."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
echo "Running homelab update accepted on the K8s runner."
|
echo "Running homelab update accepted on the Debian runner."
|
||||||
echo "Argo CD will reconcile repo-managed applications from main."
|
echo "Argo CD will reconcile repo-managed applications from main."
|
||||||
|
|
||||||
debian-ops:
|
debian-ops:
|
||||||
|
|
@ -75,7 +68,7 @@ jobs:
|
||||||
printf '%s\n' "${classification}"
|
printf '%s\n' "${classification}"
|
||||||
mode="$(printf '%s\n' "${classification}" | awk -F= '$1 == "mode" { print $2; exit }')"
|
mode="$(printf '%s\n' "${classification}" | awk -F= '$1 == "mode" { print $2; exit }')"
|
||||||
if [ "${mode}" != "debian-ops" ]; then
|
if [ "${mode}" != "debian-ops" ]; then
|
||||||
echo "App-only running-homelab update; K8s runner handled this path."
|
echo "App-only running-homelab update; the update policy handled this path."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
- name: Block automatic deploy for external Gitea changes
|
- name: Block automatic deploy for external Gitea changes
|
||||||
|
|
@ -208,13 +201,18 @@ jobs:
|
||||||
fi
|
fi
|
||||||
if [ "${deploy_dir}" != "${workspace_dir}" ]; then
|
if [ "${deploy_dir}" != "${workspace_dir}" ]; then
|
||||||
echo "Persistent deploy checkout: ${deploy_dir}"
|
echo "Persistent deploy checkout: ${deploy_dir}"
|
||||||
|
if [ -n "$(git -C "${deploy_dir}" status --porcelain)" ]; then
|
||||||
|
echo "Deploy checkout has local changes; refusing to overwrite them." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ "$(git -C "${deploy_dir}" branch --show-current)" != main ]; then
|
||||||
|
echo "Deploy checkout is not on main; refusing to switch branches." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
git -C "${deploy_dir}" fetch "${workspace_dir}" HEAD
|
git -C "${deploy_dir}" fetch "${workspace_dir}" HEAD
|
||||||
git -C "${deploy_dir}" checkout -B main FETCH_HEAD
|
git -C "${deploy_dir}" merge --ff-only FETCH_HEAD
|
||||||
git -C "${deploy_dir}" reset --hard FETCH_HEAD
|
|
||||||
else
|
else
|
||||||
echo "Deploy checkout: ${deploy_dir}"
|
echo "Deploy checkout: ${deploy_dir}"
|
||||||
git -C "${deploy_dir}" checkout -B main HEAD
|
|
||||||
git -C "${deploy_dir}" reset --hard HEAD
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set up local-bootstrap remote if the directory exists
|
# Set up local-bootstrap remote if the directory exists
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,15 @@ The default deployment has zero replicas across all profiles. The active CI
|
||||||
runner is the Debian-host `homelab-gitea-runner.service`; native K3s and Pimox
|
runner is the Debian-host `homelab-gitea-runner.service`; native K3s and Pimox
|
||||||
workers do not provide a host Docker socket automatically.
|
workers do not provide a host Docker socket automatically.
|
||||||
|
|
||||||
|
The `Homelab Main` workflow uses the Debian runner's `homelab-debian:host`
|
||||||
|
label for validation and update jobs. These run directly as the runner user,
|
||||||
|
so Python, PyYAML and Node must already be installed; the workflow does not
|
||||||
|
install packages or download an architecture-specific Node binary. Optional
|
||||||
|
validation tools may be skipped by `./jeannie validate` when unavailable.
|
||||||
|
Main-branch host operations remain automatic where the workflow classifies a
|
||||||
|
change for Debian operations. Its persistent deploy checkout must be clean and
|
||||||
|
on `main`, and it is updated only by a fast-forward merge.
|
||||||
|
|
||||||
Argo CD detects `kustomization.yaml` and renders only namespace, deployment and
|
Argo CD detects `kustomization.yaml` and renders only namespace, deployment and
|
||||||
PVC resources. The neighboring SOPS files and parent `application.yaml` must
|
PVC resources. The neighboring SOPS files and parent `application.yaml` must
|
||||||
not be applied as raw resources. Encrypted API versions/kinds are ciphertext,
|
not be applied as raw resources. Encrypted API versions/kinds are ciphertext,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue