Skip to content

Commit

Permalink
Update shim to build using bazel.
Browse files Browse the repository at this point in the history
The go.mod dependency tree for the shim was somehow contradictory. After
resolving these issues (e.g. explicitly imported k8s 1.14, pulling a
specific dbus version), and adding all dependencies, the shim can now be
build as part of the regular bazel tree.

As part of this process, minor cleanup was done in all the source files:
headers were standardized (and include "The gVisor Authors" in addition
to the "The containerd Authors" if originally derived from containerd
sources), and comments were cleaned up to meet coding standards.

This change makes the containerd installation dynamic, so that multiple
versions can be tested, and drops the static installer for the VM image
itself.

This change also updates test/root/crictl_test.go and related utilities,
so that the containerd tests can be run on any version (and in cases
where it applies, they can be run on both v1 and v2 as parameterized
tests).
  • Loading branch information
amscanne committed Jul 10, 2020
1 parent 2f24ab3 commit 2afff44
Show file tree
Hide file tree
Showing 72 changed files with 2,166 additions and 1,860 deletions.
3 changes: 3 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ go_path(
name = "gopath",
mode = "link",
deps = [
# Main binary.
"//runsc",
"//shim/v1:gvisor-containerd-shim",
"//shim/v2:containerd-shim-runsc-v1",

# Packages that are not dependencies of //runsc.
"//pkg/sentry/kernel/memevent",
Expand Down
23 changes: 21 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,22 @@ tests: ## Runs all local ptrace system call tests.
@$(MAKE) test OPTIONS="--test_tag_filters runsc_ptrace test/syscalls/..."
.PHONY: tests

containerd-test-%: ## Runs a local containerd test.
containerd-test-%: load-basic_alpine load-basic_python load-basic_busybox load-basic_resolv load-basic_httpd
containerd-test-%: install-test-runtime
@CONTAINERD_VERSION=$* $(MAKE) sudo TARGETS="tools/installers:containerd"
@$(MAKE) sudo TARGETS="test/root:root_test" ARGS="-test.v"

# Note that we can't run containerd-test-1.1.8 tests here.
#
# Containerd 1.1.8 should work, but because of a bug in loading images locally
# (https://github.com/kubernetes-sigs/cri-tools/issues/421), we are unable to
# actually drive the tests. The v1 API is tested exclusively through 1.2.13.
containerd-tests: ## Runs all supported containerd version tests.
containerd-tests: containerd-test-1.2.13
containerd-tests: containerd-test-1.3.4
containerd-tests: containerd-test-1.4.0-beta.0

##
## Website & documentation helpers.
##
Expand Down Expand Up @@ -233,11 +249,14 @@ dev: ## Installs a set of local runtimes. Requires sudo.

refresh: ## Refreshes the runtime binary (for development only). Must have called 'dev' or 'test-install' first.
@mkdir -p "$(RUNTIME_DIR)"
@$(MAKE) copy TARGETS=runsc DESTINATION="$(RUNTIME_BIN)" && chmod 0755 "$(RUNTIME_BIN)"
@$(MAKE) copy TARGETS=runsc DESTINATION="$(RUNTIME_BIN)"
@$(MAKE) copy TARGETS=shim/v1:gvisor-containerd-shim DESTINATION="$(RUNTIME_DIR)"
@$(MAKE) copy TARGETS=shim/v2:containerd-shim-runsc-v1 DESTINATION="$(RUNTIME_DIR)"
.PHONY: install

test-install: ## Installs the runtime for testing. Requires sudo.
install-test-runtime: ## Installs the runtime for testing. Requires sudo.
@$(MAKE) refresh ARGS="--net-raw --TESTONLY-test-name-env=RUNSC_TEST_NAME --debug --strace --log-packets $(ARGS)"
@$(MAKE) configure RUNTIME=runsc
@$(MAKE) configure
@sudo systemctl restart docker
.PHONY: install-test
Expand Down
Loading

0 comments on commit 2afff44

Please sign in to comment.