From f8c3ada0776926e1f921f8a6bbd5ce8751c459e3 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 15 Apr 2026 20:39:47 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20[nomad-prep]=20P10=20=E2=80=94=20audit?= =?UTF-8?q?=20lib/=20+=20compose=20for=20docker-backend-isms=20(#797)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sites touched: - lib/generators.sh: WOODPECKER_BACKEND_DOCKER_NETWORK now reads from ${WOODPECKER_CI_NETWORK:-disinto_disinto-net} so nomad jobspecs can override the compose-generated network name. - lib/forge-setup.sh: bare-mode _forgejo_exec() and setup_forge() use ${FORGEJO_CONTAINER_NAME:-disinto-forgejo} instead of hardcoding the container name. Compose mode is unaffected (uses service name). Documented exceptions (container_name directives in generators.sh compose template output): these define names inside docker-compose.yml, which is compose-specific output. Under nomad the generator is not used. Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/forge-setup.sh | 10 ++++++---- lib/generators.sh | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/forge-setup.sh b/lib/forge-setup.sh index 68b5592..192668a 100644 --- a/lib/forge-setup.sh +++ b/lib/forge-setup.sh @@ -31,8 +31,9 @@ _load_init_context() { # Execute a command in the Forgejo container (for admin operations) _forgejo_exec() { local use_bare="${DISINTO_BARE:-false}" + local cname="${FORGEJO_CONTAINER_NAME:-disinto-forgejo}" if [ "$use_bare" = true ]; then - docker exec -u git disinto-forgejo "$@" + docker exec -u git "$cname" "$@" else docker compose -f "${FACTORY_ROOT}/docker-compose.yml" exec -T -u git forgejo "$@" fi @@ -94,11 +95,12 @@ setup_forge() { # Bare-metal mode: standalone docker run mkdir -p "${FORGEJO_DATA_DIR}" - if docker ps -a --format '{{.Names}}' | grep -q '^disinto-forgejo$'; then - docker start disinto-forgejo >/dev/null 2>&1 || true + local cname="${FORGEJO_CONTAINER_NAME:-disinto-forgejo}" + if docker ps -a --format '{{.Names}}' | grep -q "^${cname}$"; then + docker start "$cname" >/dev/null 2>&1 || true else docker run -d \ - --name disinto-forgejo \ + --name "$cname" \ --restart unless-stopped \ -p "${forge_port}:3000" \ -p 2222:22 \ diff --git a/lib/generators.sh b/lib/generators.sh index 6cfe832..a4598e1 100644 --- a/lib/generators.sh +++ b/lib/generators.sh @@ -318,7 +318,7 @@ services: WOODPECKER_AGENT_SECRET: ${WOODPECKER_AGENT_SECRET:-} WOODPECKER_GRPC_SECURE: "false" WOODPECKER_HEALTHCHECK_ADDR: ":3333" - WOODPECKER_BACKEND_DOCKER_NETWORK: disinto_disinto-net + WOODPECKER_BACKEND_DOCKER_NETWORK: ${WOODPECKER_CI_NETWORK:-disinto_disinto-net} WOODPECKER_MAX_WORKFLOWS: 1 healthcheck: test: ["CMD", "wget", "-q", "--spider", "http://localhost:3333/healthz"]