mirror of https://github.com/docker/docs.git
Merge pull request #12500 from tianon/fix-daemon-logic
Fix daemon start/stop logic in hack/make/* scripts
This commit is contained in:
commit
dcbf89d023
|
@ -25,6 +25,7 @@ if [ -z "$DOCKER_TEST_HOST" ]; then
|
||||||
--pidfile "$DEST/docker.pid" \
|
--pidfile "$DEST/docker.pid" \
|
||||||
&> "$DEST/docker.log"
|
&> "$DEST/docker.log"
|
||||||
) &
|
) &
|
||||||
|
trap "source '${MAKEDIR}/.integration-daemon-stop'" EXIT # make sure that if the script exits unexpectedly, we stop this daemon we just started
|
||||||
else
|
else
|
||||||
export DOCKER_HOST="$DOCKER_TEST_HOST"
|
export DOCKER_HOST="$DOCKER_TEST_HOST"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
trap - EXIT # reset EXIT trap applied in .integration-daemon-start
|
||||||
|
|
||||||
for pidFile in $(find "$DEST" -name docker.pid); do
|
for pidFile in $(find "$DEST" -name docker.pid); do
|
||||||
pid=$(set -x; cat "$pidFile")
|
pid=$(set -x; cat "$pidFile")
|
||||||
( set -x; kill "$pid" )
|
( set -x; kill "$pid" )
|
||||||
|
|
|
@ -7,13 +7,6 @@ DEST=$1
|
||||||
(
|
(
|
||||||
source "${MAKEDIR}/.integration-daemon-start"
|
source "${MAKEDIR}/.integration-daemon-start"
|
||||||
|
|
||||||
# we need to wrap up everything in between integration-daemon-start and
|
|
||||||
# integration-daemon-stop to make sure we kill the daemon and don't hang,
|
|
||||||
# even and especially on test failures
|
|
||||||
didFail=
|
|
||||||
if ! {
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# TODO consider using frozen images for the dockercore/builder-deb tags
|
# TODO consider using frozen images for the dockercore/builder-deb tags
|
||||||
|
|
||||||
debVersion="${VERSION//-/'~'}"
|
debVersion="${VERSION//-/'~'}"
|
||||||
|
@ -69,14 +62,9 @@ DEST=$1
|
||||||
docker run --rm "$tempImage" bash -c 'cd .. && tar -c *_*' | tar -xvC "$DEST/$version"
|
docker run --rm "$tempImage" bash -c 'cd .. && tar -c *_*' | tar -xvC "$DEST/$version"
|
||||||
docker rmi "$tempImage"
|
docker rmi "$tempImage"
|
||||||
done
|
done
|
||||||
}; then
|
|
||||||
didFail=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# clean up after ourselves
|
# clean up after ourselves
|
||||||
rm -f Dockerfile.build
|
rm -f Dockerfile.build
|
||||||
|
|
||||||
source "${MAKEDIR}/.integration-daemon-stop"
|
source "${MAKEDIR}/.integration-daemon-stop"
|
||||||
|
) 2>&1 | tee -a "$DEST/test.log"
|
||||||
[ -z "$didFail" ] # "set -e" ftw
|
|
||||||
) 2>&1 | tee -a $DEST/test.log
|
|
||||||
|
|
|
@ -7,11 +7,6 @@ DEST=$1
|
||||||
(
|
(
|
||||||
source "${MAKEDIR}/.integration-daemon-start"
|
source "${MAKEDIR}/.integration-daemon-start"
|
||||||
|
|
||||||
# we need to wrap up everything in between integration-daemon-start and
|
|
||||||
# integration-daemon-stop to make sure we kill the daemon and don't hang,
|
|
||||||
# even and especially on test failures
|
|
||||||
didFail=
|
|
||||||
if ! {
|
|
||||||
dockerPy='/docker-py'
|
dockerPy='/docker-py'
|
||||||
[ -d "$dockerPy" ] || {
|
[ -d "$dockerPy" ] || {
|
||||||
dockerPy="$DEST/docker-py"
|
dockerPy="$DEST/docker-py"
|
||||||
|
@ -20,11 +15,6 @@ DEST=$1
|
||||||
|
|
||||||
# exporting PYTHONPATH to import "docker" from our local docker-py
|
# exporting PYTHONPATH to import "docker" from our local docker-py
|
||||||
test_env PYTHONPATH="$dockerPy" python "$dockerPy/tests/integration_test.py"
|
test_env PYTHONPATH="$dockerPy" python "$dockerPy/tests/integration_test.py"
|
||||||
}; then
|
|
||||||
didFail=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
source "${MAKEDIR}/.integration-daemon-stop"
|
source "${MAKEDIR}/.integration-daemon-stop"
|
||||||
|
) 2>&1 | tee -a "$DEST/test.log"
|
||||||
[ -z "$didFail" ] # "set -e" ftw
|
|
||||||
) 2>&1 | tee -a $DEST/test.log
|
|
||||||
|
|
|
@ -11,21 +11,11 @@ bundle_test_integration_cli() {
|
||||||
(
|
(
|
||||||
source "${MAKEDIR}/.integration-daemon-start"
|
source "${MAKEDIR}/.integration-daemon-start"
|
||||||
|
|
||||||
# we need to wrap up everything in between integration-daemon-start and
|
|
||||||
# integration-daemon-stop to make sure we kill the daemon and don't hang,
|
|
||||||
# even and especially on test failures
|
|
||||||
didFail=
|
|
||||||
if ! {
|
|
||||||
source "${MAKEDIR}/.ensure-frozen-images"
|
source "${MAKEDIR}/.ensure-frozen-images"
|
||||||
source "${MAKEDIR}/.ensure-httpserver"
|
source "${MAKEDIR}/.ensure-httpserver"
|
||||||
source "${MAKEDIR}/.ensure-emptyfs"
|
source "${MAKEDIR}/.ensure-emptyfs"
|
||||||
|
|
||||||
bundle_test_integration_cli
|
bundle_test_integration_cli
|
||||||
}; then
|
|
||||||
didFail=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
source "${MAKEDIR}/.integration-daemon-stop"
|
source "${MAKEDIR}/.integration-daemon-stop"
|
||||||
|
|
||||||
[ -z "$didFail" ] # "set -e" ftw
|
|
||||||
) 2>&1 | tee -a "$DEST/test.log"
|
) 2>&1 | tee -a "$DEST/test.log"
|
||||||
|
|
Loading…
Reference in New Issue