mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-27 04:35:16 +01:00
Switch registry from docker-hub ot internal harbor registry
In nightly test, images for tests were pulled from docker-hub, and sometime in an rare occasion, client will fail to contact docker-hub like timeout error, so we like to pull image from an internal harbor registry with no network issue invovled. Signed-off-by: Danfeng Liu (c) <danfengl@vmware.com>
This commit is contained in:
parent
ed056f2fea
commit
410fb5242b
@ -37,9 +37,10 @@ Push image
|
||||
${image_with_sha256}= Set Variable If '${sha256}'=='${null}' ${image} ${image}@sha256:${sha256}
|
||||
${image_with_tag}= Set Variable If '${sha256}'=='${null}' ${image} ${image}:${sha256}
|
||||
Log To Console \nRunning docker push ${image}...
|
||||
Wait Unitl Command Success docker pull ${image_with_sha256}
|
||||
Wait Unitl Command Success docker login -u ${user} -p ${pwd} ${ip}
|
||||
Wait Unitl Command Success docker tag ${image_with_sha256} ${ip}/${project}/${image_with_tag}
|
||||
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}
|
||||
... ELSE Wait Unitl Command Success docker login -u robot\\\$${user} -p ${pwd} ${ip}
|
||||
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 logout ${ip}
|
||||
Sleep 1
|
||||
@ -48,9 +49,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
|
||||
[Arguments] ${ip} ${user} ${pwd} ${project} ${image} ${tag} ${tag1}=latest
|
||||
Log To Console \nRunning docker push ${image}...
|
||||
Wait Unitl Command Success 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 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 logout ${ip}
|
||||
|
||||
@ -73,9 +74,9 @@ Cannot Pull Unsigned Image
|
||||
Cannot Push image
|
||||
[Arguments] ${ip} ${user} ${pwd} ${project} ${image} ${err_msg}=${null}
|
||||
Log To Console \nRunning docker push ${image}...
|
||||
Wait Unitl Command Success 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 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}
|
||||
Run Keyword If '${err_msg}' != '${null}' Should Contain ${output} ${err_msg}
|
||||
Wait Unitl Command Success docker logout ${ip}
|
||||
|
@ -101,11 +101,8 @@ Body Of Admin Push Signed Image
|
||||
[Arguments] ${image} ${with_remove}=${false}
|
||||
Enable Notary Client
|
||||
|
||||
${rc} ${output}= Run And Return Rc And Output docker pull hello-world:latest
|
||||
Log ${output}
|
||||
|
||||
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
|
||||
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
|
||||
Log ${output}
|
||||
Should Be Equal As Integers ${rc} 0
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
docker pull $3:$4
|
||||
#docker pull $3:$4
|
||||
|
||||
IP=$1
|
||||
PASSHRASE='Harbor12345'
|
||||
|
||||
notaryServerEndpoint=$5
|
||||
tag_src=$6
|
||||
echo $IP
|
||||
|
||||
mkdir -p /etc/docker/certs.d/$IP/
|
||||
@ -25,5 +26,5 @@ export DOCKER_CONTENT_TRUST_OFFLINE_PASSPHRASE=$PASSHRASE
|
||||
export DOCKER_CONTENT_TRUST_TAGGING_PASSPHRASE=$PASSHRASE
|
||||
|
||||
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
|
||||
|
@ -127,7 +127,10 @@ Test Case - Project Level Image Serverity Policy
|
||||
Init Chrome Driver
|
||||
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
||||
${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
|
||||
Create An New Project project${d}
|
||||
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
|
||||
${d}= Get Current Date result_format=%m%s
|
||||
${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_pwd}= Set Variable Test1@34
|
||||
Sign In Harbor ${HARBOR_URL} ${signin_user} ${signin_pwd}
|
||||
@ -175,7 +181,10 @@ Test Case - Verfiy Project Level CVE Whitelist
|
||||
Init Chrome Driver
|
||||
${d}= Get Current Date result_format=%m%s
|
||||
${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_pwd}= Set Variable Test1@34
|
||||
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
|
||||
${d}= Get Current Date result_format=%m%s
|
||||
${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_pwd}= Set Variable Test1@34
|
||||
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
||||
|
@ -469,7 +469,11 @@ Test Case - Project Image And Chart Artifact Count Quotas Dispaly And Control
|
||||
${storage_quota}= Set Variable 500
|
||||
${storage_quota_unit}= Set Variable MB
|
||||
${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
|
||||
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}
|
||||
@ -508,11 +512,16 @@ Test Case - Project Storage Quotas Dispaly And Control
|
||||
Push Image With Tag ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image_b} tag=${image_b_ver} tag1=${image_b_ver}
|
||||
${storage_quota_ret}= Get Project Storage Quota Text From Project Quotas List project${d}
|
||||
Should Be Equal As Strings ${storage_quota_ret} ${image_b_size} of ${storage_quota}${storage_quota_unit}
|
||||
Cannot Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image_a}:${image_a_ver} err_msg=Quota exceeded when processing the request of adding 25.9 MiB of storage resource, which when updated to current usage of 329.3 MiB will exceed the configured upper limit of 330.0 MiB
|
||||
Cannot Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image_a}:${image_a_ver} err_msg=Quota exceeded when processing the request of adding 25.8 MiB of storage resource, which when updated to current usage of 329.3 MiB will exceed the configured upper limit of 330.0 MiB
|
||||
Go Into Project project${d}
|
||||
Delete Repo project${d}/${image_b}
|
||||
Push Image With Tag ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image_a} tag=${image_a_ver} tag1=${image_a_ver}
|
||||
${storage_quota_ret}= Get Project Storage Quota Text From Project Quotas List project${d}
|
||||
${storage_quota_ret_str_left} Fetch From Left ${storage_quota_ret} 25.
|
||||
Log ${storage_quota_ret_str_left}
|
||||
${storage_quota_ret_str_right} Fetch From Left ${storage_quota_ret} 25.
|
||||
Log ${storage_quota_ret_str_right}
|
||||
Log ${storage_quota_ret_str_left}${storage_quota_ret_str_right}
|
||||
Should Be Equal As Strings ${storage_quota_ret} ${image_a_size} of ${storage_quota}${storage_quota_unit}
|
||||
Close Browser
|
||||
|
||||
|
@ -43,4 +43,4 @@ Test Case - Admin Push Signed Image
|
||||
Body Of Admin Push Signed Image tomcat
|
||||
|
||||
Test Case - Admin Push Signed Image And Remove Signature
|
||||
Body Of Admin Push Signed Image mariadb with_remove=${true}
|
||||
Body Of Admin Push Signed Image image=mariadb with_remove=${true}
|
||||
|
Loading…
Reference in New Issue
Block a user