2017-02-13 14:01:54 -05:00
|
|
|
#!/usr/bin/env bash
|
2014-12-19 02:20:59 -05:00
|
|
|
|
2019-01-09 20:23:38 -05:00
|
|
|
if [ ! "$(go env GOOS)" = 'windows' ]; then
|
2016-01-05 13:52:59 -05:00
|
|
|
for pidFile in $(find "$DEST" -name docker.pid); do
|
2020-03-02 22:27:49 -05:00
|
|
|
pid=$(
|
|
|
|
[ -n "$TESTDEBUG" ] && set -x
|
|
|
|
cat "$pidFile"
|
|
|
|
)
|
2017-07-06 17:20:41 -04:00
|
|
|
(
|
2019-01-09 20:23:38 -05:00
|
|
|
[ -n "$TESTDEBUG" ] && set -x
|
2017-07-06 17:20:41 -04:00
|
|
|
kill "$pid"
|
|
|
|
)
|
2016-01-05 13:52:59 -05:00
|
|
|
if ! wait "$pid"; then
|
|
|
|
echo >&2 "warning: PID $pid from $pidFile had a nonzero exit code"
|
|
|
|
fi
|
2019-08-05 19:55:30 -04:00
|
|
|
root=$(dirname "$pidFile")/root
|
2019-10-09 06:55:25 -04:00
|
|
|
if [ -d "$root" ]; then
|
|
|
|
umount "$root" || true
|
|
|
|
fi
|
2016-01-05 13:52:59 -05:00
|
|
|
done
|
2015-05-04 16:20:01 -04:00
|
|
|
|
2019-01-09 20:23:38 -05:00
|
|
|
if [ -z "$DOCKER_TEST_HOST" ]; then
|
2016-01-05 13:52:59 -05:00
|
|
|
# Stop apparmor if it is enabled
|
2019-01-09 20:23:38 -05:00
|
|
|
if [ -e "/sys/module/apparmor/parameters/enabled" ] && [ "$(cat /sys/module/apparmor/parameters/enabled)" == "Y" ]; then
|
2016-01-05 13:52:59 -05:00
|
|
|
(
|
2019-01-09 20:23:38 -05:00
|
|
|
[ -n "$TESTDEBUG" ] && set -x
|
2020-01-09 12:49:11 -05:00
|
|
|
/etc/init.d/apparmor stop || true
|
2016-01-05 13:52:59 -05:00
|
|
|
)
|
|
|
|
fi
|
2015-05-04 16:20:01 -04:00
|
|
|
fi
|
2016-01-05 13:52:59 -05:00
|
|
|
else
|
2020-03-02 22:27:49 -05:00
|
|
|
# Note this script is not actionable on Windows to Linux CI. Instead the
|
2016-01-05 13:52:59 -05:00
|
|
|
# DIND daemon under test is torn down by the Jenkins tear-down script
|
|
|
|
echo "INFO: Not stopping daemon on Windows CI"
|
2015-05-04 16:20:01 -04:00
|
|
|
fi
|