From 12b961942af0c6761573d0632ca0e16339fb33c3 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Fri, 19 Feb 2021 15:14:42 +0100 Subject: jenkins-common.sh: add common clean up trap Add set_clean_up_trap() in jenkins-common.sh and run it at the beginning of the jenkins.sh files. Move the common clean up code from the end of every jenkins.sh file into clean_up_common(), which gets called by the trap. Add a custom clean_up() function to those jenkins.sh files that need additional clean up. Replace explicit container stop commands (for containers attached to the docker network) with one call to network_clean() in clean_up_common(). It kills all containers attached to the docker network. The motivation for this change is the upcoming optional build of initrd and kernel during ttcn3-ggsn-test/jenkins.sh. After building these, a short smoke test will be performed to make sure we can boot the kernel and initrd, before continuing to run the entire testsuite against it. If building or the smoke test fails, we must do a proper clean up of the network and fix permissions. Related: OS#3208 Change-Id: I807c6221d22fec31db23e2516e477a3eb43347fb --- ttcn3-msc-test/jenkins.sh | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'ttcn3-msc-test') diff --git a/ttcn3-msc-test/jenkins.sh b/ttcn3-msc-test/jenkins.sh index 90770cb..373fa7e 100755 --- a/ttcn3-msc-test/jenkins.sh +++ b/ttcn3-msc-test/jenkins.sh @@ -7,6 +7,8 @@ docker_images_require \ "osmo-msc-$IMAGE_SUFFIX" \ "ttcn3-msc-test" +set_clean_up_trap + SUBNET=20 network_create $SUBNET @@ -52,11 +54,3 @@ docker run --rm \ --name ${BUILD_TAG}-ttcn3-msc-test \ $DOCKER_ARGS \ $REPO_USER/ttcn3-msc-test - -echo Stopping containers -docker container kill ${BUILD_TAG}-msc -docker container kill ${BUILD_TAG}-stp - -network_remove -rm -rf $VOL_BASE_DIR/unix -collect_logs -- cgit v1.2.3