From c64cf3a93c168ff77a867b2dcb243af511705dcb Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Sat, 16 Jan 2021 11:04:28 +0100 Subject: [PATCH] Login in dockerhub when possible to avoid pull limits With current pull limits @ dockerhub, it's possible to get failed jobs just running 2-3 builds (each one having a good number of jobs). With this patch, if both DOCKER_USER and DOCKER_TOKEN are defined as environmental variables, they will be used to perform a login to dockerhub, getting rid of pull limits. --- tests/setup.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/setup.sh b/tests/setup.sh index 5715f551480..f6711428214 100755 --- a/tests/setup.sh +++ b/tests/setup.sh @@ -2,6 +2,14 @@ set -e basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )" +# Log in dockerhub if possible (to avoid pull limits for unauthenticated uses). +if [ -n "$DOCKER_USER" ] && [ -n "$DOCKER_TOKEN" ]; then + echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USER" --password-stdin + echo "Using authenticated connection (no pull limits)" +else + echo "Using unauthenticated docker (pull limits may apply). Setup DOCKER_USER and DOCKER_TOKEN if needed." +fi + if [ "$SUITE" = "phpunit" ]; then initcmd="bin/moodle-docker-compose exec -T webserver php admin/tool/phpunit/cli/init.php"