Change in osmo-ci[master]: repo-install-test: add KEEP_CACHE env var

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

osmith gerrit-no-reply at lists.osmocom.org
Thu May 28 09:53:25 UTC 2020


osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ci/+/18513 )

Change subject: repo-install-test: add KEEP_CACHE env var
......................................................................

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
---
M .gitignore
M scripts/repo-install-test.sh
M scripts/repo-install-test/run-inside-docker.sh
3 files changed, 30 insertions(+), 0 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  osmith: Verified



diff --git a/.gitignore b/.gitignore
index d6be3b5..78e48b5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,7 @@
 _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 @@
 	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 @@
 		-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 @@
 	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 @@
 }
 
 check_env
+configure_keep_cache
 configure_osmocom_repo
 install_repo_packages
 test_binaries

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/18513
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I4d6ebaf460e47f29e023acb0bd78ef52ca80c7cd
Gerrit-Change-Number: 18513
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200528/cfb88480/attachment.htm>


More information about the gerrit-log mailing list