Update harbor build naming convention (#4461)

This commit is contained in:
Yan 2018-03-23 02:56:29 -07:00 committed by GitHub
parent 3d34b16665
commit 2095fb0c0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 10 deletions

View File

@ -89,6 +89,8 @@ MIGRATORFLAG=false
VERSIONTAG=dev
# for harbor package name
PKGVERSIONTAG=dev
# for harbor about dialog
UIVERSIONTAG=dev
VERSIONFILEPATH=$(CURDIR)
VERSIONFILENAME=UIVERSION
@ -239,7 +241,7 @@ ifeq ($(MIGRATORFLAG), true)
endif
version:
@printf $(VERSIONTAG) > $(VERSIONFILEPATH)/$(VERSIONFILENAME);
@printf $(UIVERSIONTAG) > $(VERSIONFILEPATH)/$(VERSIONFILENAME);
check_environment:
@$(MAKEPATH)/$(CHECKENVCMD)

View File

@ -49,10 +49,10 @@ harbor_builds_bucket="harbor-builds"
harbor_releases_bucket="harbor-releases"
harbor_ci_pipeline_store_bucket="harbor-ci-pipeline-store/latest"
harbor_target_bucket=""
if [[ $DRONE_REPO_BRANCH == "master" ]]; then
if [[ $DRONE_BRANCH == "master" ]]; then
harbor_target_bucket=$harbor_builds_bucket
else
harbor_target_bucket=$harbor_releases_bucket/$DRONE_REPO_BRANCH
harbor_target_bucket=$harbor_releases_bucket/$DRONE_BRANCH
fi
# GC credentials
@ -79,15 +79,17 @@ target_release_version=$(cat ./VERSION)
# the harbor ui version will be shown in the about dialog.
Harbor_UI_Version=$target_release_version-$git_commit
# the harbor package version is for both online and offline installer.
Harbor_Package_Version=$target_release_version-$DRONE_BUILD_NUMBER
# harbor-offline-installer-v1.5.2-build.8.tgz
Harbor_Package_Version=$target_release_version-'build.'$DRONE_BUILD_NUMBER
# the harbor assets version is for tag of harbor images:
# 1, On master branch, it's same as package version.
# 2, On release branch(others), it would set to the target realese version so that we can rename the latest passed CI build to publish.
if [[ $DRONE_REPO_BRANCH == "master" ]]; then
Harbor_Assets_Version=$target_release_version-$DRONE_BUILD_NUMBER
if [[ $DRONE_BRANCH == "master" ]]; then
Harbor_Assets_Version=$Harbor_Package_Version
else
Harbor_Assets_Version=$target_release_version
fi
export Harbor_UI_Version=$Harbor_UI_Version
export Harbor_Assets_Version=$Harbor_Assets_Version
# the env is for online and offline package.
export Harbor_Package_Version=$Harbor_Package_Version
@ -115,7 +117,7 @@ function package_offline_installer {
## --------------------------------------------- Run Test Case ---------------------------------------------
echo "--------------------------------------------------"
echo "Running CI for $DRONE_BUILD_EVENT on $DRONE_REPO_BRANCH"
echo "Running CI for $DRONE_BUILD_EVENT on $DRONE_BRANCH"
echo "--------------------------------------------------"
##
@ -123,7 +125,7 @@ echo "--------------------------------------------------"
#
# Put code here is because that it needs clean code to build installer.
##
if [[ $DRONE_REPO_BRANCH == "master" || $DRONE_REPO_BRANCH == *"refs/tags"* || $DRONE_REPO_BRANCH == "release-"* ]]; then
if [[ $DRONE_BRANCH == "master" || $DRONE_BRANCH == *"refs/tags"* || $DRONE_BRANCH == "release-"* ]]; then
if [[ $DRONE_BUILD_EVENT == "push" ]]; then
package_offline_installer
upload_latest_build=true

View File

@ -57,7 +57,7 @@ Package Harbor Offline
[Arguments] ${golang_image}=golang:${GOLANG_VERSION} ${clarity_image}=vmware/harbor-clarity-ui-builder:${CLAIR_BUILDER} ${with_notary}=true ${with_clair}=true ${with_migrator}=true
Log To Console \nStart Docker Daemon
Start Docker Daemon Locally
${rc} ${output}= Run And Return Rc And Output make package_offline VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} GOBUILDIMAGE=${golang_image} COMPILETAG=compile_golangimage CLARITYIMAGE=${clarity_image} NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} MIGRATORFLAG=${with_migrator} HTTPPROXY=
${rc} ${output}= Run And Return Rc And Output make package_offline VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} UIVERSIONTAG=%{Harbor_UI_Version} GOBUILDIMAGE=${golang_image} COMPILETAG=compile_golangimage CLARITYIMAGE=${clarity_image} NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} MIGRATORFLAG=${with_migrator} HTTPPROXY=
Log ${rc}
Log ${output}
Should Be Equal As Integers ${rc} 0
@ -66,7 +66,7 @@ Package Harbor Online
[Arguments] ${golang_image}=golang:${GOLANG_VERSION} ${clarity_image}=vmware/harbor-clarity-ui-builder:${CLAIR_BUILDER} ${with_notary}=true ${with_clair}=true ${with_migrator}=true
Log To Console \nStart Docker Daemon
Start Docker Daemon Locally
${rc} ${output}= Run And Return Rc And Output make package_online VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} GOBUILDIMAGE=${golang_image} COMPILETAG=compile_golangimage CLARITYIMAGE=${clarity_image} NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} MIGRATORFLAG=${with_migrator} HTTPPROXY=
${rc} ${output}= Run And Return Rc And Output make package_online VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} UIVERSIONTAG=%{Harbor_UI_Version} GOBUILDIMAGE=${golang_image} COMPILETAG=compile_golangimage CLARITYIMAGE=${clarity_image} NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} MIGRATORFLAG=${with_migrator} HTTPPROXY=
Log ${rc}
Log ${output}
Should Be Equal As Integers ${rc} 0