From aa9b344fedde3f0a47a9f4c90758d0a2491abc53 Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Tue, 9 Jul 2019 14:59:36 -0700 Subject: [PATCH] Upload gvisor-addon to integration tests bucket; build gvisor image from common.sh --- Makefile | 2 +- hack/jenkins/common.sh | 4 ++++ test/integration/functional_test.go | 14 ------------- .../testdata/gvisor-addon-Dockerfile | 20 +++++++++++++++++++ 4 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 test/integration/testdata/gvisor-addon-Dockerfile diff --git a/Makefile b/Makefile index 336c07995a44..696301d380ad 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 ba4d46d085a2..0854cb707995 100755 --- a/hack/jenkins/common.sh +++ b/hack/jenkins/common.sh @@ -88,6 +88,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 597c0d9f9afe..b3027b4cc0ff 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 000000000000..3a0a7853f80d --- /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"]