Skip to content

Commit 14bfe1e

Browse files
committed
Add build tags for omitting network drivers and document usage
Signed-off-by: fahed dorgaa <[email protected]>
1 parent e13e7de commit 14bfe1e

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

.github/workflows/main.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,3 +281,18 @@ jobs:
281281
docker exec test docker info
282282
docker exec test ./integration-docker.sh
283283
docker rm -f test
284+
285+
build-tags:
286+
name: "Build with disabled drivers tags"
287+
runs-on: ubuntu-24.04
288+
steps:
289+
- name: "Check out"
290+
uses: actions/checkout@v5
291+
- name: "Set up Go"
292+
uses: actions/setup-go@v5
293+
with:
294+
go-version-file: go.mod
295+
- name: "Build with -tags no_gvisortapvsock"
296+
run: go build -v -tags no_gvisortapvsock ./cmd/rootlesskit
297+
- name: "Build with -tags 'no_slirp4netns no_lxcusernic no_gvisortapvsock'"
298+
run: go build -v -tags "no_slirp4netns no_lxcusernic no_gvisortapvsock" ./cmd/rootlesskit

docs/BUILDING.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Building RootlessKit
2+
3+
This document describes build-time options, including Go build tags for omitting certain network and port drivers.
4+
5+
## Build tags to omit drivers
6+
7+
To exclude specific drivers at compilation time, use Go build tags:
8+
9+
- Tag `no_vpnkit`: omits the VPNKit network driver implementation.
10+
- Tag `no_gvisortapvsock`: omits the gvisor-tap-vsock network driver implementation and its port driver.
11+
- Tag `no_slirp4netns`: omits the slirp4netns network driver implementation and its port driver.
12+
- Tag `no_lxcusernic`: omits the lxc-user-nic network driver implementation.
13+
14+
Example:
15+
16+
- Build without VPNKit support:
17+
go build -tags no_vpnkit ./cmd/rootlesskit
18+
19+
Notes:
20+
- If a disabled driver is selected at runtime (e.g., `--net=vpnkit` when built with `-tags no_vpnkit`), RootlessKit returns an error indicating that the driver was disabled at build time.

0 commit comments

Comments
 (0)