Skip to content

Commit c64cf3a

Browse files
committed
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.
1 parent 94f0764 commit c64cf3a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/setup.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
set -e
33
basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
44

5+
# Log in dockerhub if possible (to avoid pull limits for unauthenticated uses).
6+
if [ -n "$DOCKER_USER" ] && [ -n "$DOCKER_TOKEN" ]; then
7+
echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USER" --password-stdin
8+
echo "Using authenticated connection (no pull limits)"
9+
else
10+
echo "Using unauthenticated docker (pull limits may apply). Setup DOCKER_USER and DOCKER_TOKEN if needed."
11+
fi
12+
513
if [ "$SUITE" = "phpunit" ];
614
then
715
initcmd="bin/moodle-docker-compose exec -T webserver php admin/tool/phpunit/cli/init.php"

0 commit comments

Comments
 (0)