feat: restore smoke-init CI pipeline using mock Forgejo #124

Open
opened 2026-04-01 18:20:07 +00:00 by dev-bot · 1 comment
Collaborator

Problem

The smoke-init CI pipeline was removed (commit e351e02) because Forgejo startup timed out in the Docker-in-LXD environment. The test script tests/smoke-init.sh has 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.yml

when:
  - event: pull_request
    path:
      - "bin/disinto"
      - "lib/load-project.sh"
      - "lib/env.sh"
      - "tests/**"
      - ".woodpecker/smoke-init.yml"

steps:
  - name: smoke-init
    image: python:3-alpine
    commands:
      - apk add --no-cache bash curl jq git coreutils
      - python3 tests/mock-forgejo.py &
      - sleep 1  # wait for mock to start
      - bash tests/smoke-init.sh

Key differences from the old pipeline:

  • Uses python:3-alpine (lightweight) instead of codeberg.org/forgejo/forgejo:11.0 (heavy)
  • Starts mock-forgejo.py as a background process (instant startup)
  • No Forgejo process, no SQLite init, no bootstrap admin CLI
  • Total runtime target: <10 seconds

2. Restore and update tests/smoke-init.sh

Restore the test from commit e351e02^ with these changes:

  • Remove Forgejo startup section — no su-exec git forgejo web or readiness polling
  • Remove bootstrap admin creation — the mock doesn't need CLI-created users; the first POST /admin/users call creates the admin
  • Remove docker mock — user creation goes through the Forgejo API mock directly, not through a docker exec mock. The docker mock was only needed because the old test used docker exec disinto-forgejo forgejo admin user create. Now init talks to the API mock directly.
  • Keep the claude and tmux mocks — still needed (init checks claude auth status)
  • Keep all 6 verification steps — API state, local state, cron setup
  • Update SMOKE_FORGE_URL to point to mock: http://localhost:${MOCK_FORGE_PORT:-3000}
  • Add mock-specific verifications: after init completes, query GET /mock/state (a debug endpoint on the mock) to verify all expected users, repos, labels, and collaborators were created

3. 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

1. mock-forgejo.py starts (port 3000, <1s)
2. smoke-init.sh runs disinto init against mock
3. init creates users via POST /admin/users → mock stores them
4. init creates tokens via POST /users/{name}/tokens → mock generates deterministic tokens
5. init creates repos via POST /orgs/{org}/repos → mock stores them
6. init creates labels via POST /repos/{slug}/labels → mock stores them
7. init adds collaborators via PUT /repos/{slug}/collaborators/{user} → mock stores them
8. init sets branch protection via POST /repos/{slug}/branch_protections → mock stores them
9. smoke-init.sh verifies: users exist (GET /users/{name}), repos exist, labels exist, .env has tokens, TOML generated, cron installed
10. PASS (total: <10s)

Affected files

  • .woodpecker/smoke-init.yml (new — restored with mock approach)
  • tests/smoke-init.sh (new — restored and updated for mock)

Acceptance criteria

  • Pipeline runs on PRs that touch init-related files
  • Mock starts in <1s, total pipeline <30s
  • All 6 verification steps from original test pass
  • Mock state verification (all expected API calls made)
  • No real Forgejo process needed
  • CI green

Dependencies

Depends on #123 (mock Forgejo server).

## Problem The `smoke-init` CI pipeline was removed (commit e351e02) because Forgejo startup timed out in the Docker-in-LXD environment. The test script `tests/smoke-init.sh` has 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.yml` ```yaml when: - event: pull_request path: - "bin/disinto" - "lib/load-project.sh" - "lib/env.sh" - "tests/**" - ".woodpecker/smoke-init.yml" steps: - name: smoke-init image: python:3-alpine commands: - apk add --no-cache bash curl jq git coreutils - python3 tests/mock-forgejo.py & - sleep 1 # wait for mock to start - bash tests/smoke-init.sh ``` Key differences from the old pipeline: - Uses `python:3-alpine` (lightweight) instead of `codeberg.org/forgejo/forgejo:11.0` (heavy) - Starts mock-forgejo.py as a background process (instant startup) - No Forgejo process, no SQLite init, no bootstrap admin CLI - Total runtime target: <10 seconds ### 2. Restore and update `tests/smoke-init.sh` Restore the test from commit `e351e02^` with these changes: - **Remove Forgejo startup section** — no `su-exec git forgejo web` or readiness polling - **Remove bootstrap admin creation** — the mock doesn't need CLI-created users; the first `POST /admin/users` call creates the admin - **Remove docker mock** — user creation goes through the Forgejo API mock directly, not through a docker exec mock. The docker mock was only needed because the old test used `docker exec disinto-forgejo forgejo admin user create`. Now init talks to the API mock directly. - **Keep the claude and tmux mocks** — still needed (init checks `claude auth status`) - **Keep all 6 verification steps** — API state, local state, cron setup - **Update SMOKE_FORGE_URL** to point to mock: `http://localhost:${MOCK_FORGE_PORT:-3000}` - **Add mock-specific verifications**: after init completes, query `GET /mock/state` (a debug endpoint on the mock) to verify all expected users, repos, labels, and collaborators were created ### 3. 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 ``` 1. mock-forgejo.py starts (port 3000, <1s) 2. smoke-init.sh runs disinto init against mock 3. init creates users via POST /admin/users → mock stores them 4. init creates tokens via POST /users/{name}/tokens → mock generates deterministic tokens 5. init creates repos via POST /orgs/{org}/repos → mock stores them 6. init creates labels via POST /repos/{slug}/labels → mock stores them 7. init adds collaborators via PUT /repos/{slug}/collaborators/{user} → mock stores them 8. init sets branch protection via POST /repos/{slug}/branch_protections → mock stores them 9. smoke-init.sh verifies: users exist (GET /users/{name}), repos exist, labels exist, .env has tokens, TOML generated, cron installed 10. PASS (total: <10s) ``` ## Affected files - `.woodpecker/smoke-init.yml` (new — restored with mock approach) - `tests/smoke-init.sh` (new — restored and updated for mock) ## Acceptance criteria - [ ] Pipeline runs on PRs that touch init-related files - [ ] Mock starts in <1s, total pipeline <30s - [ ] All 6 verification steps from original test pass - [ ] Mock state verification (all expected API calls made) - [ ] No real Forgejo process needed - [ ] CI green ## Dependencies Depends on #123 (mock Forgejo server).
disinto-admin added the
backlog
label 2026-04-01 18:41:35 +00:00
dev-qwen self-assigned this 2026-04-01 19:17:21 +00:00
dev-qwen added
in-progress
and removed
backlog
labels 2026-04-01 19:17:21 +00:00
Collaborator

Blocked — issue #124

Field Value
Exit reason ci_exhausted
Timestamp 2026-04-01T19:30:58Z
### Blocked — issue #124 | Field | Value | |---|---| | Exit reason | `ci_exhausted` | | Timestamp | `2026-04-01T19:30:58Z` |
dev-qwen added
blocked
and removed
in-progress
labels 2026-04-01 19:30:58 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: johba/disinto#124
No description provided.