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

osmith gerrit-no-reply at
Tue Jul 23 12:11:53 UTC 2019

osmith has submitted this change and it was merged. ( )

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.

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

  osmith: Verified
  pespin: Looks good to me, approved

diff --git a/debian-repo-install-test/ b/debian-repo-install-test/
index db71bc6..fbae4b9 100755
--- a/debian-repo-install-test/
+++ b/debian-repo-install-test/
@@ -3,27 +3,34 @@
 docker_images_require "debian-repo-install-test"
 [ -z "$FEED" ] && FEED="nightly"
 # Try to run "systemctl status" 10 times, kill the container on failure
 check_if_systemd_is_running() {
 	for i in $(seq 1 10); do
 		sleep 1
-		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
+# Kill already running container
+if [ "$(docker inspect -f '{{.State.Running}}' "$CONTAINER" 2> /dev/null)" = "true" ]; then
+	docker container kill "$CONTAINER"
+	sleep 1
 # 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 \
@@ -35,14 +42,14 @@
 # Run the test script
-docker exec "$BUILD_TAG" /testdata/
+docker exec "$CONTAINER" /testdata/
 # Interactive shell
 if [ -n "$INTERACTIVE" ]; then
-	docker exec -it "$BUILD_TAG" bash
+	docker exec -it "$CONTAINER" bash
-docker container kill "$BUILD_TAG"
+docker container kill "$CONTAINER"
 exit $ret

To view, visit
To unsubscribe, or for help writing mail filters, visit

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: Ide795092b656c9f0eb92a075d8f662944089019f
Gerrit-Change-Number: 14780
Gerrit-PatchSet: 5
Gerrit-Owner: osmith <osmith at>
Gerrit-Reviewer: laforge <laforge at>
Gerrit-Reviewer: osmith <osmith at>
Gerrit-Reviewer: pespin <pespin at>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gerrit-log mailing list