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 LOCAL.md
4.4 kB · 95 lines
Markdown
at main

Checking and running a pipeline locally #

Two commands answer "what will my .gitlab-ci.yml do?" before you push:

  • shuttle lint [path] checks it without a runner, using the same expansion code Shuttle uses for real pipelines.
  • shuttle run-local [path] runs it on a real GitLab Runner, without a knot, an OAuth session, or a PDS.

path defaults to the current directory. Start with lint; run-local performs the same check first and stops on the same problems.

Simulated push #

Both commands simulate a push and accept the same flags:

  • --ref: simulated git ref (default: current branch refs/heads/<branch> or tag pointing at HEAD refs/tags/<tag>).
  • --default-branch: default branch (default: from refs/remotes/origin/HEAD, else main).
  • --sha: commit SHA (default: HEAD).
  • --before: before commit SHA.
  • --changed <path>: changed file path (repeatable; default: diff between merge-base with @{upstream} (else HEAD~1) and HEAD).
  • --var <KEY=VALUE>: predefined CI variable override (repeatable).
  • --worktree: read files from the working tree instead of the tree at the chosen SHA.

Outside a git repository, defaults are omitted and only explicitly passed flags apply; rules requiring a ref are reported as not evaluable without --ref.

shuttle lint #

shuttle lint [path]

--json prints machine-readable JSON instead of text.

Exit codes:

  • 0: runnable (partially implemented features accepted without effect or Shuttle extensions are reported as notes).
  • 1: hard blockers (keywords Shuttle does not implement).
  • 2: errors (YAML syntax errors, undeclared stages, cycles, broken extends/references/includes).

shuttle run-local #

shuttle run-local [path]
shuttle run-local --runner docker --worktree .

A blocker or lint error is printed in lint's text format and stops before a runner or HTTP server starts.

The command starts an in-process coordinator backed by SQLite in memory and serves only the selected repository through Git smart HTTP. It never discovers a knot, opens an OAuth session, or contacts a PDS. --worktree uses an unreferenced git stash create object, without changing the worktree, index, or refs.

Additional flags are:

  • --runner binary|docker (default binary). Binary mode runs gitlab-runner run-single from PATH; --runner-bin overrides its path. Docker mode runs the official runner image pinned to the digest in docker-compose.yml and mounts the Docker socket.
  • --docker-image sets the default job image. It defaults to the official Alpine image pinned by digest used by the end-to-end tests.
  • --listen sets the server listen address; the default is a random free port.
  • --wait-timeout sets the runner's first-job fallback timeout (default 30 seconds). The runner's --max-builds is the sum of 1 + retry:max over all jobs. Shuttle stops it with SIGQUIT, then SIGTERM after a grace period, as soon as the pipeline is terminal.
  • --out selects the output directory. The default is .shuttle/run/<UTC timestamp>/.
  • --runner-tags a,b sets the local runner's tags. The default is the sorted union of every job's tags. run_untagged is true when any job has no tags, including when --runner-tags is set, so an untagged job still runs beside tagged ones. The runner process is not given those tags; Shuttle stores them with the throwaway token and only hands a job to a runner whose tags include every job tag. A job no runner can take stays pending. When the runner process exits, the summary records why and the command exits 1.

The output directory contains one sanitized <job>.log per attempt (later attempts have -<attempt> appended) and summary.json with stage, status, exit code, attempt, duration, coverage, and failure reason.

Exit codes:

  • 0: successful pipeline, including allowed failures.
  • 1: failed pipeline.
  • 2: lint or infrastructure errors.

On Linux, containers do not interpret host loopback as the host. Docker mode therefore listens on all host interfaces on its random port, gives the runner container host.docker.internal:host-gateway, and passes the same mapping to job and helper containers with --docker-extra-hosts. The API has only a throwaway in-memory runner token, and the Git handler is read-only and exports only the temporary bare repository for this invocation.