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
This commit is contained in:
Oliver Smith 2020-05-27 09:49:26 +02:00 committed by osmith
parent 118915fba7
commit ee7d5314fb
3 changed files with 30 additions and 0 deletions

1
.gitignore vendored
View File

@ -11,6 +11,7 @@ _deps/
_release_tarballs/
_docker_playground
_repo_install_test_data/
_repo_install_test_cache/
# osmocom-nightly-packages.sh
nightly-3g_*

View File

@ -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

View File

@ -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