Skip to content

Commit c63c7f5

Browse files
authored
[CI] Sign in to Docker Hub for Buildkite pipelines (#125208) (#125314)
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 ba1f65d commit c63c7f5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

.buildkite/hooks/pre-command

+8
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ if [[ "${USE_PROD_DOCKER_CREDENTIALS:-}" == "true" ]]; then
9494
fi
9595
fi
9696

97+
# Authenticate to the Docker Hub public read-only registry
98+
if which docker > /dev/null 2>&1; then
99+
DOCKERHUB_REGISTRY_USERNAME="$(vault read -field=username secret/ci/elastic-elasticsearch/docker_hub_public_ro_credentials)"
100+
DOCKERHUB_REGISTRY_PASSWORD="$(vault read -field=password secret/ci/elastic-elasticsearch/docker_hub_public_ro_credentials)"
101+
102+
echo "$DOCKERHUB_REGISTRY_PASSWORD" | docker login --username "$DOCKERHUB_REGISTRY_USERNAME" --password-stdin docker.io
103+
fi
104+
97105
if [[ "$BUILDKITE_AGENT_META_DATA_PROVIDER" != *"k8s"* ]]; then
98106
# Run in the background, while the job continues
99107
nohup .buildkite/scripts/setup-monitoring.sh </dev/null >/dev/null 2>&1 &

0 commit comments

Comments
 (0)