2016-02-18 14:58:56 -05:00
|
|
|
set +x
|
|
|
|
set +e
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo ""
|
|
|
|
echo "---"
|
|
|
|
echo "Now starting POST-BUILD steps"
|
|
|
|
echo "---"
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
echo INFO: Pointing to $DOCKER_HOST
|
|
|
|
|
|
|
|
if [ ! $(docker ps -aq | wc -l) -eq 0 ]; then
|
|
|
|
echo INFO: Removing containers...
|
|
|
|
! docker rm -vf $(docker ps -aq)
|
|
|
|
fi
|
|
|
|
|
2016-06-08 14:08:23 -04:00
|
|
|
# Remove all images which don't have docker or debian in the name
|
|
|
|
if [ ! $(docker images | sed -n '1!p' | grep -v 'docker' | grep -v 'debian' | awk '{ print $3 }' | wc -l) -eq 0 ]; then
|
2016-02-18 14:58:56 -05:00
|
|
|
echo INFO: Removing images...
|
2016-06-08 14:08:23 -04:00
|
|
|
! docker rmi -f $(docker images | sed -n '1!p' | grep -v 'docker' | grep -v 'debian' | awk '{ print $3 }')
|
2016-02-18 14:58:56 -05:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Kill off any instances of git, go and docker, just in case
|
|
|
|
! taskkill -F -IM git.exe -T >& /dev/null
|
|
|
|
! taskkill -F -IM go.exe -T >& /dev/null
|
|
|
|
! taskkill -F -IM docker.exe -T >& /dev/null
|
|
|
|
|
|
|
|
# Remove everything
|
|
|
|
! cd /c/jenkins/gopath/src/github.com/docker/docker
|
|
|
|
! rm -rfd * >& /dev/null
|
|
|
|
! rm -rfd .* >& /dev/null
|
|
|
|
|
|
|
|
echo INFO: Cleanup complete
|
|
|
|
exit 0
|