summaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorAdin Scannell <ascannell@google.com>2020-04-24 14:10:28 -0700
committergVisor bot <gvisor-bot@google.com>2020-04-24 14:11:42 -0700
commitc60613475c92185c9b15468d0de87b321ef2b4d7 (patch)
tree470683d83c53ee44c174a06b5f673e5e19e1a38f /scripts
parentf13f26d17da56d585fd9857a81175bbd0be8ce60 (diff)
Standardize all Docker images.
This change moves all Docker images to a standard location, and abstracts the build process so that they can be maintained in an automated fashion. This also allows the images to be architecture-independent. All images will now be referred to by the test framework via the canonical `gvisor.dev/images/<name>`, where `<name>` is a function of the path within the source tree. In a subsequent change, continuous integration will be added so that the images will always be correct and available locally. In the end, using `bazel` for Docker containers is simply not possible. Given that we already have the need to use `make` with the base container (for Docker), we extend this approach to get more flexibility. This change also adds a self-documenting and powerful Makefile that is intended to replace the collection of scripts in scripts. Canonical (self-documenting) targets can be added here for targets that understand which images need to be loaded and/or built. PiperOrigin-RevId: 308322438
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build.sh4
-rwxr-xr-xscripts/common.sh22
-rwxr-xr-xscripts/docker_tests.sh2
-rwxr-xr-xscripts/hostnet_tests.sh2
-rwxr-xr-xscripts/iptables_tests.sh6
-rwxr-xr-xscripts/kvm_tests.sh2
-rwxr-xr-xscripts/make_tests.sh5
-rwxr-xr-xscripts/overlay_tests.sh2
-rwxr-xr-xscripts/packetdrill_tests.sh2
-rwxr-xr-xscripts/packetimpact_tests.sh2
-rwxr-xr-xscripts/root_tests.sh3
-rwxr-xr-xscripts/swgso_tests.sh2
12 files changed, 20 insertions, 34 deletions
diff --git a/scripts/build.sh b/scripts/build.sh
index 7c9c99800..e821e8624 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -16,9 +16,6 @@
source $(dirname $0)/common.sh
-# Install required packages for make_repository.sh et al.
-apt_install dpkg-sig coreutils apt-utils xz-utils
-
# Build runsc.
runsc=$(build -c opt //runsc)
@@ -45,7 +42,6 @@ if [[ -v KOKORO_REPO_KEY ]]; then
repo=$(tools/make_repository.sh \
"${KOKORO_KEYSTORE_DIR}/${KOKORO_REPO_KEY}" \
gvisor-bot@google.com \
- main \
"${KOKORO_ARTIFACTS_DIR}" \
${pkgs})
fi
diff --git a/scripts/common.sh b/scripts/common.sh
index bc6ba71e8..3ca699e4a 100755
--- a/scripts/common.sh
+++ b/scripts/common.sh
@@ -84,25 +84,3 @@ function install_runsc() {
# Restart docker to pick up the new runtime configuration.
sudo systemctl restart docker
}
-
-# Installs the given packages. Note that the package names should be verified to
-# be correct, otherwise this may result in a loop that spins until time out.
-function apt_install() {
- while true; do
- sudo apt-get update &&
- sudo apt-get install -y "$@" &&
- true
- result="${?}"
- case $result in
- 0)
- break
- ;;
- 100)
- # 100 is the error code that apt-get returns.
- ;;
- *)
- exit $result
- ;;
- esac
- done
-}
diff --git a/scripts/docker_tests.sh b/scripts/docker_tests.sh
index 72ba05260..931ce1aa4 100755
--- a/scripts/docker_tests.sh
+++ b/scripts/docker_tests.sh
@@ -16,5 +16,7 @@
source $(dirname $0)/common.sh
+make load-all-images
+
install_runsc_for_test docker
test_runsc //test/image:image_test //test/e2e:integration_test
diff --git a/scripts/hostnet_tests.sh b/scripts/hostnet_tests.sh
index 41298293d..992db50dd 100755
--- a/scripts/hostnet_tests.sh
+++ b/scripts/hostnet_tests.sh
@@ -16,6 +16,8 @@
source $(dirname $0)/common.sh
+make load-all-images
+
# Install the runtime and perform basic tests.
install_runsc_for_test hostnet --network=host
test_runsc --test_arg=-checkpoint=false //test/image:image_test //test/e2e:integration_test
diff --git a/scripts/iptables_tests.sh b/scripts/iptables_tests.sh
index c8da1f32d..2a8c24907 100755
--- a/scripts/iptables_tests.sh
+++ b/scripts/iptables_tests.sh
@@ -16,6 +16,8 @@
source $(dirname $0)/common.sh
+make load-iptables
+
install_runsc_for_test iptables --net-raw
-test //test/iptables:iptables_test --test_arg=--runtime=runc
-test //test/iptables:iptables_test --test_arg=--runtime=${RUNTIME}
+test //test/iptables:iptables_test "--test_arg=--runtime=runc"
+test //test/iptables:iptables_test "--test_arg=--runtime=${RUNTIME}"
diff --git a/scripts/kvm_tests.sh b/scripts/kvm_tests.sh
index 5662401df..619571c74 100755
--- a/scripts/kvm_tests.sh
+++ b/scripts/kvm_tests.sh
@@ -16,6 +16,8 @@
source $(dirname $0)/common.sh
+make load-all-images
+
# Ensure that KVM is loaded, and we can use it.
(lsmod | grep -E '^(kvm_intel|kvm_amd)') || sudo modprobe kvm
sudo chmod a+rw /dev/kvm
diff --git a/scripts/make_tests.sh b/scripts/make_tests.sh
index 79426756d..dbf1bba77 100755
--- a/scripts/make_tests.sh
+++ b/scripts/make_tests.sh
@@ -16,10 +16,5 @@
source $(dirname $0)/common.sh
-top_level=$(git rev-parse --show-toplevel 2>/dev/null)
-[[ $? -eq 0 ]] && cd "${top_level}" || exit 1
-
-make
make runsc
-make BAZEL_OPTIONS="build //..." bazel
make bazel-shutdown
diff --git a/scripts/overlay_tests.sh b/scripts/overlay_tests.sh
index 2a1f12c0b..448864953 100755
--- a/scripts/overlay_tests.sh
+++ b/scripts/overlay_tests.sh
@@ -16,6 +16,8 @@
source $(dirname $0)/common.sh
+make load-all-images
+
# Install the runtime and perform basic tests.
install_runsc_for_test overlay --overlay
test_runsc //test/image:image_test //test/e2e:integration_test
diff --git a/scripts/packetdrill_tests.sh b/scripts/packetdrill_tests.sh
index fc6bef79c..f0fc444c8 100755
--- a/scripts/packetdrill_tests.sh
+++ b/scripts/packetdrill_tests.sh
@@ -16,5 +16,7 @@
source $(dirname $0)/common.sh
+make load-packetdrill
+
install_runsc_for_test runsc-d
test_runsc $(bazel query "attr(tags, manual, tests(//test/packetdrill/...))")
diff --git a/scripts/packetimpact_tests.sh b/scripts/packetimpact_tests.sh
index 027d11e64..17fc43f27 100755
--- a/scripts/packetimpact_tests.sh
+++ b/scripts/packetimpact_tests.sh
@@ -16,5 +16,7 @@
source $(dirname $0)/common.sh
+make load-packetimpact
+
install_runsc_for_test runsc-d
test_runsc $(bazel query "attr(tags, packetimpact, tests(//test/packetimpact/...))")
diff --git a/scripts/root_tests.sh b/scripts/root_tests.sh
index 4e4fcc76b..d629bf2aa 100755
--- a/scripts/root_tests.sh
+++ b/scripts/root_tests.sh
@@ -16,6 +16,8 @@
source $(dirname $0)/common.sh
+make load-all-images
+
# Reinstall the latest containerd shim.
declare -r base="https://storage.googleapis.com/cri-containerd-staging/gvisor-containerd-shim"
declare -r latest=$(mktemp --tmpdir gvisor-containerd-shim-latest.XXXXXX)
@@ -28,4 +30,3 @@ sudo mv ${shim_path} /usr/local/bin/gvisor-containerd-shim
# Run the tests that require root.
install_runsc_for_test root
run_as_root //test/root:root_test --runtime=${RUNTIME}
-
diff --git a/scripts/swgso_tests.sh b/scripts/swgso_tests.sh
index 0de2df1d2..c67f2fe5c 100755
--- a/scripts/swgso_tests.sh
+++ b/scripts/swgso_tests.sh
@@ -16,6 +16,8 @@
source $(dirname $0)/common.sh
+make load-all-images
+
# Install the runtime and perform basic tests.
install_runsc_for_test swgso --software-gso=true --gso=false
test_runsc //test/image:image_test //test/e2e:integration_test