From 74e4f757166d30a19dd296dfa601cdd0f30d05b0 Mon Sep 17 00:00:00 2001 From: Dmytro Nochevnov Date: Tue, 17 Nov 2020 18:55:08 +0200 Subject: [PATCH] Fix docker pull rate limit error in Happy path tests (#18384) * Fix logging into dockerhub in Happy path tests * Set ImagePullPolicy: IfNotPresent Signed-off-by: Dmytro Nochevnov --- tests/.infra/crw-ci/pr-check/k8s/Jenkinsfile | 54 +++++++++++++++++--- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/tests/.infra/crw-ci/pr-check/k8s/Jenkinsfile b/tests/.infra/crw-ci/pr-check/k8s/Jenkinsfile index 557fc34ebd..74a57860e8 100644 --- a/tests/.infra/crw-ci/pr-check/k8s/Jenkinsfile +++ b/tests/.infra/crw-ci/pr-check/k8s/Jenkinsfile @@ -83,6 +83,21 @@ pipeline { } else { mutableCheImageTag = cheImageTag } + + withCredentials([string(credentialsId: 'ed71c034-60bc-4fb1-bfdf-9570209076b5', variable: 'maxura_docker_password')]) { + sh """ + docker login -u maxura -p ${maxura_docker_password} + + TOKEN=\$(curl --user 'maxura:${maxura_docker_password}' "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token) + curl --head -H "Authorization: Bearer \$TOKEN" https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest + """ + } + + echo "Print anonymous dockerhub limits" + sh """ + TOKEN=\$(curl "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token) + curl --head -H "Authorization: Bearer \$TOKEN" https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest + """ } } } @@ -190,12 +205,7 @@ pipeline { steps { script { retry(2) { - withCredentials([string(credentialsId: 'ed71c034-60bc-4fb1-bfdf-9570209076b5', variable: 'maxura_docker_password')]) { - sh """ - docker login -u maxura -p ${maxura_docker_password} - """ - } - + echo "Pull test images" sh """ docker pull quay.io/eclipse/che-e2e:$cheE2eImageTag docker pull quay.io/eclipse/happy-path:nightly @@ -226,6 +236,21 @@ pipeline { stage("Start Che") { steps { script { + echo "Pre-pull Eclipse Che and test images from dockerhub" + withCredentials([string(credentialsId: 'ed71c034-60bc-4fb1-bfdf-9570209076b5', variable: 'maxura_docker_password')]) { + sh """ + eval \$(minikube docker-env) + docker login -u maxura -p ${maxura_docker_password} + + docker pull mariolet/petclinic:d2831f9b + docker pull centos/postgresql-96-centos7:9.6 + docker pull centos/mysql-57-centos7 + docker pull ${cheImageRepo}:${mutableCheImageTag} + docker pull docker.io/traefik:v2.2.8 + """ + } + + echo "Create custom-resource patch file" if (cheSingleHost.toBoolean() == true) { sh """cat > $CUSTOM_RESOURCE_PATCH_FILE < $LOGS_AND_CONFIGS/kubectl/events.txt || true