Skip to content

Commit

Permalink
Fix notary trust directory issue and add login for each base image in…
Browse files Browse the repository at this point in the history
… makefile

1. Use root instead of ~ in notary parameter;
2. Fix tag immutability issue caused by GUI change;
3. Replace email domain name to harbor test;
4. Add login for each base image in makefile;
5. Add customize look test in nightly.

Signed-off-by: danfengliu <danfengl@vmware.com>
  • Loading branch information
danfengliu committed May 20, 2021
1 parent 4492e47 commit 3ef4dc1
Show file tree
Hide file tree
Showing 33 changed files with 198 additions and 1,346 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -407,11 +407,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 ; \
Expand Down
29 changes: 28 additions & 1 deletion make/pushimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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"
Expand All @@ -124,4 +152,3 @@ if [ $? -ne 0 ];then
else
success "Clean local goharbor images succeeded";
fi

2 changes: 1 addition & 1 deletion tests/apitests/python/library/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def create_user(self, name=None,
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)
Expand Down
2 changes: 1 addition & 1 deletion tests/apitests/python/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
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

Expand Down
6 changes: 5 additions & 1 deletion tests/resources/APITest-Util.robot
Original file line number Diff line number Diff line change
@@ -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
Expand Down
31 changes: 0 additions & 31 deletions tests/resources/Drone-Util.robot

This file was deleted.

29 changes: 0 additions & 29 deletions tests/resources/Github-Util.robot

This file was deleted.

12 changes: 6 additions & 6 deletions tests/resources/Harbor-Pages/Configuration.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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']

Expand Down
1 change: 1 addition & 0 deletions tests/resources/Harbor-Pages/HomePage.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
5 changes: 5 additions & 0 deletions tests/resources/Harbor-Pages/HomePage_Elements.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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')]

2 changes: 1 addition & 1 deletion tests/resources/Harbor-Pages/OIDC_Auth.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
2 changes: 1 addition & 1 deletion tests/resources/Harbor-Pages/Project_Elements.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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')]
Expand Down
Loading

0 comments on commit 3ef4dc1

Please sign in to comment.