From 4968b6619b6fbd757cd17a0cf40b05eccb99f0a4 Mon Sep 17 00:00:00 2001 From: danfengliu Date: Mon, 10 Aug 2020 13:46:43 +0000 Subject: [PATCH] Recovery drone build script Signed-off-by: danfengliu --- .drone.yml | 2 +- tests/integration.sh | 2 +- .../package-offline-installer.robot | 74 +++++++++++++------ .../package-online-installer.robot | 72 ++++++++++++------ 4 files changed, 105 insertions(+), 45 deletions(-) diff --git a/.drone.yml b/.drone.yml index 2267a294f..b98b00bda 100644 --- a/.drone.yml +++ b/.drone.yml @@ -27,7 +27,7 @@ pipeline: status: success test-and-issue-build: - image: goharbor/harbor-e2e-engine:2.3 + image: goharbor/harbor-e2e-engine:1.43 pull: true privileged: true environment: diff --git a/tests/integration.sh b/tests/integration.sh index dd2c8622e..0e7126000 100755 --- a/tests/integration.sh +++ b/tests/integration.sh @@ -115,7 +115,7 @@ function uploader { function package_installer { echo "Package Harbor offline installer." - robot --removekeywords TAG:secret --include Bundle tests/robot-cases/Group0-Distro-Harbor + pybot --removekeywords TAG:secret --include Bundle tests/robot-cases/Group0-Distro-Harbor harbor_offline_build_bundle=$(basename harbor-offline-installer-*.tgz) harbor_online_build_bundle=$(basename harbor-online-installer-*.tgz) upload_build=true diff --git a/tests/robot-cases/Group0-Distro-Harbor/package-offline-installer.robot b/tests/robot-cases/Group0-Distro-Harbor/package-offline-installer.robot index 032fc2b8f..b2ea064d4 100644 --- a/tests/robot-cases/Group0-Distro-Harbor/package-offline-installer.robot +++ b/tests/robot-cases/Group0-Distro-Harbor/package-offline-installer.robot @@ -1,22 +1,52 @@ -// Copyright Project Harbor Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -*** Settings *** -Documentation Harbor BATs -Resource ../../resources/Util.robot -Default Tags Bundle - -*** Test Cases *** -Distro Harbor Offline - Package Harbor Offline +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +*** Settings *** +Documentation Harbor BATs +Library Selenium2Library +Library OperatingSystem +Library Process +Default Tags Bundle + +*** Keywords *** +Start Docker Daemon Locally + ${pid}= Run pidof dockerd + #${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/docker_config.sh + #Log ${output} + #Should Be Equal As Integers ${rc} 0 + Return From Keyword If '${pid}' != '${EMPTY}' + OperatingSystem.File Should Exist /usr/local/bin/dockerd-entrypoint.sh + ${handle}= Start Process /usr/local/bin/dockerd-entrypoint.sh dockerd>./daemon-local.log 2>&1 shell=True + Process Should Be Running ${handle} + :FOR ${IDX} IN RANGE 5 + \ ${pid}= Run pidof dockerd + \ Exit For Loop If '${pid}' != '${EMPTY}' + \ Sleep 2s + Sleep 2s + [Return] ${handle} + +Package Harbor Offline + [Arguments] ${with_notary}=true ${with_clair}=true ${with_chartmuseum}=true ${with_trivy}=true + Log To Console \nStart Docker Daemon + Start Docker Daemon Locally + Log To Console \nMake Offline Package + Log To Console \n\nmake package_offline GOBUILDTAGS="include_oss include_gcs" BASEIMAGETAG=%{Harbor_Build_Base_Tag} NPM_REGISTRY=%{NPM_REGISTRY} VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} CHARTFLAG=${with_chartmuseum} TRIVYFLAG=${with_trivy} HTTPPROXY= + ${rc} ${output}= Run And Return Rc And Output make package_offline GOBUILDTAGS="include_oss include_gcs" BASEIMAGETAG=%{Harbor_Build_Base_Tag} NPM_REGISTRY=%{NPM_REGISTRY} VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} CHARTFLAG=${with_chartmuseum} TRIVYFLAG=${with_trivy} HTTPPROXY= + Log To Console ${rc} + Log To Console ${output} + Should Be Equal As Integers ${rc} 0 + +*** Test Cases *** +Distro Harbor Offline + Package Harbor Offline diff --git a/tests/robot-cases/Group0-Distro-Harbor/package-online-installer.robot b/tests/robot-cases/Group0-Distro-Harbor/package-online-installer.robot index 1094ebb86..fd9902146 100644 --- a/tests/robot-cases/Group0-Distro-Harbor/package-online-installer.robot +++ b/tests/robot-cases/Group0-Distro-Harbor/package-online-installer.robot @@ -1,22 +1,52 @@ -// Copyright Project Harbor Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -*** Settings *** -Documentation Harbor BATs -Resource ../../resources/Util.robot -Default Tags Bundle - -*** Test Cases *** -Distro Harbor Online +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +*** Settings *** +Documentation Harbor BATs +Library Selenium2Library +Library OperatingSystem +Library Process +Default Tags Bundle + +*** Keywords *** +Start Docker Daemon Locally + ${pid}= Run pidof dockerd + #${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/docker_config.sh + #Log ${output} + #Should Be Equal As Integers ${rc} 0 + Return From Keyword If '${pid}' != '${EMPTY}' + OperatingSystem.File Should Exist /usr/local/bin/dockerd-entrypoint.sh + ${handle}= Start Process /usr/local/bin/dockerd-entrypoint.sh dockerd>./daemon-local.log 2>&1 shell=True + Process Should Be Running ${handle} + :FOR ${IDX} IN RANGE 5 + \ ${pid}= Run pidof dockerd + \ Exit For Loop If '${pid}' != '${EMPTY}' + \ Sleep 2s + Sleep 2s + [Return] ${handle} + +Package Harbor Online + [Arguments] ${with_notary}=true ${with_clair}=true ${with_chartmuseum}=true ${with_trivy}=true + Log To Console \nStart Docker Daemon + Start Docker Daemon Locally + Log To Console \nMake Online Package + Log To Console \nmake package_online GOBUILDTAGS="include_oss include_gcs" VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} CHARTFLAG=${with_chartmuseum} TRIVYFLAG=${with_trivy} HTTPPROXY= + ${rc} ${output}= Run And Return Rc And Output make package_online GOBUILDTAGS="include_oss include_gcs" VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} CHARTFLAG=${with_chartmuseum} TRIVYFLAG=${with_trivy} HTTPPROXY= + Log ${rc} + Log ${output} + Should Be Equal As Integers ${rc} 0 + +*** Test Cases *** +Distro Harbor Online Package Harbor Online \ No newline at end of file