diff --git a/Makefile b/Makefile index 336c07995a..696301d380 100755 --- a/Makefile +++ b/Makefile @@ -175,7 +175,7 @@ test-pkg/%: pkg/minikube/assets/assets.go pkg/minikube/translate/translations.go go test -v -test.timeout=60m ./$* --tags="$(MINIKUBE_BUILD_TAGS)" .PHONY: all -all: cross drivers e2e-cross +all: cross drivers e2e-cross out/gvisor-addon .PHONY: drivers drivers: out/docker-machine-driver-hyperkit out/docker-machine-driver-kvm2 diff --git a/hack/jenkins/common.sh b/hack/jenkins/common.sh index ba4d46d085..8f7e44dc17 100755 --- a/hack/jenkins/common.sh +++ b/hack/jenkins/common.sh @@ -71,7 +71,8 @@ echo ">> Downloading test inputs from ${MINIKUBE_LOCATION} ..." gsutil -qm cp \ "gs://minikube-builds/${MINIKUBE_LOCATION}/minikube-${OS_ARCH}" \ "gs://minikube-builds/${MINIKUBE_LOCATION}/docker-machine-driver"-* \ - "gs://minikube-builds/${MINIKUBE_LOCATION}/e2e-${OS_ARCH}" out + "gs://minikube-builds/${MINIKUBE_LOCATION}/e2e-${OS_ARCH}" out \ + "gs://minikube-builds/${MINIKUBE_LOCATION}/gvisor-addon" out gsutil -qm cp "gs://minikube-builds/${MINIKUBE_LOCATION}/testdata"/* testdata/ @@ -88,6 +89,10 @@ if [[ "${procs}" != "" ]]; then kill -9 ${procs} || true fi +# Build gvisor image locally +echo ">> Building gvisor addon image locally." +docker build -t gcr.io/k8s-minikube/gvisor-addon:latest -f testdata/gvisor-addon-Dockerfile out + # Cleanup stale test outputs. echo "" echo ">> Cleaning up after previous test runs ..." diff --git a/test/integration/functional_test.go b/test/integration/functional_test.go index 597c0d9f9a..b3027b4cc0 100644 --- a/test/integration/functional_test.go +++ b/test/integration/functional_test.go @@ -19,12 +19,10 @@ limitations under the License. package integration import ( - "os/exec" "strings" "testing" "github.com/docker/machine/libmachine/state" - "k8s.io/minikube/pkg/minikube/constants" "k8s.io/minikube/test/integration/util" ) @@ -62,24 +60,12 @@ func TestFunctionalContainerd(t *testing.T) { r.RunCommand("delete", true) } - // Build current version of the gvisor image. - buildGvisorImage(t) - r.Start("--container-runtime=containerd", "--docker-opt containerd=/var/run/containerd/containerd.sock") t.Run("Gvisor", testGvisor) t.Run("GvisorRestart", testGvisorRestart) r.RunCommand("delete", true) } -func buildGvisorImage(t *testing.T) { - cmd := exec.Command("docker", "build", "-t", constants.GvisorImage, "-f", "deploy/gvisor/Dockerfile", ".") - cmd.Dir = "../../" - stdout, err := cmd.CombinedOutput() - if err != nil { - t.Fatalf("Error running command: %s in directory: %s %v. Output: %s", cmd.Args, cmd.Dir, err, string(stdout)) - } -} - // usingNoneDriver returns true if using the none driver func usingNoneDriver(r util.MinikubeRunner) bool { return strings.Contains(r.StartArgs, "--vm-driver=none") diff --git a/test/integration/testdata/gvisor-addon-Dockerfile b/test/integration/testdata/gvisor-addon-Dockerfile new file mode 100644 index 0000000000..3a0a7853f8 --- /dev/null +++ b/test/integration/testdata/gvisor-addon-Dockerfile @@ -0,0 +1,20 @@ +# Copyright 2016 The Kubernetes Authors All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM ubuntu:18.04 +RUN apt-get update && \ + apt-get install -y kmod gcc wget xz-utils libc6-dev bc libelf-dev bison flex openssl libssl-dev libidn2-0 sudo libcap2 && \ + rm -rf /var/lib/apt/lists/* +COPY gvisor-addon /gvisor-addon +CMD ["/gvisor-addon"]