Compare commits

..

2 commits

Author SHA1 Message Date
8b0ef39cdf Merge pull request 'ci: use dedicated host deploy runner' (#56) from codex/use-host-deploy-runner into main
All checks were successful
Dimension Lab website / ci (push) Successful in 19s
Dimension Lab website / deploy (push) Successful in 33s
2026-06-20 17:41:46 +02:00
vince
d00a7b3b80 ci: use dedicated host deploy runner
All checks were successful
Dimension Lab website / ci (pull_request) Successful in 18s
Dimension Lab website / deploy (pull_request) Has been skipped
2026-06-20 17:37:38 +02:00
3 changed files with 34 additions and 20 deletions

View file

@ -48,17 +48,20 @@ jobs:
deploy: deploy:
needs: ci needs: ci
if: github.event_name == 'push' && github.ref == 'refs/heads/main' if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: docker runs-on: deploy
container:
image: ghcr.io/catthehacker/ubuntu:act-latest
options: --security-opt label=disable
timeout-minutes: 30 timeout-minutes: 30
steps: steps:
- name: Checkout - name: Checkout
uses: https://data.forgejo.org/actions/checkout@v4 run: |
with: if [ -d .git ]; then
fetch-depth: 0 git remote set-url origin git@git.dimensionlab.net:vince/dimensionlab-website.git
submodules: false else
git init
git remote add origin git@git.dimensionlab.net:vince/dimensionlab-website.git
fi
git fetch --force --prune --depth=1 origin "$GITHUB_SHA"
git checkout --force --detach "$GITHUB_SHA"
git clean -ffdx
- name: Initialize submodules - name: Initialize submodules
run: | run: |
@ -67,13 +70,14 @@ jobs:
- name: Verify Podman deployment socket - name: Verify Podman deployment socket
run: | run: |
timeout 15s docker version command -v podman
unit="$(timeout 15s docker inspect dimensionlab-website --format '{{ index .Config.Labels "PODMAN_SYSTEMD_UNIT" }}')" command -v systemctl
unit="$(timeout 15s podman inspect dimensionlab-website --format '{{ index .Config.Labels "PODMAN_SYSTEMD_UNIT" }}')"
test "$unit" = "dimensionlab-website.service" test "$unit" = "dimensionlab-website.service"
- name: Deploy production website - name: Deploy production website
env: env:
DEPLOY_CONTAINER_CLI: docker DEPLOY_CONTAINER_CLI: podman
DEPLOY_EVENT_NAME: ${{ github.event_name }} DEPLOY_EVENT_NAME: ${{ github.event_name }}
DEPLOY_REF: ${{ github.ref }} DEPLOY_REF: ${{ github.ref }}
DEPLOY_RESTART_STRATEGY: quadlet-container DEPLOY_RESTART_STRATEGY: quadlet-container

View file

@ -168,15 +168,20 @@ Merges to `main` run `.forgejo/workflows/dimensionlab-website.yml`. Pull
requests run check, test, and build only; the deploy job is guarded to run only requests run check, test, and build only; the deploy job is guarded to run only
for `push` events on `refs/heads/main`. for `push` events on `refs/heads/main`.
The Dimension Lab runner exposes the rootless Podman socket to job containers as The workflow uses two runner classes. Pull request CI runs on the containerized
`/var/run/docker.sock`. Because this host uses SELinux labeling, the runner `docker` runner. Production deployment runs on a separate host runner with the
configuration must set: `deploy:host` label so the guarded deploy script can use the user's rootless
`podman` and `systemctl --user` commands directly. The deploy job uses a
shell-only `git fetch` checkout so the host runner does not need a Node runtime
for checkout actions.
```yaml ```yaml
container: runner:
options: --security-opt label=disable labels:
- deploy:host
``` ```
The deploy job also performs a socket preflight against the The deploy job also performs a host preflight against the
`dimensionlab-website.service` Podman label before it builds or restarts the `dimensionlab-website.service` Podman label before it builds or restarts the
production container. production container. Do not give the general pull request runner deployment
socket access; keep deploy privileges on the dedicated `deploy` runner.

View file

@ -275,10 +275,15 @@ describe("workspace boundaries", () => {
expect(workflow).toContain("bun run test"); expect(workflow).toContain("bun run test");
expect(workflow).toContain("bun run build"); expect(workflow).toContain("bun run build");
expect(workflow).toContain("needs: ci"); expect(workflow).toContain("needs: ci");
expect(workflow).toContain("options: --security-opt label=disable"); expect(workflow).toContain("runs-on: deploy");
expect(workflow).toContain("github.event_name == 'push'"); expect(workflow).toContain("github.event_name == 'push'");
expect(workflow).toContain("github.ref == 'refs/heads/main'"); expect(workflow).toContain("github.ref == 'refs/heads/main'");
expect(workflow).toContain("docker inspect dimensionlab-website"); expect(workflow).toContain(
"git remote add origin git@git.dimensionlab.net:vince/dimensionlab-website.git",
);
expect(workflow).toContain('git fetch --force --prune --depth=1 origin "$GITHUB_SHA"');
expect(workflow).toContain("podman inspect dimensionlab-website");
expect(workflow).toContain("DEPLOY_CONTAINER_CLI: podman");
expect(workflow).toContain("PODMAN_SYSTEMD_UNIT"); expect(workflow).toContain("PODMAN_SYSTEMD_UNIT");
expect(workflow).toContain("scripts/deploy-dimensionlab-website.sh"); expect(workflow).toContain("scripts/deploy-dimensionlab-website.sh");
}); });