summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2020-05-27 09:49:26 +0200
committerOliver Smith <osmith@sysmocom.de>2020-05-27 11:32:22 +0200
commitcabf1d96f2118e397274bda7af0c87b83ac9b710 (patch)
treedd5b4d09655656e8e63b1afd4409ea19dfa8bc73
parent449a2443f59709fec2d250b631f15d9c82df6f72 (diff)
repo-install-test: add KEEP_CACHE env var
Keep downloaded binary packages to make test cycles shorter during development. While at it, also document all environment variables. Change-Id: I4d6ebaf460e47f29e023acb0bd78ef52ca80c7cd
-rw-r--r--.gitignore1
-rwxr-xr-xscripts/repo-install-test.sh12
-rwxr-xr-xscripts/repo-install-test/run-inside-docker.sh17
3 files changed, 30 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index d6be3b5..78e48b5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,7 @@ _deps/
_release_tarballs/
_docker_playground
_repo_install_test_data/
+_repo_install_test_cache/
# osmocom-nightly-packages.sh
nightly-3g_*
diff --git a/scripts/repo-install-test.sh b/scripts/repo-install-test.sh
index 0a19b04..e0367ec 100755
--- a/scripts/repo-install-test.sh
+++ b/scripts/repo-install-test.sh
@@ -1,4 +1,8 @@
#!/bin/sh -ex
+# Environment variables:
+# * INTERACTIVE: set to 1 to keep an interactive shell open after the script ran (for debugging)
+# * FEED: binary package feed (e.g. "latest", "nightly")
+# * KEEP_CACHE: set to 1 to keep downloaded binary packages (for development)
. "$(dirname "$0")/common.sh"
docker_images_require "debian-repo-install-test"
@@ -25,6 +29,13 @@ if [ "$(docker inspect -f '{{.State.Running}}' "$CONTAINER" 2> /dev/null)" = "tr
sleep 1
fi
+# Additional docker run arguments
+args=""
+if [ -n "$KEEP_CACHE" ]; then
+ args="$args -e KEEP_CACHE=1"
+ args="$args -v $OSMO_CI_DIR/_repo_install_test_cache/debian/apt:/var/cache/apt"
+fi
+
# Run the container
# * This does not output anything, for debugging add -it and remove &.
# * /run, /tmp, cgroups, SYS_ADMIN: needed for systemd
@@ -41,6 +52,7 @@ docker run --rm \
-v /sys/fs/cgroup:/sys/fs/cgroup:ro \
--cap-add SYS_ADMIN \
--cap-add SYS_NICE \
+ $args \
"$USER/debian-repo-install-test" \
/lib/systemd/systemd &
check_if_systemd_is_running
diff --git a/scripts/repo-install-test/run-inside-docker.sh b/scripts/repo-install-test/run-inside-docker.sh
index 135d2d6..eed33d2 100755
--- a/scripts/repo-install-test/run-inside-docker.sh
+++ b/scripts/repo-install-test/run-inside-docker.sh
@@ -1,4 +1,7 @@
#!/bin/sh -ex
+# Environment variables:
+# * FEED: binary package feed (e.g. "latest", "nightly")
+# * KEEP_CACHE: set to 1 to keep downloaded binary packages (for development)
# Systemd services that must start up successfully after installing all packages (OS#3369)
# Disabled services:
@@ -49,6 +52,19 @@ configure_osmocom_repo() {
apt-get update
}
+configure_keep_cache() {
+ if [ -z "$KEEP_CACHE" ]; then
+ return
+ fi
+
+ rm /etc/apt/apt.conf.d/docker-clean
+
+ # "apt" will actually remove the cache by default, even if "apt-get" keeps it.
+ # https://unix.stackexchange.com/a/447607
+ echo "Binary::apt::APT::Keep-Downloaded-Packages "true";" \
+ > /etc/apt/apt.conf.d/01keep-debs
+}
+
install_repo_packages() {
echo "Installing all repository packages"
@@ -140,6 +156,7 @@ services_check() {
}
check_env
+configure_keep_cache
configure_osmocom_repo
install_repo_packages
test_binaries