fix: use Forgejo image as step container for CLI access (#668)

The install endpoint POST returned 404 because FORGEJO__database__DB_TYPE
env var auto-configured Forgejo, bypassing install mode.

Fix: run the Forgejo image as the step container instead of a service.
This gives CLI access to `forgejo admin user create` for bootstrap
admin setup — no install endpoint needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-25 09:58:47 +00:00
parent 9c2a5634ff
commit 78e478e69d
2 changed files with 43 additions and 107 deletions

View file

@ -1,24 +1,27 @@
# .woodpecker/smoke-init.yml — End-to-end smoke test for disinto init
#
# Starts a real Forgejo instance as a service container, then runs
# disinto init --bare --yes against it and verifies the results.
# Uses the Forgejo image directly (not as a service) so we have CLI
# access to set up Forgejo and create the bootstrap admin user.
# Then runs disinto init --bare --yes against the local Forgejo instance.
when:
event: [push, pull_request]
services:
- name: forgejo
image: codeberg.org/forgejo/forgejo:11.0
environment:
FORGEJO__database__DB_TYPE: sqlite3
FORGEJO__server__ROOT_URL: "http://forgejo:3000/"
FORGEJO__server__HTTP_PORT: "3000"
steps:
- name: smoke-init
image: debian:bookworm-slim
image: codeberg.org/forgejo/forgejo:11.0
environment:
SMOKE_FORGE_URL: http://forgejo:3000
SMOKE_FORGE_URL: http://localhost:3000
commands:
- apt-get update -qq && apt-get install -y -qq --no-install-recommends bash curl jq python3 git ca-certificates >/dev/null 2>&1
# Install test dependencies (Alpine-based image)
- apk add --no-cache bash curl jq python3 git >/dev/null 2>&1
# Set up Forgejo data directories and config
- mkdir -p /data/gitea/conf /data/gitea/repositories /data/gitea/lfs /data/gitea/log /data/git/.ssh /data/ssh
- printf '[database]\nDB_TYPE = sqlite3\nPATH = /data/gitea/forgejo.db\n\n[server]\nHTTP_PORT = 3000\nROOT_URL = http://localhost:3000/\nLFS_START_SERVER = false\n\n[security]\nINSTALL_LOCK = true\n\n[service]\nDISABLE_REGISTRATION = true\n' > /data/gitea/conf/app.ini
# Start Forgejo in background and wait for it
- forgejo web --config /data/gitea/conf/app.ini &
- for i in $(seq 1 30); do curl -sf http://localhost:3000/api/v1/version >/dev/null 2>&1 && break; sleep 1; done
# Create bootstrap admin user via CLI (this is why we use the Forgejo image)
- forgejo admin user create --admin --username setup-admin --password "SetupPass-789xyz" --email "setup-admin@smoke.test" --must-change-password=false --config /data/gitea/conf/app.ini
# Run the smoke test
- bash tests/smoke-init.sh