Shuttle runs GitLab CI pipelines for Tangled repositories on an ordinary GitLab runner, and publishes the job logs to the repository owner's tangled.org/dracoblue.de/shuttle
shuttle docs DEVELOPMENT.md
3.2 kB · 71 lines
Markdown
at main

Development #

Requires Go 1.27 and Docker. The Knot 2 image is pulled from atcr.io, which needs a one-time docker login atcr.io with any atproto account.

Tests, cheapest first:

go vet ./... && go test ./...   # unit tests and docs checks, no Docker
scripts/run-local-e2e.sh        # real gitlab-runner, no knot, no PDS
shuttle run-local --runner docker --worktree .   # Shuttle's own pipeline
scripts/prod-smoke.sh           # deploy/ stack with Caddy, no DNS, no ACME
scripts/e2e.sh basic            # full path against knot and a real PDS, one feature set
scripts/e2e.sh                  # every feature directory under e2e/

shuttle lint and shuttle run-local are described in LOCAL.md.

go test ./... includes internal/readmecheck, which checks FEATURES.md against the e2e/ directories and the feature notes in internal/pipeline, and checks that the counts in the README's "GitLab CI compatibility" table match it. After changing a status in FEATURES.md, update those counts.

scripts/e2e.sh writes records to a public test account, so run it for changes to the OAuth or PDS path, one feature set at a time.

docker-compose.yml runs the three services: knot, shuttle, runner. It expects KNOT_MASTER_KEY and SHUTTLE_DB_DIR in the environment; the knot data lives in the persistent volume shuttle_knot-data.

scripts/e2e.sh uses a throwaway test account on a public PDS and one test repository on the local knot, set up once by scripts/knot-setup.sh. Credentials are read from ~/.config/shuttle-test/.env and never enter the repository. The script starts the stack once, reuses the grant and the runner, then for each feature commits e2e/<feature>/.gitlab-ci.yml on top of the test repository's current main and pushes that commit to refs/heads/e2e-<feature> on the local knot. Those e2e branches may be force-pushed. main is only read. It waits for one trace record per job at that commit, then go test -tags green checks the records against e2e/<feature>/expect.yml and checks that shuttle run show reports trigger=event.

expect.yml maps each job name to the trace record that job must produce. Retry attempts after the first use <job>@<attempt> keys. status is required. exitCode checks that record field. noExitCode: true requires the field to be absent. contains lists substrings the trace blob must contain, excludes lists substrings it must not, and ordered lists substrings that must occur in that order. coverage checks the decimal coverage field, and noCoverage: true requires that field to be absent.

If a feature also has expect-2.yml, the harness makes a second commit and push to the same e2e branch after validating the first run, then validates it against that file. It reuses .gitlab-ci.yml unless .gitlab-ci-2.yml is present. This is intended for stateful runner behavior such as a cache restore.

pass:
  status: success
  exitCode: 0
  contains:
    - some-log-line
".gitlab-ci.yml":
  status: failed
  noExitCode: true
  contains:
    - rules

The script prints PASS or FAIL for each feature and tears the stack down. The knot volume is kept.