Merge pull request #14844 from danfengliu/fix-notary-trust-directory-issue-in-nightly

Fix notary trust directory issue in nightly
This commit is contained in:
danfengliu 2021-05-20 21:56:27 +08:00 committed by GitHub
commit 6c14e699b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 198 additions and 1346 deletions

View File

@ -52,6 +52,7 @@ jobs:
base_image_tag=$(cat ./VERSION)
cd src/github.com/goharbor/harbor
sudo make build_base_docker -e BASEIMAGETAG=$base_image_tag -e REGISTRYUSER="${{ secrets.DOCKER_HUB_USERNAME }}" -e REGISTRYPASSWORD="${{ secrets.DOCKER_HUB_PASSWORD }}" -e PUSHBASEIMAGE=yes
continue-on-error: true
- name: Build Package
run: |
set -x

View File

@ -421,11 +421,6 @@ build_standalone_db_migrator: compile_standalone_db_migrator
make -f $(MAKEFILEPATH_PHOTON)/Makefile _build_standalone_db_migrator -e BASEIMAGETAG=$(BASEIMAGETAG) -e VERSIONTAG=$(VERSIONTAG)
build_base_docker:
if [ -n "$(REGISTRYUSER)" ] && [ -n "$(REGISTRYPASSWORD)" ] ; then \
docker login -u $(REGISTRYUSER) -p $(REGISTRYPASSWORD) ; \
else \
echo "No docker credentials provided, please make sure enough priviledges to access docker hub!" ; \
fi
@for name in $(BUILDBASETARGET); do \
echo $$name ; \
sleep 30 ; \

View File

@ -99,6 +99,21 @@ set -e
# - https://docs.docker.com/reference/commandline/cli/#logout
# ---------------------------
# Login to the registry
h2 "Login to the Docker registry"
DOCKER_LOGIN="docker login --username $USERNAME --password $PASSWORD $REGISTRY"
info "docker login --username $USERNAME --password *******"
DOCKER_LOGIN_OUTPUT=$($DOCKER_LOGIN)
if [ $? -ne 0 ]; then
warn "$DOCKER_LOGIN_OUTPUT"
error "Login to Docker registry $REGISTRY failed"
exit 1
else
success "Login to Docker registry $REGISTRY succeeded";
fi
# Push the docker image
h2 "Pushing image to Docker registry"
@ -113,6 +128,19 @@ else
success "Pushing image $IMAGE succeeded";
fi
# Logout from the registry
h2 "Logout from the docker registry"
DOCKER_LOGOUT="docker logout $REGISTRY"
DOCKER_LOGOUT_OUTPUT=$($DOCKER_LOGOUT)
if [ $? -ne 0 ]; then
warn "$DOCKER_LOGOUT_OUTPUT"
error "Logout from Docker registry $REGISTRY failed"
exit 1
else
success "Logout from Docker registry $REGISTRY succeeded"
fi
h2 "Remove local goharbor images"
DOCKER_RMI="docker rmi -f $(docker images | grep "goharbor" | awk '{print $3}')"
info "$DOCKER_RMI"
@ -124,4 +152,3 @@ if [ $? -ne 0 ];then
else
success "Clean local goharbor images succeeded";
fi

View File

@ -17,7 +17,7 @@ class User(base.Base, object):
if realname is None:
realname = base._random_name("realname")
if email is None:
email = '%s@%s.com' % (realname, "vmware")
email = '%s@%s.com' % (realname, "harbortest")
if user_password is None:
user_password = "Harbor12345678"
user_req = v2_swagger_client.UserCreationReq(username=name, email=email, password=user_password, realname=realname)

View File

@ -7,12 +7,12 @@ sys.path.insert(0, os.environ.get("SWAGGER_CLIENT_PATH", ''))
path=os.getcwd() + "/library"
sys.path.insert(0, path)
path=os.getcwd() + "/tests/apitests/python/library"
sys.path.insert(0, path)
path=os.getcwd() + "/tests/apitests/python/"
sys.path.insert(0, path)
print(sys.path)
import v2_swagger_client
import swagger_client.models

View File

@ -1,7 +1,11 @@
*** Keywords ***
Make Swagger Client
${rc} ${output}= Run And Return Rc And Output pip uninstall setuptools -y
LogAll ${output}
${rc} ${output}= Run And Return Rc And Output pip install -U pip setuptools
LogAll ${output}
${rc} ${output}= Run And Return Rc And Output make swagger_client
Log ${output}
LogAll ${output}
[Return] ${rc}
Setup API Test

View File

@ -1,31 +0,0 @@
# 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 This resource contains any keywords related to using the Drone CI Build System
*** Keywords ***
Get State Of Drone Build
[Arguments] ${num}
Return From Keyword If '${num}' == '0' local
${out}= Run drone build info vmware/vic ${num}
${lines}= Split To Lines ${out}
[Return] @{lines}[2]
Get Title of Drone Build
[Arguments] ${num}
Return From Keyword If '${num}' == '0' local
${out}= Run drone build info vmware/vic ${num}
${lines}= Split To Lines ${out}
[Return] @{lines}[-1]

View File

@ -1,29 +0,0 @@
# 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 This resource provides keywords to interact with Github
*** Keywords ***
Get State Of Github Issue
[Arguments] ${num}
[Tags] secret
FOR ${idx} IN RANGE 0 5
${status} ${result}= Run Keyword And Ignore Error Get https://api.github.com/repos/vmware/vic/issues/${num}?access_token\=%{GITHUB_AUTOMATION_API_KEY}
Exit For Loop If '${status}'
Sleep 1
END
Should Be Equal ${result.status_code} ${200}
${status}= Get From Dictionary ${result.json()} state
[Return] ${status}

View File

@ -198,11 +198,11 @@ Switch To Email
Sleep 1
Config Email
Input Text xpath=//*[@id='mailServer'] smtp.vmware.com
Input Text xpath=//*[@id='mailServer'] smtp.harbortest.com
Input Text xpath=//*[@id='emailPort'] 25
Input Text xpath=//*[@id='emailUsername'] example@vmware.com
Input Text xpath=//*[@id='emailUsername'] example@harbortest.com
Input Text xpath=//*[@id='emailPassword'] example
Input Text xpath=//*[@id='emailFrom'] example<example@vmware.com>
Input Text xpath=//*[@id='emailFrom'] example<example@harbortest.com>
Sleep 1
Retry Element Click xpath=//*[@id='emailSSL-wrapper']/label
Sleep 1
@ -212,10 +212,10 @@ Config Email
Sleep 6
Verify Email
Textfield Value Should Be xpath=//*[@id='mailServer'] smtp.vmware.com
Textfield Value Should Be xpath=//*[@id='mailServer'] smtp.harbortest.com
Textfield Value Should Be xpath=//*[@id='emailPort'] 25
Textfield Value Should Be xpath=//*[@id='emailUsername'] example@vmware.com
Textfield Value Should Be xpath=//*[@id='emailFrom'] example<example@vmware.com>
Textfield Value Should Be xpath=//*[@id='emailUsername'] example@harbortest.com
Textfield Value Should Be xpath=//*[@id='emailFrom'] example<example@harbortest.com>
Checkbox Should Be Selected xpath=//*[@id='emailSSL']
Checkbox Should Not Be Selected xpath=//*[@id='emailInsecure']

View File

@ -25,6 +25,7 @@ Sign In Harbor
Retry Wait Element ${harbor_span_title}
Retry Wait Element ${login_name}
Retry Wait Element ${login_pwd}
Retry Wait Element //label[contains(@class,'title') and contains(., 'Harbor title')]
Input Text ${login_name} ${user}
Input Text ${login_pwd} ${pw}
Retry Wait Element ${login_btn}

View File

@ -30,4 +30,9 @@ ${login_btn} //*[@id='log_in']
${harbor_span_title} //span[contains(., 'Harbor')]
${login_name} //*[@id='login_username']
${login_pwd} //*[@id='login_password']
${header_user} //harbor-app/harbor-shell/clr-main-container/navigator/clr-header//clr-dropdown[2]//button/span
${about_btn} //clr-dropdown-menu/a[contains(.,'About')]
${header} xpath=//clr-header[contains(@class,'header-5')]
${color_theme_light} //span[contains(.,'LIGHT')]
${close_btn} //button[contains(.,'CLOSE')]

View File

@ -42,7 +42,7 @@ Sign In Harbor With OIDC User
Run Keyword If '${isVisible}' == 'True' Run Keywords Retry Text Input ${oidc_username_input} ${username} AND Retry Element Click ${save_btn}
Retry Wait Element ${head_username}
Capture Page Screenshot
${name_display}= Get Text xpath=//harbor-app/harbor-shell/clr-main-container/navigator/clr-header//clr-dropdown[2]//button/span
${name_display}= Get Text ${header_user}
Run Keyword If '${username_claim}' == 'email' Should Be Equal As Strings ${name_display} ${full_name}
... ELSE Should Be Equal As Strings ${name_display} ${username}

View File

@ -29,7 +29,7 @@ ${project_config_tabsheet} xpath=//project-detail//a[contains(.,'Configuration'
${project_tag_strategy_xpath} //clr-tabs//a[contains(.,'Policy')]
${project_tab_overflow_btn} //clr-tabs//li//button[contains(@class,"dropdown-toggle")]
${project_tag_immutability_switch} //project-detail/app-tag-feature-integration//label/a[contains(.,'Tag Immutability')]
${project_tag_immutability_switch} //project-detail/app-tag-feature-integration//label[contains(.,'Tag Immutability')]
${create_project_CANCEL_button_xpath} xpath=//button[contains(.,'CANCEL')]
${create_project_OK_button_xpath} xpath=//button[contains(.,'OK')]

View File

@ -1,407 +0,0 @@
# 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 This resource contains any keywords related to using the Nimbus cluster
*** Variables ***
${ESX_VERSION} 4564106 #6.5 RTM
${VC_VERSION} 4602587 #6.5 RTM
${NIMBUS_ESX_PASSWORD} e2eFunctionalTest
*** Keywords ***
Deploy Nimbus ESXi Server
[Arguments] ${user} ${password} ${version}=${ESX_VERSION} ${tls_disabled}=True
${name}= Evaluate 'ESX-' + str(random.randint(1000,9999)) modules=random
Log To Console \nDeploying Nimbus ESXi server: ${name}
Open Connection %{NIMBUS_GW}
Wait Until Keyword Succeeds 2 min 30 sec Login ${user} ${password}
:FOR ${IDX} IN RANGE 1 5
\ ${out}= Execute Command nimbus-esxdeploy ${name} --disk=48000000 --ssd=24000000 --memory=8192 --nics 2 ob-${version}
\ # Make sure the deploy actually worked
\ ${status}= Run Keyword And Return Status Should Contain ${out} To manage this VM use
\ Exit For Loop If ${status}
\ Log To Console ${out}
\ Log To Console Nimbus deployment ${IDX} failed, trying again in 5 minutes
\ Sleep 5 minutes
# Now grab the IP address and return the name and ip for later use
@{out}= Split To Lines ${out}
:FOR ${item} IN @{out}
\ ${status} ${message}= Run Keyword And Ignore Error Should Contain ${item} IP is
\ Run Keyword If '${status}' == 'PASS' Set Suite Variable ${line} ${item}
@{gotIP}= Split String ${line} ${SPACE}
${ip}= Remove String @{gotIP}[5] ,
# Let's set a password so govc doesn't complain
Remove Environment Variable GOVC_PASSWORD
Remove Environment Variable GOVC_USERNAME
Set Environment Variable GOVC_INSECURE 1
Set Environment Variable GOVC_URL root:@${ip}
${out}= Run govc host.account.update -id root -password ${NIMBUS_ESX_PASSWORD}
Should Be Empty ${out}
Run Keyword If ${tls_disabled} Disable TLS On ESX Host
Log To Console Successfully deployed new ESXi server - ${user}-${name}
Close connection
[Return] ${user}-${name} ${ip}
Deploy Multiple Nimbus ESXi Servers in Parallel
[Arguments] ${user} ${password} ${version}=${ESX_VERSION}
${name1}= Evaluate 'ESX-' + str(random.randint(1000,9999)) modules=random
${name2}= Evaluate 'ESX-' + str(random.randint(1000,9999)) modules=random
${name3}= Evaluate 'ESX-' + str(random.randint(1000,9999)) modules=random
Open Connection %{NIMBUS_GW}
Login ${user} ${password}
${out1}= Deploy Nimbus ESXi Server Async ${name1}
${out2}= Deploy Nimbus ESXi Server Async ${name2}
${out3}= Deploy Nimbus ESXi Server Async ${name3}
Wait For Process ${out1}
Wait For Process ${out2}
Wait For Process ${out3}
${out}= Execute Command nimbus-ctl ip ${user}-${name1}
@{out}= Split To Lines ${out}
:FOR ${item} IN @{out}
\ ${status} ${message}= Run Keyword And Ignore Error Should Contain ${item} ${user}-${name1}
\ Run Keyword If '${status}' == 'PASS' Set Suite Variable ${line} ${item}
@{gotIP}= Split String ${line} ${SPACE}
${ip1}= Remove String @{gotIP}[2]
${out}= Execute Command nimbus-ctl ip ${user}-${name2}
@{out}= Split To Lines ${out}
:FOR ${item} IN @{out}
\ ${status} ${message}= Run Keyword And Ignore Error Should Contain ${item} ${user}-${name2}
\ Run Keyword If '${status}' == 'PASS' Set Suite Variable ${line} ${item}
@{gotIP}= Split String ${line} ${SPACE}
${ip2}= Remove String @{gotIP}[2]
${out}= Execute Command nimbus-ctl ip ${user}-${name3}
@{out}= Split To Lines ${out}
:FOR ${item} IN @{out}
\ ${status} ${message}= Run Keyword And Ignore Error Should Contain ${item} ${user}-${name3}
\ Run Keyword If '${status}' == 'PASS' Set Suite Variable ${line} ${item}
@{gotIP}= Split String ${line} ${SPACE}
${ip3}= Remove String @{gotIP}[2]
Log To Console \nDeploying Nimbus ESXi server: ${gotIP}
# Let's set a password so govc doesn't complain
Remove Environment Variable GOVC_PASSWORD
Remove Environment Variable GOVC_USERNAME
Set Environment Variable GOVC_INSECURE 1
Set Environment Variable GOVC_URL root:@${ip1}
${out}= Run govc host.account.update -id root -password ${NIMBUS_ESX_PASSWORD}
Should Be Empty ${out}
Disable TLS On ESX Host
Log To Console Successfully deployed new ESXi server - ${user}-${name1}
Log To Console \nNimbus ESXi server IP: ${ip1}
Remove Environment Variable GOVC_PASSWORD
Remove Environment Variable GOVC_USERNAME
Set Environment Variable GOVC_INSECURE 1
Set Environment Variable GOVC_URL root:@${ip2}
${out}= Run govc host.account.update -id root -password ${NIMBUS_ESX_PASSWORD}
Should Be Empty ${out}
Disable TLS On ESX Host
Log To Console Successfully deployed new ESXi server - ${user}-${name2}
Log To Console \nNimbus ESXi server IP: ${ip2}
Remove Environment Variable GOVC_PASSWORD
Remove Environment Variable GOVC_USERNAME
Set Environment Variable GOVC_INSECURE 1
Set Environment Variable GOVC_URL root:@${ip3}
${out}= Run govc host.account.update -id root -password ${NIMBUS_ESX_PASSWORD}
Should Be Empty ${out}
Disable TLS On ESX Host
Log To Console Successfully deployed new ESXi server - ${user}-${name3}
Log To Console \nNimbus ESXi server IP: ${ip3}
Close connection
[Return] ${user}-${name1} ${ip1} ${user}-${name2} ${ip2} ${user}-${name3} ${ip3}
Deploy Nimbus vCenter Server
[Arguments] ${user} ${password} ${version}=${VC_VERSION}
${name}= Evaluate 'VC-' + str(random.randint(1000,9999)) modules=random
Log To Console \nDeploying Nimbus vCenter server: ${name}
Open Connection %{NIMBUS_GW}
Login ${user} ${password}
:FOR ${IDX} IN RANGE 1 5
\ ${out}= Execute Command nimbus-vcvadeploy --vcvaBuild ${version} ${name}
\ # Make sure the deploy actually worked
\ ${status}= Run Keyword And Return Status Should Contain ${out} Overall Status: Succeeded
\ Exit For Loop If ${status}
\ Log To Console Nimbus deployment ${IDX} failed, trying again in 5 minutes
\ Sleep 5 minutes
# Now grab the IP address and return the name and ip for later use
@{out}= Split To Lines ${out}
:FOR ${item} IN @{out}
\ ${status} ${message}= Run Keyword And Ignore Error Should Contain ${item} Cloudvm is running on IP
\ Run Keyword If '${status}' == 'PASS' Set Suite Variable ${line} ${item}
${ip}= Fetch From Right ${line} ${SPACE}
Set Environment Variable GOVC_INSECURE 1
Set Environment Variable GOVC_USERNAME Administrator@vsphere.local
Set Environment Variable GOVC_PASSWORD Admin!23
Set Environment Variable GOVC_URL ${ip}
Log To Console Successfully deployed new vCenter server - ${user}-${name}
Close connection
[Return] ${user}-${name} ${ip}
Deploy Nimbus ESXi Server Async
[Tags] secret
[Arguments] ${name} ${version}=${ESX_VERSION}
Log To Console \nDeploying Nimbus ESXi server: ${name}
${out}= Run Secret SSHPASS command %{NIMBUS_USER} %{NIMBUS_PASSWORD} 'nimbus-esxdeploy ${name} --disk\=48000000 --ssd\=24000000 --memory\=8192 --nics 2 ${version}'
[Return] ${out}
Run Secret SSHPASS command
[Tags] secret
[Arguments] ${user} ${password} ${cmd}
${out}= Start Process sshpass -p ${password} ssh -o StrictHostKeyChecking\=no ${user}@%{NIMBUS_GW} ${cmd} shell=True
[Return] ${out}
Deploy Nimbus vCenter Server Async
[Tags] secret
[Arguments] ${name} ${version}=${VC_VERSION}
Log To Console \nDeploying Nimbus VC server: ${name}
${out}= Run Secret SSHPASS command %{NIMBUS_USER} %{NIMBUS_PASSWORD} 'nimbus-vcvadeploy --vcvaBuild ${version} ${name}'
[Return] ${out}
Deploy Nimbus Testbed
[Arguments] ${user} ${password} ${testbed}
Open Connection %{NIMBUS_GW}
Login ${user} ${password}
:FOR ${IDX} IN RANGE 1 5
\ ${out}= Execute Command nimbus-testbeddeploy ${testbed}
\ # Make sure the deploy actually worked
\ ${status}= Run Keyword And Return Status Should Contain ${out} is up. IP:
\ Exit For Loop If ${status}
\ Log To Console Nimbus deployment ${IDX} failed, trying again in 5 minutes
\ Sleep 5 minutes
[Return] ${out}
Kill Nimbus Server
[Arguments] ${user} ${password} ${name}
Open Connection %{NIMBUS_GW}
Login ${user} ${password}
${out}= Execute Command nimbus-ctl kill '${name}'
Close connection
Cleanup Nimbus PXE folder
[Arguments] ${user} ${password}
Open Connection %{NIMBUS_GW}
Login ${user} ${password}
${out}= Execute Command rm -rf public_html/pxe/*
Close connection
Nimbus Cleanup
[Arguments] ${vm_list} ${collect_log}=True ${dontDelete}=${false}
Run Keyword If ${collect_log} Run Keyword And Continue On Failure Gather Logs From Test Server
Run Keyword And Ignore Error Cleanup Nimbus PXE folder %{NIMBUS_USER} %{NIMBUS_PASSWORD}
Return From Keyword If ${dontDelete}
:FOR ${item} IN @{vm_list}
\ Run Keyword And Ignore Error Kill Nimbus Server %{NIMBUS_USER} %{NIMBUS_PASSWORD} ${item}
Gather Host IPs
${out}= Run govc ls host/cls
${out}= Split To Lines ${out}
${idx}= Set Variable 1
:FOR ${line} IN @{out}
\ Continue For Loop If '${line}' == '/vcqaDC/host/cls/Resources'
\ ${ip}= Fetch From Right ${line} /
\ Set Suite Variable ${esx${idx}-ip} ${ip}
\ ${idx}= Evaluate ${idx}+1
Create a VSAN Cluster
Log To Console \nStarting basic VSAN cluster deploy...
${out}= Deploy Nimbus Testbed %{NIMBUS_USER} %{NIMBUS_PASSWORD} --noSupportBundles --vcvaBuild ${VC_VERSION} --esxPxeDir ${ESX_VERSION} --esxBuild ${ESX_VERSION} --testbedName vcqa-vsan-simple-pxeBoot-vcva --runName vic-vmotion
${out}= Split To Lines ${out}
:FOR ${line} IN @{out}
\ ${status}= Run Keyword And Return Status Should Contain ${line} .vcva-${VC_VERSION}' is up. IP:
\ ${ip}= Run Keyword If ${status} Fetch From Right ${line} ${SPACE}
\ Run Keyword If ${status} Set Suite Variable ${vc-ip} ${ip}
\ Exit For Loop If ${status}
Log To Console Set environment variables up for GOVC
Set Environment Variable GOVC_URL ${vc-ip}
Set Environment Variable GOVC_USERNAME Administrator@vsphere.local
Set Environment Variable GOVC_PASSWORD Admin\!23
Log To Console Create a distributed switch
${out}= Run govc dvs.create -dc=vcqaDC test-ds
Should Contain ${out} OK
Log To Console Create three new distributed switch port groups for management and vm network traffic
${out}= Run govc dvs.portgroup.add -nports 12 -dc=vcqaDC -dvs=test-ds management
Should Contain ${out} OK
${out}= Run govc dvs.portgroup.add -nports 12 -dc=vcqaDC -dvs=test-ds vm-network
Should Contain ${out} OK
${out}= Run govc dvs.portgroup.add -nports 12 -dc=vcqaDC -dvs=test-ds bridge
Should Contain ${out} OK
Log To Console Add all the hosts to the distributed switch
${out}= Run govc dvs.add -dvs=test-ds -pnic=vmnic1 /vcqaDC/host/cls
Should Contain ${out} OK
Log To Console Enable DRS and VSAN on the cluster
${out}= Run govc cluster.change -drs-enabled /vcqaDC/host/cls
Should Be Empty ${out}
Log To Console Deploy VIC to the VC cluster
Set Environment Variable TEST_URL_ARRAY ${vc-ip}
Set Environment Variable TEST_USERNAME Administrator@vsphere.local
Set Environment Variable TEST_PASSWORD Admin\!23
Set Environment Variable BRIDGE_NETWORK bridge
Set Environment Variable PUBLIC_NETWORK vm-network
Set Environment Variable TEST_DATASTORE vsanDatastore
Set Environment Variable TEST_RESOURCE cls
Set Environment Variable TEST_TIMEOUT 30m
Gather Host IPs
Create a Simple VC Cluster
[Arguments] ${datacenter}=ha-datacenter ${cluster}=cls ${esx_number}=3 ${network}=True
Log To Console \nStarting simple VC cluster deploy...
${esx_names}= Create List
${esx_ips}= Create List
:FOR ${IDX} IN RANGE ${esx_number}
\ ${esx} ${esx_ip}= Deploy Nimbus ESXi Server %{NIMBUS_USER} %{NIMBUS_PASSWORD} ${ESX_VERSION} False
\ Append To List ${esx_names} ${esx}
\ Append To List ${esx_ips} ${esx_ip}
${vc} ${vc_ip}= Deploy Nimbus vCenter Server %{NIMBUS_USER} %{NIMBUS_PASSWORD}
Log To Console Create a datacenter on the VC
${out}= Run govc datacenter.create ${datacenter}
Should Be Empty ${out}
Log To Console Create a cluster on the VC
${out}= Run govc cluster.create ${cluster}
Should Be Empty ${out}
Log To Console Add ESX host to the VC
:FOR ${IDX} IN RANGE ${esx_number}
\ ${out}= Run govc cluster.add -hostname=@{esx_ips}[${IDX}] -username=root -dc=${datacenter} -password=${NIMBUS_ESX_PASSWORD} -noverify=true
\ Should Contain ${out} OK
Run Keyword If ${network} Setup Network For Simple VC Cluster ${esx_number} ${datacenter} ${cluster}
Log To Console Enable DRS on the cluster
${out}= Run govc cluster.change -drs-enabled /${datacenter}/host/${cluster}
Should Be Empty ${out}
Set Environment Variable TEST_URL_ARRAY ${vc_ip}
Set Environment Variable TEST_URL ${vc_ip}
Set Environment Variable TEST_USERNAME Administrator@vsphere.local
Set Environment Variable TEST_PASSWORD Admin\!23
Set Environment Variable TEST_DATASTORE datastore1
Set Environment Variable TEST_DATACENTER /${datacenter}
Set Environment Variable TEST_RESOURCE ${cluster}
Set Environment Variable TEST_TIMEOUT 30m
[Return] @{esx_names} ${vc} @{esx_ips} ${vc_ip}
Setup Network For Simple VC Cluster
[Arguments] ${esx_number} ${datacenter} ${cluster}
Log To Console Create a distributed switch
${out}= Run govc dvs.create -dc=${datacenter} test-ds
Should Contain ${out} OK
Log To Console Create three new distributed switch port groups for management and vm network traffic
${out}= Run govc dvs.portgroup.add -nports 12 -dc=${datacenter} -dvs=test-ds management
Should Contain ${out} OK
${out}= Run govc dvs.portgroup.add -nports 12 -dc=${datacenter} -dvs=test-ds vm-network
Should Contain ${out} OK
${out}= Run govc dvs.portgroup.add -nports 12 -dc=${datacenter} -dvs=test-ds bridge
Should Contain ${out} OK
Log To Console Add all the hosts to the distributed switch
${out}= Run govc dvs.add -dvs=test-ds -pnic=vmnic1 /${datacenter}/host/${cluster}
Should Contain ${out} OK
Log To Console Enable DRS on the cluster
${out}= Run govc cluster.change -drs-enabled /${datacenter}/host/${cluster}
Should Be Empty ${out}
Set Environment Variable BRIDGE_NETWORK bridge
Set Environment Variable PUBLIC_NETWORK vm-network
Create A Distributed Switch
[Arguments] ${datacenter} ${dvs}=test-ds
Log To Console \nCreate a distributed switch
${out}= Run govc dvs.create -product-version 5.5.0 -dc=${datacenter} ${dvs}
Should Contain ${out} OK
Create Three Distributed Port Groups
[Arguments] ${datacenter} ${dvs}=test-ds
Log To Console \nCreate three new distributed switch port groups for management and vm network traffic
${out}= Run govc dvs.portgroup.add -nports 12 -dc=${datacenter} -dvs=${dvs} management
Should Contain ${out} OK
${out}= Run govc dvs.portgroup.add -nports 12 -dc=${datacenter} -dvs=${dvs} vm-network
Should Contain ${out} OK
${out}= Run govc dvs.portgroup.add -nports 12 -dc=${datacenter} -dvs=${dvs} bridge
Should Contain ${out} OK
Add Host To Distributed Switch
[Arguments] ${host} ${dvs}=test-ds
Log To Console \nAdd host(s) to the distributed switch
${out}= Run govc dvs.add -dvs=${dvs} -pnic=vmnic1 ${host}
Should Contain ${out} OK
Disable TLS On ESX Host
Log To Console \nDisable TLS on the host
${ver}= Get Vsphere Version
${out}= Run Keyword If '${ver}' != '5.5.0' Run govc host.option.set UserVars.ESXiVPsDisabledProtocols sslv3,tlsv1,tlsv1.1
Run Keyword If '${ver}' != '5.5.0' Should Be Empty ${out}
Get Vsphere Version
${out}= Run govc about
${out}= Split To Lines ${out}
:FOR ${line} IN @{out}
\ ${status}= Run Keyword And Return Status Should Contain ${line} Version:
\ Run Keyword And Return If ${status} Fetch From Right ${line} ${SPACE}
Deploy Nimbus NFS Datastore
[Arguments] ${user} ${password}
${name}= Evaluate 'NFS-' + str(random.randint(1000,9999)) modules=random
Log To Console \nDeploying Nimbus NFS server: ${name}
Open Connection %{NIMBUS_GW}
Login ${user} ${password}
${out}= Execute Command nimbus-nfsdeploy ${name}
# Make sure the deploy actually worked
Should Contain ${out} To manage this VM use
# Now grab the IP address and return the name and ip for later use
@{out}= Split To Lines ${out}
:FOR ${item} IN @{out}
\ ${status} ${message}= Run Keyword And Ignore Error Should Contain ${item} IP is
\ Run Keyword If '${status}' == 'PASS' Set Suite Variable ${line} ${item}
@{gotIP}= Split String ${line} ${SPACE}
${ip}= Remove String @{gotIP}[5] ,
Log To Console Successfully deployed new NFS server - ${user}-${name}
Close connection
[Return] ${user}-${name} ${ip}

View File

@ -1,97 +0,0 @@
# 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 This resource provides any keywords related to Unified OVA
*** Variables ***
${ova_root_pwd} ova-test-root-pwd
${ova_appliance_options} --prop:root_pwd=${ova_root_pwd} --prop:permit_root_login=true
${ova_target_vm_name} harbor-unified-ova-integration-test
${ovftool_options} --noSSLVerify --acceptAllEulas --name=${ova_target_vm_name} --diskMode=thin --powerOn --X:waitForIp --X:injectOvfEnv --X:enableHiddenProperties
${ova_network_ip0} 10.17.109.207
${ova_network_netmask0} 255.255.255.0
${ova_network_gateway} 10.17.109.253
${ova_network_dns} 10.118.81.1
${ova_network_searchpath} eng.vmware.com
${ova_network_domain} mrburns
${ova_network_options} --prop:network.ip0=${ova_network_ip0} --prop:network.netmask0=${ova_network_netmask0} --prop:network.gateway=${ova_network_gateway} --prop:network.DNS=${ova_network_dns} --prop:network.searchpath=${ova_network_searchpath} --prop:network.domain=${ova_network_domain}
${ova_harbor_admin_password} harbor-admin-passwd
${ova_harbor_db_password} harbor-db-passwd
#${ova_service_options} --prop:auth_mode="%{AUTH_MODE}" --prop:max_job_workers="%{MAX_JOB_WORKERS}" --prop:harbor_admin_password="%{HARBOR_ADMIN_PASSWORD}" --prop:db_password="%{DB_PASSWORD}"
#${ova_options} ${ovftool_options} ${ova_appliance_options} ${ova_service_options}
#${ova_options_with_network} ${ova_options} ${ova_network_options}
${tls_not_disabled} False
*** Keywords ***
# Requires vc credential for govc
Deploy Harbor-OVA To Test Server
[Arguments] ${dhcp} ${protocol} ${build} ${user} ${password} ${ova_path} ${host} ${datastore} ${cluster} ${datacenter}
Log To Console \nCleanup environment...
Run Keyword And Ignore Error Run GOVC_URL=${host} GOVC_USERNAME=${user} GOVC_PASSWORD=${password} GOVC_INSECURE=1 govc vm.destroy ${ova_target_vm_name}
Run Keyword And Ignore Error Run GOVC_URL=${host} GOVC_USERNAME=${user} GOVC_PASSWORD=${password} GOVC_INSECURE=1 govc object.destroy /${datacenter}/vm/${ova_target_vm_name}
Log To Console \nStarting to deploy unified-ova to test server...
Run Keyword If ${dhcp} Log To Console ovftool --datastore=${datastore} ${ova_options} ${ova_path} 'vi://${user}:${password}@${host}/${datacenter}/host/${cluster}'
... ELSE Log To Console ovftool --datastore=${datastore} ${ova_options_with_network} ${ova_path} 'vi://${user}:${password}@${host}/${datacenter}/host/${cluster}'
${out}= Run Keyword If ${dhcp} Run ovftool --datastore=${datastore} ${ova_options} ${ova_path} 'vi://${user}:${password}@${host}/${datacenter}/host/${cluster}'
... ELSE Run ovftool --datastore=${datastore} ${ova_options_with_network} ${ova_path} 'vi://${user}:${password}@${host}/${datacenter}/host/${cluster}'
Should Contain ${out} Received IP address:
Should Not Contain ${out} None
${out}= Run GOVC_URL=${host} GOVC_USERNAME=${user} GOVC_PASSWORD=${password} GOVC_INSECURE=1 govc ls /ha-datacenter/host/cls/
${out}= Split To Lines ${out}
${idx}= Set Variable 1
:FOR ${line} IN @{out}
\ Continue For Loop If '${line}' == '/ha-datacenter/host/cls/Resources'
\ ${ip}= Fetch From Right ${line} /
\ Set Suite Variable ${esx${idx}-ip} ${ip}
\ ${idx}= Evaluate ${idx}+1
Run Keyword And Ignore Error Run GOVC_URL=${host} GOVC_USERNAME=${user} GOVC_PASSWORD=${password} GOVC_INSECURE=1 govc host.esxcli -host.ip=${esx1-ip} system settings advanced set -o /Net/GuestIPHack -i 1
${ip}= Run GOVC_URL=${host} GOVC_USERNAME=${user} GOVC_PASSWORD=${password} GOVC_INSECURE=1 govc vm.ip -esxcli harbor-unified-ova-integration-test
Set Environment Variable HARBOR_IP ${ip}
Log To Console \nHarbor IP: %{HARBOR_IP}
Wait for Harbor Ready ${protocol} %{HARBOR_IP}
[Return] %{HARBOR_IP}
# Requires vc credential for govc
Cleanup Harbor-OVA On Test Server
[Arguments] ${url}=%{GOVC_URL} ${username}=%{GOVC_USERNAME} ${password}=%{GOVC_PASSWORD}
${rc} ${output}= Run And Return Rc And Output GOVC_URL=${url} GOVC_USERNAME=${username} GOVC_PASSWORD=${password} GOVC_INSECURE=1 govc vm.destroy ${ova_target_vm_name}
Log ${output}
Should Be Equal As Integers ${rc} 0
Run Keyword And Ignore Error Run GOVC_URL=${url} GOVC_USERNAME=${username} GOVC_PASSWORD=${password} GOVC_INSECURE=1 govc object.destroy /%{TEST_DATACENTER}/vm/${ova_target_vm_name}
Log To Console \nUnified-OVA deployment is cleaned up on test server
Build Unified OVA
[Arguments] ${user}=%{TEST_USERNAME} ${password}=%{TEST_PASSWORD} ${host}=%{TEST_URL}
Log To Console \nStarting to build Unified OVA...
Log To Console \nRemove stale local OVA artifacts
Run Remove OVA Artifacts Locally
${out}= Run PACKER_ESX_HOST=${host} PACKER_USER=${user} PACKER_PASSWORD=${password} make ova-release
Log ${out}
@{out}= Split To Lines ${out}
Should Not Contain @{out}[-1] Error
Log To Console \nUnified OVA is built successfully

View File

@ -22,11 +22,6 @@ Library SSHLibrary 1 minute
Library DateTime
Library SeleniumLibrary 60 10
Library JSONLibrary
Resource Nimbus-Util.robot
Resource Vsphere-Util.robot
Resource VCH-Util.robot
Resource Drone-Util.robot
Resource Github-Util.robot
Resource Harbor-Util.robot
Resource Harbor-Pages/Public_Elements.robot
Resource Harbor-Pages/HomePage.robot
@ -75,7 +70,6 @@ Resource Harbor-Pages/Verify.robot
Resource Docker-Util.robot
Resource CNAB_Util.robot
Resource Helm-Util.robot
Resource OVA-Util.robot
Resource Cert-Util.robot
Resource SeleniumUtil.robot
Resource Nightly-Util.robot

View File

@ -1,404 +0,0 @@
# 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 This resource contains all keywords related to creating, deleting, maintaining VCHs
*** Keywords ***
Set Test Environment Variables
# Finish setting up environment variables
${status} ${message}= Run Keyword And Ignore Error Environment Variable Should Be Set DRONE_BUILD_NUMBER
Run Keyword If '${status}' == 'FAIL' Set Environment Variable DRONE_BUILD_NUMBER 0
${status} ${message}= Run Keyword And Ignore Error Environment Variable Should Be Set BRIDGE_NETWORK
Run Keyword If '${status}' == 'FAIL' Set Environment Variable BRIDGE_NETWORK network
${status} ${message}= Run Keyword And Ignore Error Environment Variable Should Be Set PUBLIC_NETWORK
Run Keyword If '${status}' == 'FAIL' Set Environment Variable PUBLIC_NETWORK 'VM Network'
${status} ${message}= Run Keyword And Ignore Error Environment Variable Should Be Set TEST_DATACENTER
Run Keyword If '${status}' == 'FAIL' Set Environment Variable TEST_DATACENTER ${SPACE}
@{URLs}= Split String %{TEST_URL_ARRAY}
${len}= Get Length ${URLs}
${IDX}= Evaluate %{DRONE_BUILD_NUMBER} \% ${len}
Set Environment Variable TEST_URL @{URLs}[${IDX}]
Set Environment Variable GOVC_URL %{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}
# TODO: need an integration/vic-test image update to include the about.cert command
#${rc} ${thumbprint}= Run And Return Rc And Output govc about.cert -k | jq -r .ThumbprintSHA1
${rc} ${thumbprint}= Run And Return Rc And Output openssl s_client -connect $(govc env -x GOVC_URL_HOST):443 </dev/null 2>/dev/null | openssl x509 -fingerprint -noout | cut -d= -f2
Should Be Equal As Integers ${rc} 0
Set Environment Variable TEST_THUMBPRINT ${thumbprint}
Log To Console \nTEST_URL=%{TEST_URL}
${host}= Run govc ls host
${status} ${message}= Run Keyword And Ignore Error Environment Variable Should Be Set TEST_RESOURCE
Run Keyword If '${status}' == 'FAIL' Set Environment Variable TEST_RESOURCE ${host}/Resources
Set Environment Variable GOVC_RESOURCE_POOL %{TEST_RESOURCE}
${noQuotes}= Strip String %{TEST_DATASTORE} characters="
Set Environment Variable GOVC_DATASTORE ${noQuotes}
${about}= Run govc about
${status}= Run Keyword And Return Status Should Contain ${about} VMware ESXi
Run Keyword If ${status} Set Environment Variable HOST_TYPE ESXi
Run Keyword Unless ${status} Set Environment Variable HOST_TYPE VC
${about}= Run govc datastore.info %{TEST_DATASTORE} | grep 'Type'
${status}= Run Keyword And Return Status Should Contain ${about} vsan
Run Keyword If ${status} Set Environment Variable DATASTORE_TYPE VSAN
Run Keyword Unless ${status} Set Environment Variable DATASTORE_TYPE Non_VSAN
# set the TLS config options suitable for vic-machine in this env
${domain}= Get Environment Variable DOMAIN ''
Run Keyword If $domain == '' Set Suite Variable ${vicmachinetls} --no-tlsverify
Run Keyword If $domain != '' Set Suite Variable ${vicmachinetls} --tls-cname=*.${domain}
Set Test VCH Name
# Set a unique bridge network for each VCH that has a random VLAN ID
${vlan}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Evaluate str(random.randint(1, 4093)) modules=random
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.add -vlan=${vlan} -vswitch vSwitchLAN %{VCH-NAME}-bridge
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Set Environment Variable BRIDGE_NETWORK %{VCH-NAME}-bridge
Set Test VCH Name
${name}= Evaluate 'VCH-%{DRONE_BUILD_NUMBER}-' + str(random.randint(1000,9999)) modules=random
Set Environment Variable VCH-NAME ${name}
Set List Of Env Variables
[Arguments] ${vars}
@{vars}= Split String ${vars}
:FOR ${var} IN @{vars}
\ ${varname} ${varval}= Split String ${var} =
\ Set Environment Variable ${varname} ${varval}
Parse Environment Variables
[Arguments] ${line}
# If using the old logging format
${status}= Run Keyword And Return Status Should Contain ${line} mINFO
${logdeco} ${vars}= Run Keyword If ${status} Split String ${line} ${SPACE} 1
Run Keyword If ${status} Set List Of Env Variables ${vars}
Return From Keyword If ${status}
# Split the log log into pieces, discarding the initial log decoration, and assign to env vars
${logmon} ${logday} ${logyear} ${logtime} ${loglevel} ${vars}= Split String ${line} max_split=5
Set List Of Env Variables ${vars}
Get Docker Params
# Get VCH docker params e.g. "-H 192.168.218.181:2376 --tls"
[Arguments] ${output} ${certs}
@{output}= Split To Lines ${output}
:FOR ${item} IN @{output}
\ ${status} ${message}= Run Keyword And Ignore Error Should Contain ${item} DOCKER_HOST=
\ Run Keyword If '${status}' == 'PASS' Set Suite Variable ${line} ${item}
# Ensure we start from a clean slate with docker env vars
Remove Environment Variable DOCKER_HOST DOCKER_TLS_VERIFY DOCKER_CERT_PATH CURL_CA_BUNDLE COMPOSE_PARAMS COMPOSE_TLS_VERSION
Parse Environment Variables ${line}
${dockerHost}= Get Environment Variable DOCKER_HOST
@{hostParts}= Split String ${dockerHost} :
${ip}= Strip String @{hostParts}[0]
${port}= Strip String @{hostParts}[1]
Set Environment Variable VCH-IP ${ip}
Set Environment Variable VCH-PORT ${port}
:FOR ${index} ${item} IN ENUMERATE @{output}
\ ${status} ${message}= Run Keyword And Ignore Error Should Contain ${item} http
\ Run Keyword If '${status}' == 'PASS' Set Suite Variable ${line} ${item}
\ ${status} ${message}= Run Keyword And Ignore Error Should Contain ${item} Published ports can be reached at
\ ${idx} = Evaluate ${index} + 1
\ Run Keyword If '${status}' == 'PASS' Set Suite Variable ${ext-ip} @{output}[${idx}]
${rest} ${ext-ip} = Split String From Right ${ext-ip} ${SPACE} 1
${ext-ip} = Strip String ${ext-ip}
Set Environment Variable EXT-IP ${ext-ip}
${rest} ${vic-admin}= Split String From Right ${line} ${SPACE} 1
Set Environment Variable VIC-ADMIN ${vic-admin}
Run Keyword If ${port} == 2376 Set Environment Variable VCH-PARAMS -H ${dockerHost} --tls
Run Keyword If ${port} == 2375 Set Environment Variable VCH-PARAMS -H ${dockerHost}
### Add environment variables for Compose and TLS
# Check if tls is enable from vic-machine's output and not trust ${certs} which some tests bypasses
${tls_enabled}= Get Environment Variable DOCKER_TLS_VERIFY ${false}
### Compose case for no-tlsverify
# Set environment variables if certs not used to create the VCH. This is NOT the recommended
# approach to running compose. There will be security warnings in the logs and some compose
# operations may not work properly because certs == false currently means we install with
# --no-tlsverify. Add CURL_CA_BUNDLE for a workaround in compose tests. If we change
# certs == false to install with --no-tls, then we need to change this again.
Run Keyword If ${tls_enabled} == ${false} Set Environment Variable CURL_CA_BUNDLE ${EMPTY}
# Get around quirk in compose if no-tlsverify, then CURL_CA_BUNDLE must exist and compose called with --tls
Run Keyword If ${tls_enabled} == ${false} Set Environment Variable COMPOSE-PARAMS -H ${dockerHost} --tls
### Compose case for tlsverify (assumes DOCKER_TLS_VERIFY also set)
Run Keyword If ${tls_enabled} == ${true} Set Environment Variable COMPOSE_TLS_VERSION TLSv1_2
Run Keyword If ${tls_enabled} == ${true} Set Environment Variable COMPOSE-PARAMS -H ${dockerHost}
Install VIC Appliance To Test Server
[Arguments] ${vic-machine}=bin/vic-machine-linux ${appliance-iso}=bin/appliance.iso ${bootstrap-iso}=bin/bootstrap.iso ${certs}=${true} ${vol}=default ${cleanup}=${true}
Set Test Environment Variables
# disable firewall
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.esxcli network firewall set -e false
# Attempt to cleanup old/canceled tests
Run Keyword If ${cleanup} Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword If ${cleanup} Run Keyword And Ignore Error Cleanup Datastore On Test Server
Run Keyword If ${cleanup} Run Keyword And Ignore Error Cleanup Dangling Networks On Test Server
Run Keyword If ${cleanup} Run Keyword And Ignore Error Cleanup Dangling vSwitches On Test Server
Run Keyword If ${cleanup} Run Keyword And Ignore Error Cleanup Dangling Containers On Test Server
# Install the VCH now
Log To Console \nInstalling VCH to test server...
${output}= Run VIC Machine Command ${vic-machine} ${appliance-iso} ${bootstrap-iso} ${certs} ${vol}
Log ${output}
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${certs}
Log To Console Installer completed successfully: %{VCH-NAME}...
Run VIC Machine Command
[Tags] secret
[Arguments] ${vic-machine} ${appliance-iso} ${bootstrap-iso} ${certs} ${vol}
${output}= Run Keyword If ${certs} Run ${vic-machine} create --debug 1 --name=%{VCH-NAME} --target=%{TEST_URL}%{TEST_DATACENTER} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --image-store=%{TEST_DATASTORE} --appliance-iso=${appliance-iso} --bootstrap-iso=${bootstrap-iso} --password=%{TEST_PASSWORD} --force=true --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} --compute-resource=%{TEST_RESOURCE} --timeout %{TEST_TIMEOUT} --volume-store=%{TEST_DATASTORE}/test:${vol} ${vicmachinetls}
Run Keyword If ${certs} Should Contain ${output} Installer completed successfully
Return From Keyword If ${certs} ${output}
${output}= Run Keyword Unless ${certs} Run ${vic-machine} create --debug 1 --name=%{VCH-NAME} --target=%{TEST_URL}%{TEST_DATACENTER} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --image-store=%{TEST_DATASTORE} --appliance-iso=${appliance-iso} --bootstrap-iso=${bootstrap-iso} --password=%{TEST_PASSWORD} --force=true --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} --compute-resource=%{TEST_RESOURCE} --timeout %{TEST_TIMEOUT} --volume-store=%{TEST_DATASTORE}/test:${vol} --no-tlsverify
Run Keyword Unless ${certs} Should Contain ${output} Installer completed successfully
[Return] ${output}
Run Secret VIC Machine Delete Command
[Tags] secret
[Arguments] ${vch-name}
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux delete --name=${vch-name} --target=%{TEST_URL}%{TEST_DATACENTER} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --force=true --compute-resource=%{TEST_RESOURCE} --timeout %{TEST_TIMEOUT}
[Return] ${rc} ${output}
Run Secret VIC Machine Inspect Command
[Tags] secret
[Arguments] ${name}
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux inspect --name=${name} --target=%{TEST_URL}%{TEST_DATACENTER} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --thumbprint=%{TEST_THUMBPRINT}
[Return] ${rc} ${output}
Run VIC Machine Delete Command
${rc} ${output}= Run Secret VIC Machine Delete Command %{VCH-NAME}
Wait Until Keyword Succeeds 6x 5s Check Delete Success %{VCH-NAME}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} Completed successfully
${output}= Run rm -rf %{VCH-NAME}
[Return] ${output}
Run VIC Machine Inspect Command
${rc} ${output}= Run Secret VIC Machine Inspect Command %{VCH-NAME}
Get Docker Params ${output} ${true}
Gather Logs From Test Server
[Tags] secret
Run Keyword And Continue On Failure Run zip %{VCH-NAME}-certs -r %{VCH-NAME}
${out}= Run curl -k -D vic-admin-cookies -Fusername=%{TEST_USERNAME} -Fpassword=%{TEST_PASSWORD} %{VIC-ADMIN}/authentication
Log ${out}
${out}= Run curl -k -b vic-admin-cookies %{VIC-ADMIN}/container-logs.zip -o ${SUITE NAME}-%{VCH-NAME}-container-logs.zip
Log ${out}
Remove File vic-admin-cookies
${out}= Run govc datastore.download %{VCH-NAME}/vmware.log %{VCH-NAME}-vmware.log
Should Contain ${out} OK
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc logs -log=vmkernel -n=10000 > vmkernel.log
Check For The Proper Log Files
[Arguments] ${container}
# Ensure container logs are correctly being gathered for debugging purposes
${rc} ${output}= Run And Return Rc and Output curl -sk %{VIC-ADMIN}/authentication -XPOST -F username=%{TEST_USERNAME} -F password=%{TEST_PASSWORD} -D /tmp/cookies-%{VCH-NAME}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc and Output curl -sk %{VIC-ADMIN}/container-logs.tar.gz -b /tmp/cookies-%{VCH-NAME} | tar tvzf -
Should Be Equal As Integers ${rc} 0
Log ${output}
Should Contain ${output} ${container}/output.log
Should Contain ${output} ${container}/vmware.log
Should Contain ${output} ${container}/tether.debug
Scrape Logs For the Password
[Tags] secret
${rc}= Run And Return Rc curl -sk %{VIC-ADMIN}/authentication -XPOST -F username=%{TEST_USERNAME} -F password=%{TEST_PASSWORD} -D /tmp/cookies-%{VCH-NAME}
Should Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc curl -sk %{VIC-ADMIN}/logs/port-layer.log -b /tmp/cookies-%{VCH-NAME} | grep -q "%{TEST_PASSWORD}"
Should Be Equal As Integers ${rc} 1
${rc}= Run And Return Rc curl -sk %{VIC-ADMIN}/logs/init.log -b /tmp/cookies-%{VCH-NAME} | grep -q "%{TEST_PASSWORD}"
Should Be Equal As Integers ${rc} 1
${rc}= Run And Return Rc curl -sk %{VIC-ADMIN}/logs/docker-personality.log -b /tmp/cookies-%{VCH-NAME} | grep -q "%{TEST_PASSWORD}"
Should Be Equal As Integers ${rc} 1
${rc}= Run And Return Rc curl -sk %{VIC-ADMIN}/logs/vicadmin.log -b /tmp/cookies-%{VCH-NAME} | grep -q "%{TEST_PASSWORD}"
Should Be Equal As Integers ${rc} 1
Remove File /tmp/cookies-%{VCH-NAME}
Cleanup VIC Appliance On Test Server
Log To Console Gathering logs from the test server %{VCH-NAME}
Gather Logs From Test Server
Log To Console Deleting the VCH appliance %{VCH-NAME}
${output}= Run VIC Machine Delete Command
Run Keyword And Ignore Error Cleanup VCH Bridge Network %{VCH-NAME}
[Return] ${output}
Cleanup VCH Bridge Network
[Arguments] ${name}
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.remove ${name}-bridge
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.info
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Should Not Contain ${out} ${name}-bridge
Cleanup Datastore On Test Server
${out}= Run govc datastore.ls
${items}= Split To Lines ${out}
:FOR ${item} IN @{items}
\ ${build}= Split String ${item} -
\ # Skip any item that is not associated with integration tests
\ Continue For Loop If '@{build}[0]' != 'VCH'
\ # Skip any item that is still running
\ ${state}= Get State Of Drone Build @{build}[1]
\ Continue For Loop If '${state}' == 'running'
\ Log To Console Removing the following item from datastore: ${item}
\ ${out}= Run govc datastore.rm ${item}
\ Wait Until Keyword Succeeds 6x 5s Check Delete Success ${item}
Cleanup Dangling VMs On Test Server
${out}= Run govc ls vm
${vms}= Split To Lines ${out}
:FOR ${vm} IN @{vms}
\ ${vm}= Fetch From Right ${vm} /
\ ${build}= Split String ${vm} -
\ # Skip any VM that is not associated with integration tests
\ Continue For Loop If '@{build}[0]' != 'VCH'
\ # Skip any VM that is still running
\ ${state}= Get State Of Drone Build @{build}[1]
\ Continue For Loop If '${state}' == 'running'
\ ${uuid}= Run govc vm.info -json\=true ${vm} | jq -r '.VirtualMachines[0].Config.Uuid'
\ Log To Console Destroying dangling VCH: ${vm}
\ ${rc} ${output}= Run Secret VIC Machine Delete Command ${vm}
\ Wait Until Keyword Succeeds 6x 5s Check Delete Success ${vm}
Cleanup Dangling Networks On Test Server
${out}= Run govc ls network
${nets}= Split To Lines ${out}
:FOR ${net} IN @{nets}
\ ${net}= Fetch From Right ${net} /
\ ${build}= Split String ${net} -
\ # Skip any Network that is not associated with integration tests
\ Continue For Loop If '@{build}[0]' != 'VCH'
\ # Skip any Network that is still running
\ ${state}= Get State Of Drone Build @{build}[1]
\ Continue For Loop If '${state}' == 'running'
\ ${uuid}= Run govc host.portgroup.remove ${net}
Cleanup Dangling vSwitches On Test Server
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.vswitch.info | grep VCH
${nets}= Split To Lines ${out}
:FOR ${net} IN @{nets}
\ ${net}= Fetch From Right ${net} ${SPACE}
\ ${build}= Split String ${net} -
\ # Skip any vSwitch that is not associated with integration tests
\ Continue For Loop If '@{build}[0]' != 'VCH'
\ # Skip any vSwitch that is still running
\ ${state}= Get State Of Drone Build @{build}[1]
\ Continue For Loop If '${state}' == 'running'
\ ${uuid}= Run govc host.vswitch.remove ${net}
Get Scratch Disk From VM Info
[Arguments] ${vm}
${disks}= Run govc vm.info -json ${vm} | jq -r '.VirtualMachines[].Layout.Disk[].DiskFile[]'
${disks}= Split To Lines ${disks}
:FOR ${disk} IN @{disks}
\ ${disk}= Fetch From Right ${disk} ${SPACE}
\ ${status}= Run Keyword And Return Status Should Contain ${disk} scratch.vmdk
\ Return From Keyword If ${status} ${disk}
Cleanup Dangling Containers On Test Server
${vms}= Run govc ls vm
${vms}= Split To Lines ${vms}
:FOR ${vm} IN @{vms}
\ # Ignore VCH's, we only care about containers at this point
\ ${status}= Run Keyword And Return Status Should Contain ${vm} VCH
\ Continue For Loop If ${status}
\ ${disk}= Get Scratch Disk From VM Info ${vm}
\ ${vch}= Fetch From Left ${disk} /
\ ${vch}= Split String ${vch} -
\ # Skip any VM that is not associated with integration tests
\ Continue For Loop If '@{vch}[0]' != 'VCH'
\ ${state}= Get State Of Drone Build @{vch}[1]
\ # Skip any VM that is still running
\ Continue For Loop If '${state}' == 'running'
\ # Destroy the VM and remove it from datastore because it is a dangling container
\ Log To Console Cleaning up dangling container: ${vm}
\ ${out}= Run govc vm.destroy ${vm}
\ ${name}= Fetch From Right ${vm} /
\ ${out}= Run govc datastore.rm ${name}
\ Wait Until Keyword Succeeds 6x 5s Check Delete Success ${name}
# VCH upgrade helpers
Install VIC with version to Test Server
[Arguments] ${version}=7315 ${insecureregistry}=
Log To Console \nDownloading vic ${version} from bintray...
${rc} ${output}= Run And Return Rc And Output wget https://bintray.com/vmware/vic-repo/download_file?file_path=vic_${version}.tar.gz -O vic.tar.gz
${rc} ${output}= Run And Return Rc And Output tar zxvf vic.tar.gz
Set Environment Variable TEST_TIMEOUT 20m0s
Install VIC Appliance To Test Server vic-machine=./vic/vic-machine-linux appliance-iso=./vic/appliance.iso bootstrap-iso=./vic/bootstrap.iso certs=${false} vol=default ${insecureregistry}
Set Environment Variable VIC-ADMIN %{VCH-IP}:2378
Set Environment Variable INITIAL-VERSION ${version}
Clean up VIC Appliance And Local Binary
Cleanup VIC Appliance On Test Server
Run rm -rf vic.tar.gz vic
Upgrade
Log To Console \nUpgrading VCH...
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux upgrade --debug 1 --name=%{VCH-NAME} --target=%{TEST_URL} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --force=true --compute-resource=%{TEST_RESOURCE} --timeout %{TEST_TIMEOUT}
Should Contain ${output} Completed successfully
Should Not Contain ${output} Rolling back upgrade
Should Be Equal As Integers ${rc} 0
Check Upgraded Version
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux version
@{vers}= Split String ${output}
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux inspect --name=%{VCH-NAME} --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --compute-resource=%{TEST_RESOURCE}
Should Contain ${output} Completed successfully
Should Contain ${output} @{vers}[2]
Should Not Contain ${output} %{INITIAL-VERSION}
Should Be Equal As Integers ${rc} 0
Log ${output}
Get Docker Params ${output} ${true}
Check Original Version
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux version
@{vers}= Split String ${output}
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux inspect --name=%{VCH-NAME} --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --compute-resource=%{TEST_RESOURCE}
Should Contain ${output} Completed successfully
Should Contain ${output} @{vers}[2]
Should Be Equal As Integers ${rc} 0
Log ${output}
Get Docker Params ${output} ${true}
Rollback
Log To Console \nTesting rollback...
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux upgrade --debug 1 --name=%{VCH-NAME} --target=%{TEST_URL} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --force=true --compute-resource=%{TEST_RESOURCE} --timeout %{TEST_TIMEOUT} --rollback
Should Contain ${output} Completed successfully
Should Be Equal As Integers ${rc} 0
Enable VCH SSH
[Arguments] ${vic-machine}=bin/vic-machine-linux ${rootpw}=%{TEST_PASSWORD} ${target}=%{TEST_URL} ${password}=%{TEST_PASSWORD} ${thumbprint}=%{TEST_THUMBPRINT} ${name}=%{VCH-NAME} ${user}=%{TEST_USERNAME} ${resource}=%{TEST_RESOURCE}
Log To Console \nEnable SSH on vch...
${rc} ${output}= Run And Return Rc And Output ${vic-machine} debug --rootpw ${rootpw} --target ${target} --password ${password} --thumbprint ${thumbprint} --name ${name} --user ${user} --compute-resource ${resource} --enable-ssh
Should Be Equal As Integers ${rc} 0
Should Contain ${output} Completed successfully

View File

@ -1,217 +0,0 @@
# 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 This resource contains any keywords dealing with operations being performed on a Vsphere instance, mostly govc wrappers
*** Keywords ***
Power On VM OOB
[Arguments] ${vm} ${vc_host} ${vc_user} ${vc_password}
${rc} ${output}= Run And Return Rc And Output GOVC_URL=${vc_host} GOVC_USERNAME=${vc_user} GOVC_PASSWORD=${vc_password} GOVC_INSECURE=1 govc vm.power -on "${vm}"
Should Be Equal As Integers ${rc} 0
Log To Console Waiting for VM to power on ...
Wait Until VM Powers On "${vm}" ${vc_host} ${vc_user} ${vc_password}
Power Off VM OOB
[Arguments] ${vm} ${vc_host} ${vc_user} ${vc_password}
${rc} ${output}= Run And Return Rc And Output GOVC_URL=${vc_host} GOVC_USERNAME=${vc_user} GOVC_PASSWORD=${vc_password} GOVC_INSECURE=1 govc vm.power -off "${vm}"
Log To Console ${output}
Should Be Equal As Integers ${rc} 0
Log To Console Waiting for VM to power off ...
Wait Until VM Powers Off "${vm}" ${vc_host} ${vc_user} ${vc_password}
Destroy VM OOB
[Arguments] ${vm}
${rc} ${output}= Run And Return Rc And Output govc vm.destroy "*-${vm}"
Should Be Equal As Integers ${rc} 0
Put Host Into Maintenance Mode
${rc} ${output}= Run And Return Rc And Output govc host.maintenance.enter -host.ip=%{TEST_URL}
Should Contain ${output} entering maintenance mode... OK
Remove Host From Maintenance Mode
${rc} ${output}= Run And Return Rc And Output govc host.maintenance.exit -host.ip=%{TEST_URL}
Should Contain ${output} exiting maintenance mode... OK
Reboot VM
[Arguments] ${vm} ${vc_host} ${vc_user} ${vc_password}
Log To Console Rebooting ${vm} ...
Power Off VM OOB ${vm} ${vc_host} ${vc_user} ${vc_password}
Power On VM OOB ${vm} ${vc_host} ${vc_user} ${vc_password}
Log To Console ${vm} Powered On
Reset VM
[Arguments] ${vm} ${vc_host} ${vc_user} ${vc_password}
${rc} ${output}= Run And Return Rc And Output GOVC_URL=${vc_host} GOVC_USERNAME=${vc_user} GOVC_PASSWORD=${vc_password} GOVC_INSECURE=1 govc vm.power -reset "${vm}"
Log To Console ${output}
Should Be Equal As Integers ${rc} 0
Log To Console Waiting for VM to reset ...
Wait Until VM Powers On "${vm}" ${vc_host} ${vc_user} ${vc_password}
Wait Until VM Powers On
[Arguments] ${vm} ${vc_host} ${vc_user} ${vc_password}
FOR ${idx} IN RANGE 0 30
${ret}= Run GOVC_URL=${vc_host} GOVC_USERNAME=${vc_user} GOVC_PASSWORD=${vc_password} GOVC_INSECURE=1 govc vm.info ${vm}
Set Test Variable ${out} ${ret}
${status}= Run Keyword And Return Status Should Contain ${out} poweredOn
Return From Keyword If ${status}
Sleep 1
END
Fail VM did not power on within 30 seconds
Wait Until VM Powers Off
[Arguments] ${vm} ${vc_host} ${vc_user} ${vc_password}
FOR ${idx} IN RANGE 0 30
${ret}= Run GOVC_URL=${vc_host} GOVC_USERNAME=${vc_user} GOVC_PASSWORD=${vc_password} GOVC_INSECURE=1 govc vm.info ${vm}
Set Test Variable ${out} ${ret}
${status}= Run Keyword And Return Status Should Contain ${out} poweredOff
Return From Keyword If ${status}
Sleep 1
END
Fail VM did not power off within 30 seconds
Wait Until VM Is Destroyed
[Arguments] ${vm}
:FOR ${idx} IN RANGE 0 30
\ ${ret}= Run govc ls vm/${vm}
\ Set Test Variable ${out} ${ret}
\ ${status}= Run Keyword And Return Status Should Be Empty ${out}
\ Return From Keyword If ${status}
\ Sleep 1
Fail VM was not destroyed within 30 seconds
Get VM IP
[Arguments] ${vm}
${rc} ${out}= Run And Return Rc And Output govc vm.ip ${vm}
Should Be Equal As Integers ${rc} 0
[Return] ${out}
Get VM Host Name
[Arguments] ${vm}
${out}= Run govc vm.info ${vm}
${out}= Split To Lines ${out}
${host}= Fetch From Right @{out}[-1] ${SPACE}
[Return] ${host}
Get VM Info
[Arguments] ${vm}
${rc} ${out}= Run And Return Rc And Output govc vm.info -r ${vm}
Should Be Equal As Integers ${rc} 0
[Return] ${out}
vMotion A VM
[Arguments] ${vm}
${host}= Get VM Host Name ${vm}
${status}= Run Keyword And Return Status Should Contain ${host} ${esx1-ip}
Run Keyword If ${status} Run govc vm.migrate -host cls/${esx2-ip} -pool cls/Resources ${vm}
Run Keyword Unless ${status} Run govc vm.migrate -host cls/${esx1-ip} -pool cls/Resources ${vm}
Create Test Server Snapshot
[Arguments] ${vm} ${snapshot}
Set Environment Variable GOVC_URL %{BUILD_SERVER}
${rc} ${out}= Run And Return Rc And Output govc snapshot.create -vm ${vm} ${snapshot}
Should Be Equal As Integers ${rc} 0
Should Be Empty ${out}
Set Environment Variable GOVC_URL %{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}
Revert Test Server Snapshot
[Arguments] ${vm} ${snapshot}
Set Environment Variable GOVC_URL %{BUILD_SERVER}
${rc} ${out}= Run And Return Rc And Output govc snapshot.revert -vm ${vm} ${snapshot}
Should Be Equal As Integers ${rc} 0
Should Be Empty ${out}
Set Environment Variable GOVC_URL %{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}
Delete Test Server Snapshot
[Arguments] ${vm} ${snapshot}
Set Environment Variable GOVC_URL %{BUILD_SERVER}
${rc} ${out}= Run And Return Rc And Output govc snapshot.remove -vm ${vm} ${snapshot}
Should Be Equal As Integers ${rc} 0
Should Be Empty ${out}
Set Environment Variable GOVC_URL %{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}
Setup Snapshot
${hostname}= Get Test Server Hostname
Set Environment Variable TEST_HOSTNAME ${hostname}
Set Environment Variable SNAPSHOT vic-ci-test-%{DRONE_BUILD_NUMBER}
Create Test Server Snapshot %{TEST_HOSTNAME} %{SNAPSHOT}
Get Datacenter Name
${out}= Run govc datacenter.info
${out}= Split To Lines ${out}
${name}= Fetch From Right @{out}[0] ${SPACE}
[Return] ${name}
Get Test Server Hostname
[Tags] secret
${hostname}= Run sshpass -p $TEST_PASSWORD ssh $TEST_USERNAME@$TEST_URL hostname
[Return] ${hostname}
Check Delete Success
[Arguments] ${name}
${out}= Run govc ls vm
Log ${out}
Should Not Contain ${out} ${name}
${out}= Run govc datastore.ls
Log ${out}
Should Not Contain ${out} ${name}
${out}= Run govc ls host/*/Resources/*
Log ${out}
Should Not Contain ${out} ${name}
Gather Logs From ESX Server
Environment Variable Should Be Set TEST_URL
${out}= Run govc logs.download
Change Log Level On Server
[Arguments] ${level}
${out}= Run govc host.option.set Config.HostAgent.log.level ${level}
Should Be Empty ${out}
Add Vsphere License
[Tags] secret
[Arguments] ${license}
${out}= Run govc license.add ${license}
Should Contain ${out} Key:
Assign Vsphere License
[Tags] secret
[Arguments] ${license} ${host}
${out}= Run govc license.assign -host ${host} ${license}
Should Contain ${out} Key:
Add Host To VCenter
[Arguments] ${host} ${user} ${dc} ${pw}
:FOR ${idx} IN RANGE 1 4
\ ${out}= Run govc cluster.add -hostname=${host} -username=${user} -dc=${dc} -password=${pw} -noverify=true
\ ${status}= Run Keyword And Return Status Should Contain ${out} OK
\ Return From Keyword If ${status}
Fail Failed to add the host to the VC in 3 attempts
Get Host Firewall Enabled
${output}= Run govc host.esxcli network firewall get
Should Contain ${output} Enabled
@{output}= Split To Lines ${output}
:FOR ${line} IN @{output}
\ Run Keyword If "Enabled" in '''${line}''' Set Test Variable ${out} ${line}
${enabled}= Fetch From Right ${out} :
${enabled}= Strip String ${enabled}
Return From Keyword If '${enabled}' == 'false' ${false}
Return From Keyword If '${enabled}' == 'true' ${true}
Enable Host Firewall
Run govc host.esxcli network firewall set --enabled true
Disable Host Firewall
Run govc host.esxcli network firewall set --enabled false

View File

@ -27,7 +27,7 @@ Test Case - Registry Basic Verfication
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=true
Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=true
Push image ${ip} tester${d} Test1@34 project${d} busybox:latest
Pull image ${ip} tester${d} Test1@34 project${d} busybox:latest
Go Into Project project${d}

View File

@ -23,7 +23,7 @@ export DOCKER_CONTENT_TRUST_TAGGING_PASSPHRASE=$PASSHRASE
export NOTARY_AUTH=$(echo $USER:$PWD | base64)
echo $USER:$PWD
NOTARY_CMD_OPTIONS="notary -s https://$NOTARY_SERVER_ENDPOINT -d ~/.docker/trust"
NOTARY_CMD_OPTIONS="notary -s https://$NOTARY_SERVER_ENDPOINT -d /root/.docker/trust"
if [ "$CMD" == "key_rotate" ]; then
echo "$NOTARY_CMD_OPTIONS key rotate $HOST/$PROJECT/$IMAGE snapshot -r"
$NOTARY_CMD_OPTIONS key rotate $HOST/$PROJECT/$IMAGE snapshot -r

View File

@ -1,17 +1,16 @@
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
//
// 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.
# 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

View File

@ -1,17 +1,16 @@
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
//
// 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.
# 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

View File

@ -1,17 +1,16 @@
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
//
// 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.
# 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
@ -27,6 +26,25 @@ ${SSH_USER} root
${HARBOR_ADMIN} admin
*** Test Cases ***
Test Case - Customize Look
[tags] look
Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Retry Wait Element //span[contains(., 'Harbor product name')]
Retry Element Click ${header_user}
Retry Element Click ${about_btn}
Retry Wait Element //p[contains(., 'test customize look for harbor')]
Retry Element Click ${close_btn}
${style}= Get Element Attribute ${header} style
Log All ${style}
Should Contain ${style} background-color: red
Retry Element Click ${color_theme_light}
Sleep 2
${style}= Get Element Attribute ${header} style
Log All ${style}
Should Contain ${style} background-color: yellow
Close Browser
Test Case - Sign With Admin
[tags] admin
Init Chrome Driver

View File

@ -1,17 +1,16 @@
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
//
// 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.
# 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

View File

@ -33,20 +33,20 @@ Test Case - Create An New User
Enable Self Reg
Logout Harbor
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=harbortest newPassword=Test1@34 comment=harbortest
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=harbortest newPassword=Test1@34 comment=harbortest
Close Browser
Test Case - Update User Comment
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=harbortest newPassword=Test1@34 comment=harbortest
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=harbortest newPassword=Test1@34 comment=harbortest
Update User Comment Test12#4
Logout Harbor
Test Case - Update Password
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=harbortest newPassword=Test1@34 comment=harbortest
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=harbortest newPassword=Test1@34 comment=harbortest
Change Password Test1@34 Test12#4
Logout Harbor
Sign In Harbor ${HARBOR_URL} tester${d} Test12#4
@ -55,11 +55,11 @@ Test Case - Update Password
Test Case - Delete Multi User
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Create An New User ${HARBOR_URL} deletea${d} testa${d}@vmware.com test${d} Test1@34 harbor
Create An New User ${HARBOR_URL} deletea${d} testa${d}@harbortest.com test${d} Test1@34 harbor
Logout Harbor
Create An New User ${HARBOR_URL} deleteb${d} testb${d}@vmware.com test${d} Test1@34 harbor
Create An New User ${HARBOR_URL} deleteb${d} testb${d}@harbortest.com test${d} Test1@34 harbor
Logout Harbor
Create An New User ${HARBOR_URL} deletec${d} testc${d}@vmware.com test${d} Test1@34 harbor
Create An New User ${HARBOR_URL} deletec${d} testc${d}@harbortest.com test${d} Test1@34 harbor
Logout Harbor
Sign In Harbor ${HARBOR_URL} admin Harbor12345
Switch To User Tag
@ -95,7 +95,7 @@ Test Case - Admin Add New Users
Switch To Configure
Self Reg Should Be Enabled
Switch to User Tag
Add A New User username=tester${d} email=tester${d}@vmware.com realname=harbortest newPassword=Test1@34 comment=harbortest
Add A New User username=tester${d} email=tester${d}@harbortest.com realname=harbortest newPassword=Test1@34 comment=harbortest
# can add a new user when self-reg is disabled
Switch To Configure
Self Reg Should Be Enabled
@ -103,5 +103,5 @@ Test Case - Admin Add New Users
Disable Self Reg
Self Reg Should Be Disabled
Switch to User Tag
Add A New User username=tester2${d} email=tester2${d}@vmware.com realname=harbortest2 newPassword=Test1@34 comment=harbortest2
Add A New User username=tester2${d} email=tester2${d}@harbortest.com realname=harbortest2 newPassword=Test1@34 comment=harbortest2
Close Browser

View File

@ -1,17 +1,16 @@
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
//
// 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.
# 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

View File

@ -1,17 +1,16 @@
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
//
// 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.
# 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

View File

@ -21,7 +21,6 @@ Default Tags Nightly
Test Suites Setup For UI Test
[Tags] setup
Nightly Test Setup In Ubuntu ${ip} ${HARBOR_PASSWORD} ${ip1}
Setup API Test
Test Case - Get Harbor Version
#Just get harbor version and log it

View File

@ -1,17 +1,16 @@
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
//
// 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.
# 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

View File

@ -1,16 +1,16 @@
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
//
// 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.
# 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

View File

@ -1,17 +1,16 @@
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
//
// 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.
# 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

View File

@ -56,7 +56,7 @@ Exe Regression Test Cases
# New user, new project, push image, pull image
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false
Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false
${rand}= Evaluate random.randint(0, 1) modules=random
Run Keyword If '${rand}' == '0' Generate Prepared Image ${ip} tester${d} project${d}

View File

@ -124,7 +124,7 @@ class HarborAPI:
raise Exception(r"Error: Feature {} has no branch {}.".format(sys._getframe().f_code.co_name, branch))
def create_user(self, username):
payload = {"username":username, "email":username+"@vmware.com", "password":"Harbor12345", "realname":username, "comment":"string"}
payload = {"username":username, "email":username+"@harbortest.com", "password":"Harbor12345", "realname":username, "comment":"string"}
body=dict(body=payload)
request(url+"users", 'post', **body)