Skip to content

Commit 891240c

Browse files
committed
[CI] Sign in to Docker Hub for Buildkite pipelines
Unauthenticated pulls from Docker Hub are heavily rate-limited. After this change, we will use authenticated Docker Hub user so that we can pull public images for tests without being rate-limited.
1 parent 7070f3f commit 891240c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

.buildkite/hooks/pre-command

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ if [[ "${USE_PROD_DOCKER_CREDENTIALS:-}" == "true" ]]; then
9494
fi
9595
fi
9696

97+
if which docker > /dev/null 2>&1; then
98+
DOCKERHUB_REGISTRY_USERNAME="$(vault read -field=username secret/ci/elastic-elasticsearch/docker_hub_public_ro_credentials)"
99+
DOCKERHUB_REGISTRY_PASSWORD="$(vault read -field=password secret/ci/elastic-elasticsearch/docker_hub_public_ro_credentials)"
100+
101+
docker login --username "$DOCKERHUB_REGISTRY_USERNAME" --password "$DOCKERHUB_REGISTRY_PASSWORD" docker.io
102+
fi
103+
97104
if [[ "$BUILDKITE_AGENT_META_DATA_PROVIDER" != *"k8s"* ]]; then
98105
# Run in the background, while the job continues
99106
nohup .buildkite/scripts/setup-monitoring.sh </dev/null >/dev/null 2>&1 &

0 commit comments

Comments
 (0)