Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: Shellcheck
run: shellcheck scripts/* tests/smoke-image
run: shellcheck scripts/* tests/smoke-image tests/integration-devrun
- name: Build flyingrobots/rust-dev:1.96.0
run: scripts/build-image 1.96.0
- name: Smoke test
Expand All @@ -28,3 +28,7 @@ jobs:
second="$(docker image inspect -f '{{.Id}}' flyingrobots/rust-dev:1.96.0)"
echo "first=$first second=$second"
test "$first" = "$second"
- name: devrun unit tests, in a container
run: bin/devrun devcontainers . --commit HEAD -- python3 -m unittest discover -s tests
- name: devrun integration test (real Docker)
run: tests/integration-devrun
45 changes: 42 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,45 @@ version. The image runs as UID 10001. Mount points for the named volumes:
`/work` (the copy), `/scratch` (inputs, logs, exports), `/target` (build output),
`/usr/local/cargo/registry`, and `/usr/local/cargo/git` (cargo caches).

The guarded runner `bin/devrun` is not here yet (flyingrobots/devcontainers#3
and #5). Until it lands, these two scripts are the only supported way to use
Docker from this repository.
## Run a repository's gates: `bin/devrun`

`bin/devrun` (Python 3.9+, standard library only) copies a repository into
locked-down containers and runs one command there. Nothing is mounted from the
host; every rule it enforces is in [`docs/hygiene.md`](docs/hygiene.md).

```sh
# A pinned commit, fetching dependencies first (network only for cargo fetch):
bin/devrun bunny ~/git/bunny --commit HEAD --fetch -- cargo test --locked --workspace

# Gates that read commit history (Bunny's repo-respect):
bin/devrun bunny ~/git/bunny --history origin/main..HEAD -- cargo run --locked -p xtask -- repo-respect check

# Iterate on uncommitted work (marked unpinned), exporting a file and a patch:
bin/devrun ninelives ~/git/ninelives --worktree --export report.txt --export-patch -- cargo update
```

- Source modes: `--commit SHA` (pinned; required for merge-gate evidence),
`--history BASE..HEAD`, `--worktree` (unpinned). The host builds and checks
the tarball before Docker sees it: no `.git`, no absolute or escaping
symlinks, no hard links, no setuid or setgid bits, no special files; every
owner becomes UID 10001.
- Phase 1 (`--fetch`) runs `cargo fetch --locked` with the network and writable
cargo caches, from a copy without `.cargo/config*` or `rust-toolchain*`, with
the compiler pinned and the wrappers cleared. Phase 2 runs the command from a
fresh copy at `/work`, with `--network none` unless `--network` is given.
- Outputs leave only through `--export PATH` (files written under
`/scratch/out/` in the container) and `--export-patch` (a patch from the
throwaway repository), into a fresh folder outside every repository
(`--out DIR`, or a new temporary folder).
- Each run holds the git-locks keys `host/heavy-work` and
`host/docker/<project>-dev-run/`, and removes only the container it created.
`--timeout` (default 1800 s) is shorter than the lease.
- Not yet: the Docker litter audit, run receipts, free-space and volume budget
checks (flyingrobots/devcontainers#5).

Test it:

```sh
bin/devrun devcontainers . --worktree -- python3 -m unittest discover -s tests # unit tests, in a container
tests/integration-devrun # real Docker
```
Loading
Loading