Merge pull request #10470 from danfengliu/switch-registry-from-dockerhub-to-cpe-1

Switch registry from docker-hub ot internal harbor registry
This commit is contained in:
danfengliu 2020-01-17 11:14:00 +08:00 committed by GitHub
commit f55ee0a54f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 20 deletions

View File

@ -40,10 +40,10 @@ Push image
${image_with_sha256}= Set Variable If '${sha256}'=='${null}' ${image} ${image}@sha256:${sha256} ${image_with_sha256}= Set Variable If '${sha256}'=='${null}' ${image} ${image}@sha256:${sha256}
${image_with_tag}= Set Variable If '${sha256}'=='${null}' ${image} ${image}:${sha256} ${image_with_tag}= Set Variable If '${sha256}'=='${null}' ${image} ${image}:${sha256}
Log To Console \nRunning docker push ${image}... Log To Console \nRunning docker push ${image}...
Docker Pull ${image_with_sha256} Docker Pull ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image_with_sha256}
Run Keyword If ${is_robot}==${false} Wait Unitl Command Success docker login -u ${user} -p ${pwd} ${ip} Run Keyword If ${is_robot}==${false} Wait Unitl Command Success docker login -u ${user} -p ${pwd} ${ip}
... ELSE Wait Unitl Command Success docker login -u robot\\\$${user} -p ${pwd} ${ip} ... ELSE Wait Unitl Command Success docker login -u robot\\\$${user} -p ${pwd} ${ip}
Wait Unitl Command Success docker tag ${image_with_sha256} ${ip}/${project}/${image_with_tag} Wait Unitl Command Success docker tag ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image_with_sha256} ${ip}/${project}/${image_with_tag}
Wait Unitl Command Success docker push ${ip}/${project}/${image_with_tag} Wait Unitl Command Success docker push ${ip}/${project}/${image_with_tag}
Wait Unitl Command Success docker logout ${ip} Wait Unitl Command Success docker logout ${ip}
Sleep 1 Sleep 1
@ -52,9 +52,9 @@ Push Image With Tag
#tag1 is tag of image on docker hub,default latest,use a version existing if you do not want to use latest #tag1 is tag of image on docker hub,default latest,use a version existing if you do not want to use latest
[Arguments] ${ip} ${user} ${pwd} ${project} ${image} ${tag} ${tag1}=latest [Arguments] ${ip} ${user} ${pwd} ${project} ${image} ${tag} ${tag1}=latest
Log To Console \nRunning docker push ${image}... Log To Console \nRunning docker push ${image}...
Docker Pull ${image}:${tag1} Docker Pull ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image}:${tag1}
Wait Unitl Command Success docker login -u ${user} -p ${pwd} ${ip} Wait Unitl Command Success docker login -u ${user} -p ${pwd} ${ip}
Wait Unitl Command Success docker tag ${image}:${tag1} ${ip}/${project}/${image}:${tag} Wait Unitl Command Success docker tag ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image}:${tag1} ${ip}/${project}/${image}:${tag}
Wait Unitl Command Success docker push ${ip}/${project}/${image}:${tag} Wait Unitl Command Success docker push ${ip}/${project}/${image}:${tag}
Wait Unitl Command Success docker logout ${ip} Wait Unitl Command Success docker logout ${ip}
@ -77,9 +77,9 @@ Cannot Pull Unsigned Image
Cannot Push image Cannot Push image
[Arguments] ${ip} ${user} ${pwd} ${project} ${image} ${err_msg}=${null} [Arguments] ${ip} ${user} ${pwd} ${project} ${image} ${err_msg}=${null}
Log To Console \nRunning docker push ${image}... Log To Console \nRunning docker push ${image}...
Docker Pull ${image} Docker Pull ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image}
Wait Unitl Command Success docker login -u ${user} -p ${pwd} ${ip} Wait Unitl Command Success docker login -u ${user} -p ${pwd} ${ip}
Wait Unitl Command Success docker tag ${image} ${ip}/${project}/${image} Wait Unitl Command Success docker tag ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image} ${ip}/${project}/${image}
${output}= Command Should be Failed docker push ${ip}/${project}/${image} ${output}= Command Should be Failed docker push ${ip}/${project}/${image}
Run Keyword If '${err_msg}' != '${null}' Should Contain ${output} ${err_msg} Run Keyword If '${err_msg}' != '${null}' Should Contain ${output} ${err_msg}
Wait Unitl Command Success docker logout ${ip} Wait Unitl Command Success docker logout ${ip}

View File

@ -101,10 +101,8 @@ Body Of Admin Push Signed Image
[Arguments] ${image}=tomcat ${with_remove}=${false} [Arguments] ${image}=tomcat ${with_remove}=${false}
Enable Notary Client Enable Notary Client
Docker Pull hello-world:latest Docker Pull ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image}
${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/notary-push-image.sh ${ip} library ${image} latest ${notaryServerEndpoint} ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image}:latest
Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library hello-world:latest
${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/notary-push-image.sh ${ip} library ${image} latest ${notaryServerEndpoint}
Log ${output} Log ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0

View File

@ -1,10 +1,11 @@
#!/bin/bash #!/bin/bash
docker pull $3:$4 #docker pull $3:$4
IP=$1 IP=$1
PASSHRASE='Harbor12345' PASSHRASE='Harbor12345'
notaryServerEndpoint=$5 notaryServerEndpoint=$5
tag_src=$6
echo $IP echo $IP
mkdir -p /etc/docker/certs.d/$IP/ mkdir -p /etc/docker/certs.d/$IP/
@ -28,5 +29,5 @@ export DOCKER_CONTENT_TRUST_OFFLINE_PASSPHRASE=$PASSHRASE
export DOCKER_CONTENT_TRUST_TAGGING_PASSPHRASE=$PASSHRASE export DOCKER_CONTENT_TRUST_TAGGING_PASSPHRASE=$PASSHRASE
docker login -u admin -p Harbor12345 $IP docker login -u admin -p Harbor12345 $IP
docker tag $3:$4 $IP/$2/$3:$4 docker tag $tag_src $IP/$2/$3:$4
docker push $IP/$2/$3:$4 docker push $IP/$2/$3:$4

View File

@ -127,7 +127,10 @@ Test Case - Project Level Image Serverity Policy
Init Chrome Driver Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
${d}= get current date result_format=%m%s ${d}= get current date result_format=%m%s
${sha256}= Set Variable 9755880356c4ced4ff7745bafe620f0b63dd17747caedba72504ef7bac882089 #For docker-hub registry
#${sha256}= Set Variable 9755880356c4ced4ff7745bafe620f0b63dd17747caedba72504ef7bac882089
#For internal CPE harbor registry
${sha256}= Set Variable 0e67625224c1da47cb3270e7a861a83e332f708d3d89dde0cbed432c94824d9a
${image}= Set Variable redis ${image}= Set Variable redis
Create An New Project project${d} Create An New Project project${d}
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image} sha256=${sha256} Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image} sha256=${sha256}
@ -146,7 +149,10 @@ Test Case - Verfiy System Level CVE Whitelist
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
${image}= Set Variable mariadb ${image}= Set Variable mariadb
${sha256}= Set Variable c396eb803be99041e69eed84b0eb880d5474a6b2c1fd5a84268ce0420088d20d #For docker-hub registry
#${sha256}= Set Variable c396eb803be99041e69eed84b0eb880d5474a6b2c1fd5a84268ce0420088d20d
#For internal CPE harbor registry
${sha256}= Set Variable b5e273ed46d2b5a1c96bf8f3ae37aa5e90c6c481e7f7ae66744610d7df79cbd1
${signin_user}= Set Variable user025 ${signin_user}= Set Variable user025
${signin_pwd}= Set Variable Test1@34 ${signin_pwd}= Set Variable Test1@34
Sign In Harbor ${HARBOR_URL} ${signin_user} ${signin_pwd} Sign In Harbor ${HARBOR_URL} ${signin_user} ${signin_pwd}
@ -175,7 +181,10 @@ Test Case - Verfiy Project Level CVE Whitelist
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
${image}= Set Variable mariadb ${image}= Set Variable mariadb
${sha256}= Set Variable c396eb803be99041e69eed84b0eb880d5474a6b2c1fd5a84268ce0420088d20d #For docker-hub registry
#${sha256}= Set Variable c396eb803be99041e69eed84b0eb880d5474a6b2c1fd5a84268ce0420088d20d
#For internal CPE harbor registry
${sha256}= Set Variable b5e273ed46d2b5a1c96bf8f3ae37aa5e90c6c481e7f7ae66744610d7df79cbd1
${signin_user}= Set Variable user025 ${signin_user}= Set Variable user025
${signin_pwd}= Set Variable Test1@34 ${signin_pwd}= Set Variable Test1@34
Sign In Harbor ${HARBOR_URL} ${signin_user} ${signin_pwd} Sign In Harbor ${HARBOR_URL} ${signin_user} ${signin_pwd}
@ -202,7 +211,10 @@ Test Case - Verfiy Project Level CVE Whitelist By Quick Way of Add System
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
${image}= Set Variable mariadb ${image}= Set Variable mariadb
${sha256}= Set Variable c396eb803be99041e69eed84b0eb880d5474a6b2c1fd5a84268ce0420088d20d #For docker-hub registry
#${sha256}= Set Variable c396eb803be99041e69eed84b0eb880d5474a6b2c1fd5a84268ce0420088d20d
#For internal CPE harbor registry
${sha256}= Set Variable b5e273ed46d2b5a1c96bf8f3ae37aa5e90c6c481e7f7ae66744610d7df79cbd1
${signin_user}= Set Variable user025 ${signin_user}= Set Variable user025
${signin_pwd}= Set Variable Test1@34 ${signin_pwd}= Set Variable Test1@34
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}

View File

@ -454,7 +454,11 @@ Test Case - Project Image And Chart Artifact Count Quotas Dispaly And Control
${storage_quota}= Set Variable 500 ${storage_quota}= Set Variable 500
${storage_quota_unit}= Set Variable MB ${storage_quota_unit}= Set Variable MB
${image}= Set Variable redis ${image}= Set Variable redis
${sha256}= Set Variable 9755880356c4ced4ff7745bafe620f0b63dd17747caedba72504ef7bac882089 #For docker-hub registry
#${sha256}= Set Variable 9755880356c4ced4ff7745bafe620f0b63dd17747caedba72504ef7bac882089
#For internal CPE harbor registry
${sha256}= Set Variable 0e67625224c1da47cb3270e7a861a83e332f708d3d89dde0cbed432c94824d9a
${image_size}= Set Variable 34.14MB ${image_size}= Set Variable 34.14MB
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project project${d} count_quota=${count_quota} storage_quota=${storage_quota} storage_quota_unit=${storage_quota_unit} Create An New Project project${d} count_quota=${count_quota} storage_quota=${storage_quota} storage_quota_unit=${storage_quota_unit}
@ -482,8 +486,8 @@ Test Case - Project Storage Quotas Dispaly And Control
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
${storage_quota}= Set Variable 330 ${storage_quota}= Set Variable 330
${storage_quota_unit}= Set Variable MB ${storage_quota_unit}= Set Variable MB
${image_a}= Set Variable ${LOCAL_REGISTRY}/harbor-ci/redis ${image_a}= Set Variable redis
${image_b}= Set Variable ${LOCAL_REGISTRY}/harbor-ci/logstash ${image_b}= Set Variable logstash
${image_a_size}= Set Variable 34.15MB ${image_a_size}= Set Variable 34.15MB
${image_b_size}= Set Variable 321.03MB ${image_b_size}= Set Variable 321.03MB
${image_a_ver}= Set Variable donotremove5.0 ${image_a_ver}= Set Variable donotremove5.0

View File

@ -43,4 +43,4 @@ Test Case - Admin Push Signed Image
Body Of Admin Push Signed Image Body Of Admin Push Signed Image
Test Case - Admin Push Signed Image And Remove Signature Test Case - Admin Push Signed Image And Remove Signature
Body Of Admin Push Signed Image image=mariadb with_remove=${true} Body Of Admin Push Signed Image image=mariadb with_remove=${true}