From eb22d22093747607b68108e531bcda932d272cc2 Mon Sep 17 00:00:00 2001 From: yminer Date: Thu, 2 Jan 2025 08:30:49 +0000 Subject: [PATCH] Set proxy registry to bypass 429 issue Signed-off-by: yminer --- test/e2e/Jenkinsfile | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/test/e2e/Jenkinsfile b/test/e2e/Jenkinsfile index 2b34f9320..6a12d3a82 100644 --- a/test/e2e/Jenkinsfile +++ b/test/e2e/Jenkinsfile @@ -22,8 +22,21 @@ class HarborChartFreshInstallPipelineExecutor extends FreshInstallPipelineExecut script.file(credentialsId: "kubeconfig", variable: "KUBE_CONFIG_FILE_PATH"), script.usernamePassword(credentialsId: "79e9fd98-cdf5-4f55-81fa-ecba01365534", usernameVariable: "DOCKER_HUB_USERNAME", passwordVariable: "DOCKER_HUB_PASSWORD")]) { script.sh """ - # login Docker Hub to avoid the pull limit - docker login -u \${DOCKER_HUB_USERNAME} -p \${DOCKER_HUB_PASSWORD} + # Set proxy registry or docker credential to bypass Docker Hub rate limit + echo "PROXY_REGISTRY is \${PROXY_REGISTRY}" + if [ "\${PROXY_REGISTRY}" != "" ]; then + # set deafult registry to a proxy registry + echo '{ + "registry-mirrors": ["'"\${PROXY_REGISTRY}"'"] + }' | sudo tee /etc/docker/daemon.json > /dev/null + + # Restart Docker to apply the changes + sudo systemctl reset-failed docker.service + sudo systemctl restart docker + else + docker login -u \${DOCKER_HUB_USERNAME} -p \${DOCKER_HUB_PASSWORD} + fi + # build the image docker build -t deployer:dev -f test/e2e/Dockerfile test/e2e # clean up the namespace