From 17f126c5f7eee88c0b4ec205eb4027b427d44a83 Mon Sep 17 00:00:00 2001 From: wang yan Date: Tue, 19 Nov 2019 17:01:28 +0800 Subject: [PATCH] upload online installer with drone 1, upload online installer and signature 2, inject npm registry server when to build offline Signed-off-by: wang yan --- tests/integration.sh | 29 +++++++++++++++++------------ tests/resources/Harbor-Util.robot | 4 ++-- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/tests/integration.sh b/tests/integration.sh index 9041c2391..6abf1d2df 100755 --- a/tests/integration.sh +++ b/tests/integration.sh @@ -45,7 +45,8 @@ upload_bundle_success=false latest_build_file='latest.build' publish_npm=true -harbor_build_bundle="" +harbor_offline_build_bundle="" +harbor_online_build_bundle="" harbor_logs_bucket="harbor-ci-logs" harbor_builds_bucket="harbor-builds" harbor_releases_bucket="harbor-releases" @@ -103,13 +104,14 @@ function uploader { gsutil -D setacl public-read gs://$2/$1 &> /dev/null } -function package_offline_installer { +function package_installer { echo "Package Harbor offline installer." pybot --removekeywords TAG:secret --include Bundle tests/robot-cases/Group0-Distro-Harbor - harbor_build_bundle=$(basename harbor-offline-installer-*.tgz) + harbor_offline_build_bundle=$(basename harbor-offline-installer-*.tgz) + harbor_online_build_bundle=$(basename harbor-online-installer-*.tgz) upload_build=true - echo "Package name is: $harbor_build_bundle" - du -ks $harbor_build_bundle | awk '{print $1 / 1024}' | { read x; echo $x MB; } + echo "Package name is: $harbor_offline_build_bundle" + du -ks $harbor_offline_build_bundle | awk '{print $1 / 1024}' | { read x; echo $x MB; } } # publish images to Docker Hub @@ -143,10 +145,11 @@ echo "--------------------------------------------------" ## if [[ $DRONE_BRANCH == "master" || $DRONE_BRANCH == *"refs/tags"* || $DRONE_BRANCH == "release-"* ]]; then if [[ $DRONE_BUILD_EVENT == "push" ]]; then - package_offline_installer + package_installer upload_latest_build=true echo -en "$HARBOR_SIGN_KEY" | gpg --import - gpg -v -ab -u $HARBOR_SIGN_KEY_ID $harbor_build_bundle + gpg -v -ab -u $HARBOR_SIGN_KEY_ID $harbor_offline_build_bundle + gpg -v -ab -u $HARBOR_SIGN_KEY_ID $harbor_online_build_bundle fi fi @@ -164,10 +167,12 @@ fi # set -e if [ $upload_build == true ]; then - cp ${harbor_build_bundle} harbor-offline-installer-latest.tgz - cp ${harbor_build_bundle}.asc harbor-offline-installer-latest.tgz.asc - uploader ${harbor_build_bundle} $harbor_target_bucket - uploader ${harbor_build_bundle}.asc $harbor_target_bucket + cp ${harbor_offline_build_bundle} harbor-offline-installer-latest.tgz + cp ${harbor_offline_build_bundle}.asc harbor-offline-installer-latest.tgz.asc + uploader ${harbor_offline_build_bundle} $harbor_target_bucket + uploader ${harbor_offline_build_bundle}.asc $harbor_target_bucket + uploader ${harbor_online_build_bundle} $harbor_target_bucket + uploader ${harbor_online_build_bundle}.asc $harbor_target_bucket uploader harbor-offline-installer-latest.tgz $harbor_target_bucket uploader harbor-offline-installer-latest.tgz.asc $harbor_target_bucket upload_bundle_success=true @@ -190,7 +195,7 @@ fi # latest.build file holds the latest offline installer url, it must be sure that the installer has been uploaded successfull. # if [ $upload_latest_build == true ] && [ $upload_bundle_success == true ]; then - echo 'https://storage.googleapis.com/'$harbor_target_bucket/$harbor_build_bundle > $latest_build_file + echo 'https://storage.googleapis.com/'$harbor_target_bucket/$harbor_offline_build_bundle > $latest_build_file uploader $latest_build_file $harbor_target_bucket fi diff --git a/tests/resources/Harbor-Util.robot b/tests/resources/Harbor-Util.robot index d400d29fd..1f3c2a178 100644 --- a/tests/resources/Harbor-Util.robot +++ b/tests/resources/Harbor-Util.robot @@ -56,7 +56,7 @@ Package Harbor Offline Log To Console \nStart Docker Daemon Start Docker Daemon Locally Log To Console \n\nmake package_offline NPM_REGISTRY=%{NPM_REGISTRY} VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} MIGRATORFLAG=${with_migrator} CHARTFLAG=${with_chartmuseum} HTTPPROXY= - ${rc} ${output}= Run And Return Rc And Output make package_offline VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} MIGRATORFLAG=${with_migrator} CHARTFLAG=${with_chartmuseum} HTTPPROXY= + ${rc} ${output}= Run And Return Rc And Output make package_offline NPM_REGISTRY=%{NPM_REGISTRY} VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} MIGRATORFLAG=${with_migrator} CHARTFLAG=${with_chartmuseum} HTTPPROXY= Log To Console ${rc} Log To Console ${output} Should Be Equal As Integers ${rc} 0 @@ -65,7 +65,7 @@ Package Harbor Online [Arguments] ${with_notary}=true ${with_clair}=true ${with_migrator}=false ${with_chartmuseum}=true Log To Console \nStart Docker Daemon Start Docker Daemon Locally - Log To Console \nmake package_online VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} UIVERSIONTAG=%{Harbor_UI_Version} NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} MIGRATORFLAG=${with_migrator} CHARTFLAG=${with_chartmuseum} HTTPPROXY= + Log To Console \nmake package_online VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} MIGRATORFLAG=${with_migrator} CHARTFLAG=${with_chartmuseum} HTTPPROXY= ${rc} ${output}= Run And Return Rc And Output make package_online VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} MIGRATORFLAG=${with_migrator} CHARTFLAG=${with_chartmuseum} HTTPPROXY= Log ${rc} Log ${output}