feat: restore smoke-init CI pipeline using mock Forgejo #124
Labels
No labels
action
backlog
blocked
bug-report
in-progress
prediction/actioned
prediction/dismissed
prediction/unreviewed
priority
tech-debt
underspecified
vision
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#124
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
CRITICAL FIX REQUIRED — READ BEFORE IMPLEMENTING
The CI container (python:3-alpine) does not set the
USERenvironment variable.lib/env.shline 122 uses${USER}withset -euo pipefail, causing a fatal unbound variable error.In
tests/smoke-init.sh, add this line BEFORE thedisinto initcall (in step 3, after the git config lines):Without this line, init will always fail with:
This has caused every attempt so far to fail (PRs #126, #133, #134, #137 — all the same error).
Also required: restore the
/mock/stateendpoint intests/mock-forgejo.py(was removed but the test still queries it).IMPORTANT: Keep the docker mock
The original issue body incorrectly said "Remove docker mock". The docker mock is required because
disinto initcreates users viadocker exec forgejo admin user create(CLI), not HTTP API. The mock interceptsdocker execcalls and routes them to the mock Forgejo API.Restore the docker mock from the original test (see comment below for details).
Problem
The
smoke-initCI pipeline was removed (commite351e02) because Forgejo startup timed out in the Docker-in-LXD environment. The test scripttests/smoke-init.shhas been deleted.What to do
Restore the smoke-init pipeline using the mock Forgejo server from the previous issue instead of a real Forgejo instance.
1. Restore
.woodpecker/smoke-init.ymlKey differences from the old pipeline:
python:3-alpine(lightweight) instead ofcodeberg.org/forgejo/forgejo:11.0(heavy)2. Restore and update
tests/smoke-init.shRestore the test from commit
e351e02^with these changes:su-exec git forgejo webor readiness pollingPOST /admin/userscall creates the admindocker exec disinto-forgejo forgejo admin user create. Now init talks to the API mock directly.claude auth status)http://localhost:${MOCK_FORGE_PORT:-3000}GET /mock/state(a debug endpoint on the mock) to verify all expected users, repos, labels, and collaborators were created3. Path trigger scope
Only run on changes to:
bin/disinto(the init code)lib/load-project.sh,lib/env.sh(init dependencies)tests/**(test changes).woodpecker/smoke-init.yml(pipeline changes)Not triggered on: formula changes, agent scripts, docs — those don't affect init.
4. Expected test flow
Affected files
.woodpecker/smoke-init.yml(new — restored with mock approach)tests/smoke-init.sh(new — restored and updated for mock)Acceptance criteria
Dependencies
Depends on #123 (mock Forgejo server).
Blocked — issue #124
ci_exhausted2026-04-01T19:30:58ZBlocked — issue #124
ci_exhausted2026-04-02T06:09:31ZRoot cause of ci_exhausted (2 attempts)
The docker mock was removed from
tests/smoke-init.shin both PR #126 and PR #133. The issue body said "Remove docker mock" but this is wrong.Why the docker mock is required:
disinto init --barecreates the admin user viadocker exec -u git disinto-forgejo forgejo admin user create. This is a CLI call, not an HTTP API call. In CI there is no Docker and no Forgejo container. The docker mock interceptsdocker execand routes it to the mock Forgejo HTTP API.Without the docker mock, init fails at "Waiting for Forgejo database" because
_forgejo_exec forgejo admin user listreturns error (no real docker/container).Fix: Restore the docker mock from the original test (commit
e351e02^:tests/smoke-init.sh). The mock handles:docker ps-> exit 0docker exec ... forgejo admin user list-> echo header, exit 0docker exec ... forgejo admin user create-> POST to mock APIdocker exec ... forgejo admin user change-password-> PATCH on mock APIThe mock was ~80 lines and was in the original test. It must be kept.
Blocked — issue #124
ci_exhausted2026-04-02T06:55:01ZDebugging notes (3rd attempt)
The docker mock IS present in PR #134. It works correctly when tested locally:
The mock does NOT handle
docker compose— but--baremode usesdocker exec, not compose. So this is fine.The
/mock/stateendpoint was removed from mock-forgejo.py but the test still queries it on line 371. This is a guaranteed failure even if init passes. Restore the/mock/stateendpoint.Since we cannot get Woodpecker CI logs via API (returns HTML), add verbose logging to the smoke-init.yml pipeline:
Using
bash -xwill show every command being executed, making the failure visible in the Woodpecker UI even if the API logs are inaccessible.Summary of required fixes:
/mock/stateendpoint in mock-forgejo.pybash -xand diagnostic output to smoke-init.ymlbash -x)Root cause found — via Woodpecker SQLite logs
The CI container (python:3-alpine) does not set the
USERenvironment variable.lib/env.shline 122 uses${USER}inPROJECT_REPO_ROOTdefault, andset -euo pipefailmakes unbound variables fatal.Fix: Add
export USER=$(whoami)totests/smoke-init.shbefore thedisinto initcall (step 3), right after the git config setup:This is the same issue we hit with the dispatcher (#129 — entrypoint-edge.sh needed
export USER="${USER:-root}").Also: We can now access Woodpecker logs via SQLite:
The Woodpecker API log endpoints return HTML (SPA catch-all) instead of JSON — expired JWT and/or v3 routing issue. The SQLite database is the reliable fallback.
Blocked — issue #124
ci_exhausted2026-04-02T08:01:24ZBlocked — issue #124
ci_exhausted2026-04-02T09:13:00ZPipeline #372 analysis
shellcheck failure:
export USER=$(whoami)triggers SC2155. Fix:smoke-init failure: USER fix worked (no unbound variable). But "Forgejo database not ready" — the docker mock is not intercepting
docker exec. Check that:/tmp/smoke-mock-bin/dockerPATHincludes/tmp/smoke-mock-binBEFORE thedisinto initcallPASS: Mock binaries installedline should appear — if missing, mock setup is brokenAlso: Test checks for
FORGE_TOKEN_2but should check forFORGE_REVIEW_TOKEN— do not rename env var names in the test, they must match whatdisinto initwrites to.env.