Skip to content

Commit d6d5c80

Browse files
Initial public release of containerd-manager
Rust library for managing containerd containers, tasks, and images. Docker-free alternative to bollard, targeting MongoDB Atlas Local CLI's test-data and integration-test workflows. Highlights: - Full container lifecycle: pull, create, start, stop, kill, delete - Snapshot / restore / reset-to-snapshot / clone with copy-on-write rootfs - Bridge networking via OCI hooks (colima-VM compatible) + host/isolated modes - Per-container background log tailer writing timestamped + rotated events.log - LogFollower for live tailing (mpsc + futures::Stream) - HEALTHCHECK-aware readiness with start_period grace (Healthy / Starting / Unhealthy) - Exec inside running tasks with capability + env inheritance - Image-config caching, multi-arch resolution, content store integration - Per-namespace tracking of task start times, managed port forwards, log tailers - typed-builder Opts for ergonomic construction - tracing instrumentation on all public Client methods
0 parents  commit d6d5c80

39 files changed

Lines changed: 13076 additions & 0 deletions

.github/dependabot.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "cargo"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
day: "monday"
8+
time: "09:00"
9+
open-pull-requests-limit: 10
10+
commit-message:
11+
prefix: "chore(deps)"
12+
labels:
13+
- "dependencies"
14+
groups:
15+
rust-all:
16+
patterns: ["*"]
17+
18+
- package-ecosystem: "github-actions"
19+
directory: "/"
20+
schedule:
21+
interval: "weekly"
22+
day: "monday"
23+
time: "09:00"
24+
open-pull-requests-limit: 5
25+
commit-message:
26+
prefix: "chore(deps)"
27+
labels:
28+
- "dependencies"

.github/workflows/ci.yml

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
check:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Install Rust toolchain
18+
run: |
19+
rustup update stable
20+
rustup default stable
21+
rustup component add clippy rustfmt
22+
23+
- name: Cache cargo
24+
uses: actions/cache@v4
25+
with:
26+
path: |
27+
~/.cargo/registry
28+
~/.cargo/git
29+
target
30+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
31+
restore-keys: |
32+
${{ runner.os }}-cargo-
33+
34+
- name: Check formatting
35+
run: cargo fmt --all -- --check
36+
37+
- name: Run clippy
38+
run: cargo clippy --all-targets --no-deps -- -D warnings
39+
40+
- name: Build
41+
run: cargo build --verbose
42+
43+
- name: Run unit tests
44+
run: cargo test --lib --verbose
45+
46+
- name: Build examples
47+
run: cargo build --examples --verbose
48+
49+
test-matrix:
50+
# Ubuntu stable is covered by `check`; this job adds platform breadth.
51+
runs-on: ${{ matrix.os }}
52+
strategy:
53+
fail-fast: false
54+
matrix:
55+
os: [macos-latest, windows-latest]
56+
57+
steps:
58+
- uses: actions/checkout@v4
59+
60+
- name: Install Rust toolchain
61+
run: |
62+
rustup update stable
63+
rustup default stable
64+
65+
- name: Install protoc (macOS)
66+
if: runner.os == 'macOS'
67+
run: brew install protobuf
68+
69+
- name: Install protoc (Windows)
70+
if: runner.os == 'Windows'
71+
run: choco install protoc -y
72+
73+
- name: Cache cargo
74+
uses: actions/cache@v4
75+
with:
76+
path: |
77+
~/.cargo/registry
78+
~/.cargo/git
79+
target
80+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
81+
restore-keys: |
82+
${{ runner.os }}-cargo-
83+
84+
- name: Build
85+
run: cargo build --verbose
86+
87+
- name: Run unit tests
88+
run: cargo test --lib --verbose
89+
90+
msrv:
91+
# Matches `rust-version` in Cargo.toml. `cargo check` is enough; tests
92+
# may pull in features unavailable on the MSRV toolchain.
93+
runs-on: ubuntu-latest
94+
steps:
95+
- uses: actions/checkout@v4
96+
97+
- name: Install Rust 1.88
98+
run: |
99+
rustup update 1.88
100+
rustup default 1.88
101+
102+
- name: Cache cargo
103+
uses: actions/cache@v4
104+
with:
105+
path: |
106+
~/.cargo/registry
107+
~/.cargo/git
108+
target
109+
key: ${{ runner.os }}-cargo-msrv-${{ hashFiles('**/Cargo.lock') }}
110+
restore-keys: |
111+
${{ runner.os }}-cargo-msrv-
112+
113+
- name: Check MSRV build
114+
run: cargo check --verbose
115+
116+
e2e-linux:
117+
# Runs the e2e suite against native Linux containerd. macOS-specific
118+
# tests (bridge networking over colima's VZ network) won't be exercised
119+
# but the lifecycle, exec, logs, port-forward, and readiness paths are.
120+
runs-on: ubuntu-latest
121+
env:
122+
CONTAINERD_SOCKET: /run/containerd/containerd.sock
123+
steps:
124+
- uses: actions/checkout@v4
125+
126+
- name: Install Rust toolchain
127+
run: |
128+
rustup update stable
129+
rustup default stable
130+
131+
- name: Install containerd + OCI hook deps
132+
run: |
133+
sudo apt-get update
134+
# containerd brings runc. socat, python3, iptables, iproute2,
135+
# util-linux back the bridge OCI hooks.
136+
sudo apt-get install -y containerd socat python3 iptables iproute2 util-linux
137+
138+
- name: Start containerd
139+
run: |
140+
sudo systemctl start containerd
141+
sudo systemctl status containerd --no-pager
142+
# Default socket is root-owned; relax for the runner user.
143+
sudo chmod 666 /run/containerd/containerd.sock
144+
ls -la /run/containerd/containerd.sock
145+
146+
- name: Cache cargo
147+
uses: actions/cache@v4
148+
with:
149+
path: |
150+
~/.cargo/registry
151+
~/.cargo/git
152+
target
153+
key: ${{ runner.os }}-cargo-e2e-${{ hashFiles('**/Cargo.lock') }}
154+
restore-keys: |
155+
${{ runner.os }}-cargo-e2e-
156+
157+
- name: Run e2e tests
158+
env:
159+
RUST_BACKTRACE: 1
160+
# Test process only needs socket access. Containerd runs as root via
161+
# systemd, so the OCI hooks (which need CAP_NET_ADMIN for veth +
162+
# iptables) inherit privileges from the daemon.
163+
run: cargo test --features e2e-tests --no-fail-fast

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/target
2+
/tasks
3+
/.claude
4+
*.code-workspace

0 commit comments

Comments
 (0)