aboutsummaryrefslogtreecommitdiffstats
path: root/jobs/osmo-gsm-tester-runner.yml
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2023-12-14 11:00:58 +0100
committerOliver Smith <osmith@sysmocom.de>2023-12-14 11:11:27 +0100
commita9c93850c35e3bac01b6d58e6c00df0e83806617 (patch)
treea23aed809ddf4da24bf1108502362132dafd3220 /jobs/osmo-gsm-tester-runner.yml
parent0e2604dae0f5cf13c3697784279dee5d624c7b84 (diff)
jobs/osmo-gsm-tester-virtual: kill old instances
Make sure osmo-gsm-tester gets killed eventually, even if a bug causes it to run forever or if aborted manually. * add a name to the docker container * kill the docker container if it runs longer than 24h with docker-cleanup.sh * rename fix_permissions_trap to clean_up_trap and kill it there, when it is still running before the job starts and after it is done (in my testing this did not kill it after pressing abort, but it would be killed either at the start of the next job running on the same jenkins node, or after 24h by docker-cleanup.sh) Related: OS#6304 Change-Id: I6fc874d319d74aabdc33c10910cbcca2978d5bbb
Diffstat (limited to 'jobs/osmo-gsm-tester-runner.yml')
-rw-r--r--jobs/osmo-gsm-tester-runner.yml14
1 files changed, 8 insertions, 6 deletions
diff --git a/jobs/osmo-gsm-tester-runner.yml b/jobs/osmo-gsm-tester-runner.yml
index 83040dc..4909fe7 100644
--- a/jobs/osmo-gsm-tester-runner.yml
+++ b/jobs/osmo-gsm-tester-runner.yml
@@ -226,14 +226,15 @@
- copy_artifact:
repo: osmo-gsm-tester_build-osmocom-bb
- shell: |
- # Set a trap to fix workspace permissions on exit
- fix_permissions() {
+ # Set a trap to fix workspace permissions / kill the docker container on exit
+ clean_up() {
+ docker kill "osmo-gsm-tester-virtual" || true
docker run --rm \
-v "$WORKSPACE":/workspace \
debian:bullseye \
chmod -R a+rwX /workspace/
}
- fix_permissions_trap() {
+ clean_up_trap() {
set +x
echo
echo "### Clean up ###"
@@ -241,12 +242,12 @@
set -x
trap - EXIT INT TERM 0
- fix_permissions
+ clean_up
}
- trap fix_permissions_trap EXIT INT TERM 0
+ trap clean_up_trap EXIT INT TERM 0
# Make sure no test results from a previous run remain
- fix_permissions
+ clean_up
rm -rf trial-*
# Build the docker image
@@ -277,6 +278,7 @@
-w /build -i \
-v "$PWD:/build" \
-v "$HOME/.ssh:/home/build/.ssh:ro" \
+ --name=osmo-gsm-tester-virtual \
--cap-add=sys_nice \
$USER/osmo-gsm-tester \
/bin/bash -c 'LANG="en_US.utf8" LC_ALL="en_US.UTF-8" LC_LANG="en_US.UTF-8" PATH="$PWD/osmo-gsm-tester/src:${PATH}" ./osmo-gsm-tester/contrib/jenkins-run.sh'