mirror of https://gerrit.osmocom.org/osmo-ci
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
This commit is contained in:
parent
0e2604dae0
commit
a9c93850c3
|
@ -226,14 +226,15 @@
|
||||||
- copy_artifact:
|
- copy_artifact:
|
||||||
repo: osmo-gsm-tester_build-osmocom-bb
|
repo: osmo-gsm-tester_build-osmocom-bb
|
||||||
- shell: |
|
- shell: |
|
||||||
# Set a trap to fix workspace permissions on exit
|
# Set a trap to fix workspace permissions / kill the docker container on exit
|
||||||
fix_permissions() {
|
clean_up() {
|
||||||
|
docker kill "osmo-gsm-tester-virtual" || true
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v "$WORKSPACE":/workspace \
|
-v "$WORKSPACE":/workspace \
|
||||||
debian:bullseye \
|
debian:bullseye \
|
||||||
chmod -R a+rwX /workspace/
|
chmod -R a+rwX /workspace/
|
||||||
}
|
}
|
||||||
fix_permissions_trap() {
|
clean_up_trap() {
|
||||||
set +x
|
set +x
|
||||||
echo
|
echo
|
||||||
echo "### Clean up ###"
|
echo "### Clean up ###"
|
||||||
|
@ -241,12 +242,12 @@
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
trap - EXIT INT TERM 0
|
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
|
# Make sure no test results from a previous run remain
|
||||||
fix_permissions
|
clean_up
|
||||||
rm -rf trial-*
|
rm -rf trial-*
|
||||||
|
|
||||||
# Build the docker image
|
# Build the docker image
|
||||||
|
@ -277,6 +278,7 @@
|
||||||
-w /build -i \
|
-w /build -i \
|
||||||
-v "$PWD:/build" \
|
-v "$PWD:/build" \
|
||||||
-v "$HOME/.ssh:/home/build/.ssh:ro" \
|
-v "$HOME/.ssh:/home/build/.ssh:ro" \
|
||||||
|
--name=osmo-gsm-tester-virtual \
|
||||||
--cap-add=sys_nice \
|
--cap-add=sys_nice \
|
||||||
$USER/osmo-gsm-tester \
|
$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'
|
/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'
|
||||||
|
|
|
@ -18,7 +18,7 @@ kill_docker_containers_running_longer_than_24h() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$name" in
|
case "$name" in
|
||||||
jenkins-*|*ttcn3*) ;;
|
jenkins-*|*ttcn3*|osmo-gsm-tester*) ;;
|
||||||
*)
|
*)
|
||||||
echo "$name: does not match name pattern"
|
echo "$name: does not match name pattern"
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue