Skip to content

Commit 535a512

Browse files
authored
[CI] Sign in to Docker Hub for Buildkite pipelines (#125208) (#125313)
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 6498979 commit 535a512

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

.buildkite/hooks/pre-command

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ if [[ "${USE_PROD_DOCKER_CREDENTIALS:-}" == "true" ]]; then
8888
export DOCKER_REGISTRY_PASSWORD
8989
fi
9090

91+
# Authenticate to the Docker Hub public read-only registry
92+
if which docker > /dev/null 2>&1; then
93+
DOCKERHUB_REGISTRY_USERNAME="$(vault read -field=username secret/ci/elastic-elasticsearch/docker_hub_public_ro_credentials)"
94+
DOCKERHUB_REGISTRY_PASSWORD="$(vault read -field=password secret/ci/elastic-elasticsearch/docker_hub_public_ro_credentials)"
95+
96+
echo "$DOCKERHUB_REGISTRY_PASSWORD" | docker login --username "$DOCKERHUB_REGISTRY_USERNAME" --password-stdin docker.io
97+
fi
98+
9199
if [[ "$BUILDKITE_AGENT_META_DATA_PROVIDER" != *"k8s"* ]]; then
92100
# Run in the background, while the job continues
93101
nohup .buildkite/scripts/setup-monitoring.sh </dev/null >/dev/null 2>&1 &

0 commit comments

Comments
 (0)