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 <dnochevn@redhat.com>
7.22.x
Dmytro Nochevnov 2020-11-17 18:55:08 +02:00 committed by GitHub
parent 14805699c8
commit 74e4f75716
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 48 additions and 6 deletions

View File

@ -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 <<EOL
@ -236,6 +261,8 @@ spec:
serverExposureStrategy: 'single-host'
customCheProperties:
CHE_LIMITS_USER_WORKSPACES_RUN_COUNT: '-1'
CHE_WORKSPACE_SIDECAR_IMAGE__PULL__POLICY: IfNotPresent
CHE_WORKSPACE_PLUGIN__BROKER_PULL__POLICY: IfNotPresent
k8s:
singleHostExposureType: 'gateway'
auth:
@ -250,6 +277,8 @@ spec:
cheImageTag: '${mutableCheImageTag}'
customCheProperties:
CHE_LIMITS_USER_WORKSPACES_RUN_COUNT: '-1'
CHE_WORKSPACE_SIDECAR_IMAGE__PULL__POLICY: IfNotPresent
CHE_WORKSPACE_PLUGIN__BROKER_PULL__POLICY: IfNotPresent
auth:
updateAdminPassword: false
EOL"""
@ -348,6 +377,19 @@ EOL"""
post {
cleanup {
withCredentials([string(credentialsId: 'ed71c034-60bc-4fb1-bfdf-9570209076b5', variable: 'maxura_docker_password')]) {
sh """
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
"""
sh """
mkdir -p $LOGS_AND_CONFIGS/kubectl
kubectl --namespace=eclipse-che get events > $LOGS_AND_CONFIGS/kubectl/events.txt || true