Merge pull request #91 from jcfr/capture-btrfs-error-rebased

dockcross: Ensure deletion error are ignored
This commit is contained in:
Matt McCormick 2016-11-28 23:16:37 -05:00 committed by GitHub
commit 2b620ad718
2 changed files with 23 additions and 9 deletions

View File

@ -26,6 +26,13 @@ linux-ppc64le.test_ARGS = --languages C
windows-x86.test_ARGS = --exe-suffix ".exe" windows-x86.test_ARGS = --exe-suffix ".exe"
windows-x64.test_ARGS = --exe-suffix ".exe" windows-x64.test_ARGS = --exe-suffix ".exe"
# On CircleCI, do not attempt to delete container
# See https://circleci.com/docs/docker-btrfs-error/
RM = "--rm"
ifeq ("$(CIRCLECI)", "true")
RM = ""
endif
# #
# images: This target builds all IMAGES (because it is the first one, it is built by default) # images: This target builds all IMAGES (because it is the first one, it is built by default)
# #
@ -54,7 +61,7 @@ browser-asmjs: browser-asmjs/Dockerfile.in common.docker common.debian
browser-asmjs.test: browser-asmjs browser-asmjs.test: browser-asmjs
cp -r test browser-asmjs/ cp -r test browser-asmjs/
$(DOCKER) run --rm dockcross/browser-asmjs > $(BIN)/dockcross-browser-asmjs && chmod +x $(BIN)/dockcross-browser-asmjs $(DOCKER) run $(RM) dockcross/browser-asmjs > $(BIN)/dockcross-browser-asmjs && chmod +x $(BIN)/dockcross-browser-asmjs
$(BIN)/dockcross-browser-asmjs python test/run.py --exe-suffix ".js" $(BIN)/dockcross-browser-asmjs python test/run.py --exe-suffix ".js"
rm -rf browser-asmjs/test rm -rf browser-asmjs/test
@ -75,7 +82,7 @@ manylinux-x64: manylinux-x64/Dockerfile
rm -rf $@/imagefiles rm -rf $@/imagefiles
manylinux-x64.test: manylinux-x64 manylinux-x64.test: manylinux-x64
$(DOCKER) run --rm dockcross/manylinux-x64 > $(BIN)/dockcross-manylinux-x64 && chmod +x $(BIN)/dockcross-manylinux-x64 $(DOCKER) run $(RM) dockcross/manylinux-x64 > $(BIN)/dockcross-manylinux-x64 && chmod +x $(BIN)/dockcross-manylinux-x64
$(BIN)/dockcross-manylinux-x64 /opt/python/cp35-cp35m/bin/python test/run.py $(BIN)/dockcross-manylinux-x64 /opt/python/cp35-cp35m/bin/python test/run.py
# #
@ -95,7 +102,7 @@ manylinux-x86: manylinux-x86/Dockerfile
rm -rf $@/imagefiles rm -rf $@/imagefiles
manylinux-x86.test: manylinux-x86 manylinux-x86.test: manylinux-x86
$(DOCKER) run --rm dockcross/manylinux-x86 > $(BIN)/dockcross-manylinux-x86 && chmod +x $(BIN)/dockcross-manylinux-x86 $(DOCKER) run $(RM) dockcross/manylinux-x86 > $(BIN)/dockcross-manylinux-x86 && chmod +x $(BIN)/dockcross-manylinux-x86
$(BIN)/dockcross-manylinux-x86 /opt/python/cp35-cp35m/bin/python test/run.py $(BIN)/dockcross-manylinux-x86 /opt/python/cp35-cp35m/bin/python test/run.py
# #
@ -111,7 +118,7 @@ base: Dockerfile imagefiles/
. .
base.test: base base.test: base
$(DOCKER) run --rm dockcross/base > $(BIN)/dockcross-base && chmod +x $(BIN)/dockcross-base $(DOCKER) run $(RM) dockcross/base > $(BIN)/dockcross-base && chmod +x $(BIN)/dockcross-base
# #
# display # display
@ -139,7 +146,7 @@ $(STANDARD_IMAGES): base
# #
.SECONDEXPANSION: .SECONDEXPANSION:
$(addsuffix .test,$(STANDARD_IMAGES)): $$(basename $$@) $(addsuffix .test,$(STANDARD_IMAGES)): $$(basename $$@)
$(DOCKER) run --rm dockcross/$(basename $@) > $(BIN)/dockcross-$(basename $@) && chmod +x $(BIN)/dockcross-$(basename $@) $(DOCKER) run $(RM) dockcross/$(basename $@) > $(BIN)/dockcross-$(basename $@) && chmod +x $(BIN)/dockcross-$(basename $@)
$(BIN)/dockcross-$(basename $@) python test/run.py $($@_ARGS) $(BIN)/dockcross-$(basename $@) python test/run.py $($@_ARGS)
# #

View File

@ -205,10 +205,17 @@ docker run $TTY_ARGS --name $CONTAINER_NAME \
$FINAL_IMAGE "$@" $FINAL_IMAGE "$@"
run_exit_code=$? run_exit_code=$?
# Deleting the container while ignoring error is required because of # Attempt to delete container
# https://circleci.com/docs/docker-btrfs-error/. rm_output=$(docker rm -f $CONTAINER_NAME 2>&1)
# See issue dockcross/dockcross#50 for more details. rm_exit_code=$?
docker rm -f $CONTAINER_NAME > /dev/null || true if [[ $rm_exit_code != 0 ]]; then
if [[ "$CIRCLECI" == "true" ]] && [[ $rm_output == *"Driver btrfs failed to remove"* ]]; then
: # Ignore error because of https://circleci.com/docs/docker-btrfs-error/
else
echo "$rm_output"
exit $rm_exit_code
fi
fi
exit $run_exit_code exit $run_exit_code