Change in ...docker-playground[master]: debian-repo-install-test: kill already running

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
Mon Jul 15 12:33:28 UTC 2019


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/docker-playground/+/14780


Change subject: debian-repo-install-test: kill already running
......................................................................

debian-repo-install-test: kill already running

The container grows heavily in size as the test runs, so make sure to
always kill existing ones (from stopped jobs) before starting a new
one. In order to do that, do not use $BUILD_TAG as container name,
which changes with every new jenkins run. Hardcode "repo-install-test"
instead.

Related: OS#3369
Change-Id: Ide795092b656c9f0eb92a075d8f662944089019f
---
M debian-repo-install-test/jenkins.sh
1 file changed, 12 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/docker-playground refs/changes/80/14780/1

diff --git a/debian-repo-install-test/jenkins.sh b/debian-repo-install-test/jenkins.sh
index 865ba22..909aa1f 100755
--- a/debian-repo-install-test/jenkins.sh
+++ b/debian-repo-install-test/jenkins.sh
@@ -3,13 +3,19 @@
 docker_images_require "debian-repo-install-test"
 
 [ -z "$FEED" ] && FEED="nightly"
+CONTAINER="repo-install-test"
+
+# Kill already running container
+if [ "$(docker inspect -f '{{.State.Running}}' "$CONTAINER" 2> /dev/null)" = "true" ]; then
+	docker container kill "$CONTAINER"
+fi
 
 # Run the container
 # Note that this does not output anything. For debugging, add -it and remove &.
 docker run	--rm \
 		-v "$PWD/testdata:/testdata:ro" \
 		-v "$VOL_BASE_DIR:/data" \
-		--name "${BUILD_TAG}" \
+		--name "$CONTAINER" \
 		-e FEED="$FEED" \
 		-e container=docker \
 		--tmpfs /run \
@@ -21,21 +27,21 @@
 sleep 1
 
 # Check if systemd is running
-if ! docker exec "$BUILD_TAG" systemctl status; then
+if ! docker exec "$CONTAINER" systemctl status; then
 	echo "ERROR: systemd is not running properly."
-	docker container kill "$BUILD_TAG"
+	docker container kill "$CONTAINER"
 	exit 1
 fi
 
 # Run the test script
-docker exec "$BUILD_TAG" /testdata/repo-install-test.sh
+docker exec "$CONTAINER" /testdata/repo-install-test.sh
 ret="$?"
 
 # Interactive shell
 if [ -n "$INTERACTIVE" ]; then
-	docker exec -it "$BUILD_TAG" bash
+	docker exec -it "$CONTAINER" bash
 fi
 
-docker container kill "$BUILD_TAG"
+docker container kill "$CONTAINER"
 
 exit $ret

-- 
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/14780
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: Ide795092b656c9f0eb92a075d8f662944089019f
Gerrit-Change-Number: 14780
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190715/153fa776/attachment.htm>


More information about the gerrit-log mailing list