Factory: acceptance runs in throw-away containers via an optional test runner service
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
63816c45fd
commit
115e9aec6c
9 files changed
+794
-11
No files matched your search
@@ -336,11 +336,38 @@ can be restarted from the board, finished ones are closed with a comment.
|
||||
|
||||
| File | Purpose |
|
||||
|---|---|
|
||||
| `setup.json` | How acceptance installs and starts the app: `install`, `start`, `url` |
|
||||
| `setup.json` | How acceptance installs and starts the app: `install`, `start`, `url` – and, with the test runner, `image`, `dockerfile`, `port`, `env`, `services` |
|
||||
| `release.json` | Recipe for releases: image, platforms, Dockerfile, build args, commands, files |
|
||||
|
||||
Repositories are cloned into a separate factory area, not into your workspace, and agents never see the forge API token.
|
||||
|
||||
**Throw-away test containers (optional).** By default the acceptance agent starts the app
|
||||
inside the CodeCraft container. With the **test runner** each acceptance run gets its own
|
||||
container and network instead: set `COMPOSE_PROFILES=runner`, `CODECRAFT_RUNNER_URL=http://testrunner:8788`,
|
||||
`RUNNER_TOKEN` (random, ≥ 16 characters) and `DOCKER_GID` in `.env` (see `.env.example`). The
|
||||
`testrunner` service – the same image started as `codecraft testrunner` – is the only one that
|
||||
touches the Docker socket. It copies the checked-out branch into a fresh container, runs
|
||||
`install` and `start` from `.factory/setup.json`, waits until the port answers, and forwards it
|
||||
to `localhost` for the agent; the app's log is in `.factory/app.log`. Afterwards container,
|
||||
helper services and network are removed (leftovers are swept at startup and after 90 minutes).
|
||||
|
||||
```json
|
||||
{
|
||||
"image": "node:22-bookworm",
|
||||
"install": "npm ci",
|
||||
"start": "npm start",
|
||||
"url": "http://localhost:8080",
|
||||
"env": { "DATABASE_URL": "postgres://app:app@db/app" },
|
||||
"services": { "db": { "image": "postgres:16", "env": { "POSTGRES_USER": "app", "POSTGRES_PASSWORD": "app", "POSTGRES_DB": "app" } } }
|
||||
}
|
||||
```
|
||||
|
||||
`image` defaults to `RUNNER_DEFAULT_IMAGE`; `"dockerfile": "path"` builds the image from the
|
||||
repository instead; helper services are reachable by their name. Containers run without extra
|
||||
capabilities, with memory/CPU/process limits (`RUNNER_MEMORY`, `RUNNER_CPUS`), and cannot see the
|
||||
host. Without the runner, or without a `setup.json`, nothing changes. Note that the runner holds
|
||||
the Docker socket (root-equivalent on the host): keep its port unpublished and the token secret.
|
||||
|
||||
## Integrations
|
||||
|
||||
- **Telegram:** connect your own bot (*Settings → Account → Telegram*) and use CodeCraft from
|
||||
|
||||
Reference in new issue
Block a user