summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2020-05-18 09:40:07 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2020-05-18 09:45:22 +0000
commit14384c35a5d572f614fd950e176feb8247df18c4 (patch)
treeb694caddc94fa0b2a596d0382c55989da9d761ba
parentd18e3be48a10529d89058afb29f43c2da60af226 (diff)
start-container-docker.sh: Fix cleanup of $WORKSPACE/.lock
At the moment we add cleanup of $WORKSPACE/.lock only to v1 interface due to cat <<EOF CONTAINER_CLEANUP=${CONTAINER_CLEANUP}; <lock_cleanup> EOF not updating /current/ value of CONTAINER_CLEANUP, so <lock_cleanup> doesn't get added to ${prefix}container_cleanup() routine. This patches fixes this and somewhat simplifies the whole cleanup logic. Change-Id: I6b78e835876b6c1353b2a7501e3149c81ebbeefe
-rwxr-xr-xstart-container-docker.sh5
1 files changed, 2 insertions, 3 deletions
diff --git a/start-container-docker.sh b/start-container-docker.sh
index 62761f54..e9ad734f 100755
--- a/start-container-docker.sh
+++ b/start-container-docker.sh
@@ -357,7 +357,6 @@ fi
# For CI builds make sure to kill previous build, which might have been
# aborted by jenkins, but processes could have survived. Otherwise old
# build can start writing to files of the current build.
-cleanup_lock=false
if $bind_mounted_workspace; then
prev_container=$($SSH $session_host flock "$WORKSPACE/.lock" cat "$WORKSPACE/.lock" || true)
if [ x"$prev_container" != x"" ]; then
@@ -366,7 +365,7 @@ if $bind_mounted_workspace; then
fi
$SSH $session_host bash -c "\"mkdir -p $WORKSPACE && flock $WORKSPACE/.lock echo $session_name > $WORKSPACE/.lock\""
- cleanup_lock=true
+ CONTAINER_CLEANUP="${CONTAINER_CLEANUP}; $SSH $session_host flock $WORKSPACE/.lock rm $WORKSPACE/.lock"
fi
# Do not remove the container upon exit: it is now ready
@@ -386,7 +385,7 @@ cat <<EOF
# shellcheck disable=SC2034
# v1 interface
CONTAINER="${dryruncmd} $SSH -p ${session_port} ${user}${session_host}"
-CONTAINER_CLEANUP="${CONTAINER_CLEANUP}; if $cleanup_lock; then $SSH $session_host flock $WORKSPACE/.lock rm $WORKSPACE/.lock; fi"
+CONTAINER_CLEANUP="${CONTAINER_CLEANUP}"
session_host=${session_host}
session_port=${session_port}