dockcross: Ensure deletion error are ignored

This commit follows up on 2e71db2 (dockcross: Ignore deletion error
when running in unprivileged LXC container) by hiding the message
only when (a) the command output matches the expected error message
and (b) is executed on CircleCI.

Doing so will avoid adding "noise" to log of service like CircleCI
that are effectively running docker in unprivileged LXC container.

See #50
This commit is contained in:
Jean-Christophe Fillion-Robin 2016-11-28 19:50:42 -05:00
parent 0926d89d99
commit c0fe1e2313
No known key found for this signature in database
GPG Key ID: 15C1A2812F958BD3

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