Aim the deploy at the runner that exists
The workflow asked for a `self-hosted` label. No runner on the instance offers one, so the run would have sat in "Waiting" forever — no error, no message, nothing to notice. The existing global runner elycon-runner-01 offers `docker` and `ubuntu-latest`, so both workflows now ask for `ubuntu-latest`, the same label ci.yml already used. That correction exposed a second thing the first version glossed over. act_runner starts a container per job; mounting the Docker socket into the *runner* does not put it in the *job*. Whether this job can reach the host's daemon depends on the runner's config.yaml, which is not visible from here — and the runner is global, so changing it affects every repository on the instance, not just this one. Rather than guess, the workflow now measures it in its first step and fails with the fix if it cannot: which config lines to add for the socket, or that SSH is the other way. Without that, the run would have died three steps later on a message nobody could act on. Both branches of the check were exercised: docker absent prints the first message, docker present with no reachable daemon the second. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
39
.github/workflows/deploy.yml
vendored
39
.github/workflows/deploy.yml
vendored
@@ -24,8 +24,45 @@ concurrency:
|
||||
jobs:
|
||||
deploy:
|
||||
name: Migrationen und Container
|
||||
runs-on: self-hosted
|
||||
# `ubuntu-latest`, weil der vorhandene Runner (elycon-runner-01) genau
|
||||
# diese Bezeichnung anbietet — neben `docker`. Ein Label, das kein Runner
|
||||
# führt, lässt den Lauf wortlos in der Warteschlange stehen: kein Fehler,
|
||||
# keine Meldung, nur „Waiting".
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# ── Vorprüfung ──────────────────────────────────────────────────
|
||||
#
|
||||
# Dieser Job läuft in einem Container, den der Runner startet — nicht
|
||||
# auf dem Server selbst. Ob er den Docker-Dienst des **Hosts** erreicht,
|
||||
# hängt davon ab, wie der Runner konfiguriert ist; von aussen ist das
|
||||
# nicht zu sehen. Statt es zu raten, wird es hier gemessen und im
|
||||
# Fehlerfall gesagt, was fehlt — sonst scheitert der Lauf erst drei
|
||||
# Schritte später an einer Meldung, die niemandem weiterhilft.
|
||||
- name: Erreicht dieser Job den Docker-Dienst des Servers?
|
||||
run: |
|
||||
set -u
|
||||
if ! command -v docker >/dev/null 2>&1; then
|
||||
echo 'Im Job-Container gibt es kein "docker".'
|
||||
echo
|
||||
echo "Zwei Wege:"
|
||||
echo " a) Im Runner (config.yaml) ein Abbild verwenden, das die Docker-CLI"
|
||||
echo " mitbringt, und den Socket durchreichen — siehe DEPLOYMENT.md §5."
|
||||
echo " b) Statt lokal per SSH auf den Server ausrollen."
|
||||
exit 1
|
||||
fi
|
||||
if ! docker info >/dev/null 2>&1; then
|
||||
echo "Docker-CLI vorhanden, aber kein Dienst erreichbar."
|
||||
echo
|
||||
echo "Dem Job-Container fehlt der Socket des Hosts. In der config.yaml des"
|
||||
echo "Runners:"
|
||||
echo " container:"
|
||||
echo " options: -v /var/run/docker.sock:/var/run/docker.sock"
|
||||
echo " valid_volumes: [/var/run/docker.sock]"
|
||||
echo "Danach den Runner neu starten. Alternative: Deploy per SSH."
|
||||
exit 1
|
||||
fi
|
||||
docker compose version
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
|
||||
Reference in New Issue
Block a user