Add build base image step in build package git action workflow

Build base image step should be in build package workflow, and local base images build by new step should be removed since images have been pushed to docker hub.

Signed-off-by: danfengliu <danfengl@vmware.com>
This commit is contained in:
danfengliu 2021-04-08 15:32:31 +08:00
parent 5f0e7cfd62
commit f0ebd17994
86 changed files with 9825 additions and 9793 deletions

View File

@ -1,350 +1,350 @@
name: CI name: CI
env: env:
POSTGRESQL_HOST: localhost POSTGRESQL_HOST: localhost
POSTGRESQL_PORT: 5432 POSTGRESQL_PORT: 5432
POSTGRESQL_USR: postgres POSTGRESQL_USR: postgres
POSTGRESQL_PWD: root123 POSTGRESQL_PWD: root123
POSTGRESQL_DATABASE: registry POSTGRESQL_DATABASE: registry
DOCKER_COMPOSE_VERSION: 1.23.0 DOCKER_COMPOSE_VERSION: 1.23.0
HARBOR_ADMIN: admin HARBOR_ADMIN: admin
HARBOR_ADMIN_PASSWD: Harbor12345 HARBOR_ADMIN_PASSWD: Harbor12345
CORE_SECRET: tempString CORE_SECRET: tempString
KEY_PATH: "/data/secret/keys/secretkey" KEY_PATH: "/data/secret/keys/secretkey"
REDIS_HOST: localhost REDIS_HOST: localhost
REG_VERSION: v2.7.1-patch-2819-2553 REG_VERSION: v2.7.1-patch-2819-2553
UI_BUILDER_VERSION: 1.6.0 UI_BUILDER_VERSION: 1.6.0
on: on:
pull_request: pull_request:
push: push:
paths-ignore: paths-ignore:
- 'docs/**' - 'docs/**'
jobs: jobs:
UTTEST: UTTEST:
env: env:
UTTEST: true UTTEST: true
runs-on: runs-on:
#- self-hosted #- self-hosted
- ubuntu-latest - ubuntu-latest
timeout-minutes: 100 timeout-minutes: 100
steps: steps:
- name: Set up Go 1.14 - name: Set up Go 1.14
uses: actions/setup-go@v1 uses: actions/setup-go@v1
with: with:
go-version: 1.15.6 go-version: 1.15.6
id: go id: go
- name: setup Docker - name: setup Docker
uses: docker-practice/actions-setup-docker@0.0.1 uses: docker-practice/actions-setup-docker@0.0.1
with: with:
docker_version: 18.09 docker_version: 18.09
docker_channel: stable docker_channel: stable
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
path: src/github.com/goharbor/harbor path: src/github.com/goharbor/harbor
- name: setup env - name: setup env
run: | run: |
cd src/github.com/goharbor/harbor cd src/github.com/goharbor/harbor
pwd pwd
go env go env
echo "GOPATH=$(go env GOPATH):$GITHUB_WORKSPACE" >> $GITHUB_ENV echo "GOPATH=$(go env GOPATH):$GITHUB_WORKSPACE" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
echo "TOKEN_PRIVATE_KEY_PATH=${GITHUB_WORKSPACE}/src/github.com/goharbor/harbor/tests/private_key.pem" >> $GITHUB_ENV echo "TOKEN_PRIVATE_KEY_PATH=${GITHUB_WORKSPACE}/src/github.com/goharbor/harbor/tests/private_key.pem" >> $GITHUB_ENV
shell: bash shell: bash
- name: before_install - name: before_install
run: | run: |
set -x set -x
cd src/github.com/goharbor/harbor cd src/github.com/goharbor/harbor
pwd pwd
env env
#sudo apt install -y xvfb #sudo apt install -y xvfb
#xvfb-run ls #xvfb-run ls
curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
chmod +x docker-compose chmod +x docker-compose
sudo mv docker-compose /usr/local/bin sudo mv docker-compose /usr/local/bin
IP=`hostname -I | awk '{print $1}'` IP=`hostname -I | awk '{print $1}'`
echo '{"insecure-registries" : ["'$IP':5000"]}' | sudo tee /etc/docker/daemon.json echo '{"insecure-registries" : ["'$IP':5000"]}' | sudo tee /etc/docker/daemon.json
echo "IP=$IP" >> $GITHUB_ENV echo "IP=$IP" >> $GITHUB_ENV
sudo cp ./tests/harbor_ca.crt /usr/local/share/ca-certificates/ sudo cp ./tests/harbor_ca.crt /usr/local/share/ca-certificates/
sudo update-ca-certificates sudo update-ca-certificates
sudo service docker restart sudo service docker restart
- name: install - name: install
run: | run: |
cd src/github.com/goharbor/harbor cd src/github.com/goharbor/harbor
env env
df -h df -h
bash ./tests/showtime.sh ./tests/ci/ut_install.sh bash ./tests/showtime.sh ./tests/ci/ut_install.sh
- name: script - name: script
run: | run: |
echo IP: $IP echo IP: $IP
df -h df -h
cd src/github.com/goharbor/harbor cd src/github.com/goharbor/harbor
bash ./tests/showtime.sh ./tests/ci/ut_run.sh $IP bash ./tests/showtime.sh ./tests/ci/ut_run.sh $IP
df -h df -h
- name: Codecov For BackEnd - name: Codecov For BackEnd
uses: codecov/codecov-action@v1 uses: codecov/codecov-action@v1
with: with:
file: ./src/github.com/goharbor/harbor/profile.cov file: ./src/github.com/goharbor/harbor/profile.cov
flags: unittests flags: unittests
APITEST_DB: APITEST_DB:
env: env:
APITEST_DB: true APITEST_DB: true
runs-on: runs-on:
#- self-hosted #- self-hosted
- ubuntu-latest - ubuntu-latest
timeout-minutes: 100 timeout-minutes: 100
steps: steps:
- name: Set up Go 1.14 - name: Set up Go 1.14
uses: actions/setup-go@v1 uses: actions/setup-go@v1
with: with:
go-version: 1.15.6 go-version: 1.15.6
id: go id: go
- name: setup Docker - name: setup Docker
uses: docker-practice/actions-setup-docker@0.0.1 uses: docker-practice/actions-setup-docker@0.0.1
with: with:
docker_version: 18.09 docker_version: 18.09
docker_channel: stable docker_channel: stable
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
path: src/github.com/goharbor/harbor path: src/github.com/goharbor/harbor
- name: setup env - name: setup env
run: | run: |
cd src/github.com/goharbor/harbor cd src/github.com/goharbor/harbor
pwd pwd
go env go env
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
echo "GOPATH=$(go env GOPATH):$GITHUB_WORKSPACE" >> $GITHUB_ENV echo "GOPATH=$(go env GOPATH):$GITHUB_WORKSPACE" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
echo "TOKEN_PRIVATE_KEY_PATH=${GITHUB_WORKSPACE}/src/github.com/goharbor/harbor/tests/private_key.pem" >> $GITHUB_ENV echo "TOKEN_PRIVATE_KEY_PATH=${GITHUB_WORKSPACE}/src/github.com/goharbor/harbor/tests/private_key.pem" >> $GITHUB_ENV
IP=`hostname -I | awk '{print $1}'` IP=`hostname -I | awk '{print $1}'`
echo "IP=$IP" >> $GITHUB_ENV echo "IP=$IP" >> $GITHUB_ENV
shell: bash shell: bash
- name: before_install - name: before_install
run: | run: |
set -x set -x
cd src/github.com/goharbor/harbor cd src/github.com/goharbor/harbor
pwd pwd
env env
df -h df -h
#sudo apt install -y xvfb #sudo apt install -y xvfb
#xvfb-run ls #xvfb-run ls
curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
chmod +x docker-compose chmod +x docker-compose
sudo mv docker-compose /usr/local/bin sudo mv docker-compose /usr/local/bin
- name: install - name: install
run: | run: |
cd src/github.com/goharbor/harbor cd src/github.com/goharbor/harbor
env env
df -h df -h
docker system prune -a -f docker system prune -a -f
bash ./tests/showtime.sh ./tests/ci/api_common_install.sh $IP DB bash ./tests/showtime.sh ./tests/ci/api_common_install.sh $IP DB
- name: script - name: script
run: | run: |
cd src/github.com/goharbor/harbor cd src/github.com/goharbor/harbor
echo IP: $IP echo IP: $IP
df -h df -h
bash ./tests/showtime.sh ./tests/ci/api_run.sh DB $IP bash ./tests/showtime.sh ./tests/ci/api_run.sh DB $IP
df -h df -h
APITEST_DB_PROXY_CACHE: APITEST_DB_PROXY_CACHE:
env: env:
APITEST_DB: true APITEST_DB: true
runs-on: runs-on:
#- self-hosted #- self-hosted
- ubuntu-latest - ubuntu-latest
timeout-minutes: 100 timeout-minutes: 100
steps: steps:
- name: Set up Go 1.14 - name: Set up Go 1.14
uses: actions/setup-go@v1 uses: actions/setup-go@v1
with: with:
go-version: 1.15.6 go-version: 1.15.6
id: go id: go
- name: setup Docker - name: setup Docker
uses: docker-practice/actions-setup-docker@0.0.1 uses: docker-practice/actions-setup-docker@0.0.1
with: with:
docker_version: 18.09 docker_version: 18.09
docker_channel: stable docker_channel: stable
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
path: src/github.com/goharbor/harbor path: src/github.com/goharbor/harbor
- name: setup env - name: setup env
run: | run: |
cd src/github.com/goharbor/harbor cd src/github.com/goharbor/harbor
pwd pwd
go env go env
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
echo "GOPATH=$(go env GOPATH):$GITHUB_WORKSPACE" >> $GITHUB_ENV echo "GOPATH=$(go env GOPATH):$GITHUB_WORKSPACE" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
echo "TOKEN_PRIVATE_KEY_PATH=${GITHUB_WORKSPACE}/src/github.com/goharbor/harbor/tests/private_key.pem" >> $GITHUB_ENV echo "TOKEN_PRIVATE_KEY_PATH=${GITHUB_WORKSPACE}/src/github.com/goharbor/harbor/tests/private_key.pem" >> $GITHUB_ENV
IP=`hostname -I | awk '{print $1}'` IP=`hostname -I | awk '{print $1}'`
echo "IP=$IP" >> $GITHUB_ENV echo "IP=$IP" >> $GITHUB_ENV
shell: bash shell: bash
- name: before_install - name: before_install
run: | run: |
set -x set -x
cd src/github.com/goharbor/harbor cd src/github.com/goharbor/harbor
pwd pwd
env env
df -h df -h
#sudo apt install -y xvfb #sudo apt install -y xvfb
#xvfb-run ls #xvfb-run ls
curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
chmod +x docker-compose chmod +x docker-compose
sudo mv docker-compose /usr/local/bin sudo mv docker-compose /usr/local/bin
- name: install - name: install
run: | run: |
cd src/github.com/goharbor/harbor cd src/github.com/goharbor/harbor
env env
df -h df -h
docker system prune -a -f docker system prune -a -f
bash ./tests/showtime.sh ./tests/ci/api_common_install.sh $IP DB bash ./tests/showtime.sh ./tests/ci/api_common_install.sh $IP DB
- name: script - name: script
run: | run: |
cd src/github.com/goharbor/harbor cd src/github.com/goharbor/harbor
echo IP: $IP echo IP: $IP
df -h df -h
bash ./tests/showtime.sh ./tests/ci/api_run.sh PROXY_CACHE $IP bash ./tests/showtime.sh ./tests/ci/api_run.sh PROXY_CACHE $IP
df -h df -h
APITEST_LDAP: APITEST_LDAP:
env: env:
APITEST_LDAP: true APITEST_LDAP: true
runs-on: runs-on:
#- self-hosted #- self-hosted
- ubuntu-latest - ubuntu-latest
timeout-minutes: 100 timeout-minutes: 100
steps: steps:
- name: Set up Go 1.14 - name: Set up Go 1.14
uses: actions/setup-go@v1 uses: actions/setup-go@v1
with: with:
go-version: 1.15.6 go-version: 1.15.6
id: go id: go
- name: setup Docker - name: setup Docker
uses: docker-practice/actions-setup-docker@0.0.1 uses: docker-practice/actions-setup-docker@0.0.1
with: with:
docker_version: 18.09 docker_version: 18.09
docker_channel: stable docker_channel: stable
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
path: src/github.com/goharbor/harbor path: src/github.com/goharbor/harbor
- name: setup env - name: setup env
run: | run: |
cd src/github.com/goharbor/harbor cd src/github.com/goharbor/harbor
pwd pwd
go env go env
echo "GOPATH=$(go env GOPATH):$GITHUB_WORKSPACE" >> $GITHUB_ENV echo "GOPATH=$(go env GOPATH):$GITHUB_WORKSPACE" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
echo "TOKEN_PRIVATE_KEY_PATH=${GITHUB_WORKSPACE}/src/github.com/goharbor/harbor/tests/private_key.pem" >> $GITHUB_ENV echo "TOKEN_PRIVATE_KEY_PATH=${GITHUB_WORKSPACE}/src/github.com/goharbor/harbor/tests/private_key.pem" >> $GITHUB_ENV
IP=`hostname -I | awk '{print $1}'` IP=`hostname -I | awk '{print $1}'`
echo "IP=$IP" >> $GITHUB_ENV echo "IP=$IP" >> $GITHUB_ENV
shell: bash shell: bash
- name: before_install - name: before_install
run: | run: |
set -x set -x
cd src/github.com/goharbor/harbor cd src/github.com/goharbor/harbor
pwd pwd
env env
df -h df -h
#sudo apt install -y xvfb #sudo apt install -y xvfb
#xvfb-run ls #xvfb-run ls
curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
chmod +x docker-compose chmod +x docker-compose
sudo mv docker-compose /usr/local/bin sudo mv docker-compose /usr/local/bin
- name: install - name: install
run: | run: |
cd src/github.com/goharbor/harbor cd src/github.com/goharbor/harbor
env env
df -h df -h
bash ./tests/showtime.sh ./tests/ci/api_common_install.sh $IP LDAP bash ./tests/showtime.sh ./tests/ci/api_common_install.sh $IP LDAP
- name: script - name: script
run: | run: |
echo IP: $IP echo IP: $IP
df -h df -h
cd src/github.com/goharbor/harbor cd src/github.com/goharbor/harbor
bash ./tests/showtime.sh ./tests/ci/api_run.sh LDAP $IP bash ./tests/showtime.sh ./tests/ci/api_run.sh LDAP $IP
df -h df -h
OFFLINE: OFFLINE:
env: env:
OFFLINE: true OFFLINE: true
runs-on: runs-on:
#- self-hosted #- self-hosted
- ubuntu-latest - ubuntu-latest
timeout-minutes: 100 timeout-minutes: 100
steps: steps:
- name: Set up Go 1.14 - name: Set up Go 1.14
uses: actions/setup-go@v1 uses: actions/setup-go@v1
with: with:
go-version: 1.15.6 go-version: 1.15.6
id: go id: go
- name: setup Docker - name: setup Docker
uses: docker-practice/actions-setup-docker@0.0.1 uses: docker-practice/actions-setup-docker@0.0.1
with: with:
docker_version: 18.09 docker_version: 18.09
docker_channel: stable docker_channel: stable
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
path: src/github.com/goharbor/harbor path: src/github.com/goharbor/harbor
- name: setup env - name: setup env
run: | run: |
cd src/github.com/goharbor/harbor cd src/github.com/goharbor/harbor
pwd pwd
docker version docker version
go env go env
echo "GOPATH=$(go env GOPATH):$GITHUB_WORKSPACE" >> $GITHUB_ENV echo "GOPATH=$(go env GOPATH):$GITHUB_WORKSPACE" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
echo "TOKEN_PRIVATE_KEY_PATH=${GITHUB_WORKSPACE}/src/github.com/goharbor/harbor/tests/private_key.pem" >> $GITHUB_ENV echo "TOKEN_PRIVATE_KEY_PATH=${GITHUB_WORKSPACE}/src/github.com/goharbor/harbor/tests/private_key.pem" >> $GITHUB_ENV
shell: bash shell: bash
- name: before_install - name: before_install
run: | run: |
set -x set -x
cd src/github.com/goharbor/harbor cd src/github.com/goharbor/harbor
pwd pwd
env env
df -h df -h
#sudo apt install -y xvfb #sudo apt install -y xvfb
#xvfb-run ls #xvfb-run ls
curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
chmod +x docker-compose chmod +x docker-compose
sudo mv docker-compose /usr/local/bin sudo mv docker-compose /usr/local/bin
IP=`hostname -I | awk '{print $1}'` IP=`hostname -I | awk '{print $1}'`
echo '{"insecure-registries" : ["'$IP':5000"]}' | sudo tee /etc/docker/daemon.json echo '{"insecure-registries" : ["'$IP':5000"]}' | sudo tee /etc/docker/daemon.json
echo "IP=$IP" >> $GITHUB_ENV echo "IP=$IP" >> $GITHUB_ENV
sudo cp ./tests/harbor_ca.crt /usr/local/share/ca-certificates/ sudo cp ./tests/harbor_ca.crt /usr/local/share/ca-certificates/
sudo update-ca-certificates sudo update-ca-certificates
sudo service docker restart sudo service docker restart
- name: script - name: script
run: | run: |
echo IP: $IP echo IP: $IP
df -h df -h
cd src/github.com/goharbor/harbor cd src/github.com/goharbor/harbor
bash ./tests/showtime.sh ./tests/ci/distro_installer.sh bash ./tests/showtime.sh ./tests/ci/distro_installer.sh
df -h df -h
UI_UT: UI_UT:
env: env:
UI_UT: true UI_UT: true
runs-on: runs-on:
#- self-hosted #- self-hosted
- ubuntu-latest - ubuntu-latest
timeout-minutes: 100 timeout-minutes: 100
steps: steps:
- uses: actions/setup-node@v1 - uses: actions/setup-node@v1
with: with:
node-version: '10.16.2' node-version: '10.16.2'
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
path: src/github.com/goharbor/harbor path: src/github.com/goharbor/harbor
- name: script - name: script
run: | run: |
echo IP: $IP echo IP: $IP
df -h df -h
cd src/github.com/goharbor/harbor cd src/github.com/goharbor/harbor
bash ./tests/showtime.sh ./tests/ci/ui_ut_run.sh bash ./tests/showtime.sh ./tests/ci/ui_ut_run.sh
df -h df -h
- name: Codecov For UI - name: Codecov For UI
uses: codecov/codecov-action@v1 uses: codecov/codecov-action@v1
with: with:
file: ./src/github.com/goharbor/harbor/src/portal/coverage/lcov.info file: ./src/github.com/goharbor/harbor/src/portal/coverage/lcov.info
flags: unittests flags: unittests

View File

@ -1,111 +1,128 @@
name: "Build Package Workflow" name: "Build Package Workflow"
env: env:
DOCKER_COMPOSE_VERSION: 1.23.0 DOCKER_COMPOSE_VERSION: 1.23.0
on: on:
push: push:
branches: branches:
- master - master
- release-* - release-*
tags: tags:
- v* - v*
jobs: jobs:
BUILD_PACKAGE: BUILD_PACKAGE:
env: env:
BUILD_PACKAGE: true BUILD_PACKAGE: true
runs-on: runs-on:
#- self-hosted #- self-hosted
- ubuntu-latest - ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master - uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with: with:
version: '285.0.0' version: '285.0.0'
project_id: ${{ secrets.GCP_PROJECT_ID }} project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_email: ${{ secrets.GCP_SA_EMAIL }} service_account_email: ${{ secrets.GCP_SA_EMAIL }}
service_account_key: ${{ secrets.GCP_SA_KEY }} service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true export_default_credentials: true
- run: gcloud info - run: gcloud info
- name: Set up Go 1.14 - name: Set up Go 1.14
uses: actions/setup-go@v1 uses: actions/setup-go@v1
with: with:
go-version: 1.15.6 go-version: 1.15.6
id: go id: go
- name: setup Docker - name: setup Docker
uses: docker-practice/actions-setup-docker@0.0.1 uses: docker-practice/actions-setup-docker@0.0.1
with: with:
docker_version: 18.09 docker_version: 18.09
docker_channel: stable docker_channel: stable
- uses: actions/checkout@v2 - uses: actions/checkout@v2.1.0
with: - uses: jitterbit/get-changed-files@v1
path: src/github.com/goharbor/harbor id: changed-files
- name: Build Package with:
run: | format: space-delimited
set -x token: ${{ secrets.GITHUB_TOKEN }}
env - uses: actions/checkout@v2
df -h with:
harbor_target_bucket="" path: src/github.com/goharbor/harbor
target_branch="$(echo ${GITHUB_REF#refs/heads/})" - name: Build Dev Base Image
harbor_offline_build_bundle="" if: contains(steps.changed-files.outputs.modified, 'Dockerfile.base') && contains(github.ref, 'master')
harbor_online_build_bundle="" run: |
harbor_logs_bucket="harbor-ci-logs" set -x
harbor_builds_bucket="harbor-builds" base_image_tag=$(cat ./VERSION)
harbor_releases_bucket="harbor-releases" echo "Start to build base image for dev ......"
harbor_ci_pipeline_store_bucket="harbor-ci-pipeline-store/latest" cd src/github.com/goharbor/harbor
# the target release version is the version of next release(RC or GA). It needs to be updated on creating new release branch. 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
target_release_version=$(cat ./VERSION) - name: Build Release Base Image
Harbor_Package_Version=$target_release_version-'build.'$GITHUB_RUN_NUMBER if: contains(steps.changed-files.outputs.modified, 'VERSION')
run: |
if [[ $target_branch == "master" ]]; then set -x
Harbor_Assets_Version=$Harbor_Package_Version base_image_tag=$(cat ./VERSION)
else echo "Start to build base image for release $(base_image_tag) ......"
Harbor_Assets_Version=$target_release_version cd src/github.com/goharbor/harbor
fi 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
- name: Build Package
if [[ $target_branch == "release-"* ]]; then run: |
Harbor_Build_Base_Tag=$target_release_version set -x
else env
Harbor_Build_Base_Tag=dev df -h
fi harbor_target_bucket=""
target_branch="$(echo ${GITHUB_REF#refs/heads/})"
if [[ $target_branch == "master" ]]; then harbor_offline_build_bundle=""
harbor_target_bucket=$harbor_builds_bucket harbor_online_build_bundle=""
else harbor_logs_bucket="harbor-ci-logs"
harbor_target_bucket=$harbor_releases_bucket/$target_branch harbor_builds_bucket="harbor-builds"
fi harbor_releases_bucket="harbor-releases"
harbor_ci_pipeline_store_bucket="harbor-ci-pipeline-store/latest"
cd src/github.com/goharbor/harbor # the target release version is the version of next release(RC or GA). It needs to be updated on creating new release branch.
sudo make package_offline GOBUILDTAGS="include_oss include_gcs" BASEIMAGETAG=${Harbor_Build_Base_Tag} VERSIONTAG=${Harbor_Assets_Version} PKGVERSIONTAG=${Harbor_Package_Version} BUILDBIN=true NOTARYFLAG=true CHARTFLAG=true TRIVYFLAG=true HTTPPROXY= target_release_version=$(cat ./VERSION)
sudo make package_online GOBUILDTAGS="include_oss include_gcs" BASEIMAGETAG=${Harbor_Build_Base_Tag} VERSIONTAG=${Harbor_Assets_Version} PKGVERSIONTAG=${Harbor_Package_Version} BUILDBIN=true NOTARYFLAG=true CHARTFLAG=true TRIVYFLAG=true HTTPPROXY= Harbor_Package_Version=$target_release_version-'build.'$GITHUB_RUN_NUMBER
harbor_offline_build_bundle=$(basename harbor-offline-installer-*.tgz)
harbor_online_build_bundle=$(basename harbor-online-installer-*.tgz) if [[ $target_branch == "master" ]]; then
echo "Package name is: $harbor_offline_build_bundle" Harbor_Assets_Version=$Harbor_Package_Version
echo "Package name is: $harbor_online_build_bundle" harbor_target_bucket=$harbor_builds_bucket
else
echo -en "${{ secrets.HARBOR_SIGN_KEY }}" | gpg --import Harbor_Assets_Version=$target_release_version
gpg -v -ab -u ${{ secrets.HARBOR_SIGN_KEY_ID }} $harbor_offline_build_bundle harbor_target_bucket=$harbor_releases_bucket/$target_branch
gpg -v -ab -u ${{ secrets.HARBOR_SIGN_KEY_ID }} $harbor_online_build_bundle fi
source tests/ci/build_util.sh if [[ $target_branch == "release-"* ]]; then
cp ${harbor_offline_build_bundle} harbor-offline-installer-latest.tgz Harbor_Build_Base_Tag=$target_release_version
cp ${harbor_offline_build_bundle}.asc harbor-offline-installer-latest.tgz.asc else
uploader ${harbor_offline_build_bundle} $harbor_target_bucket Harbor_Build_Base_Tag=dev
uploader ${harbor_offline_build_bundle}.asc $harbor_target_bucket fi
uploader ${harbor_online_build_bundle} $harbor_target_bucket
uploader ${harbor_online_build_bundle}.asc $harbor_target_bucket cd src/github.com/goharbor/harbor
uploader harbor-offline-installer-latest.tgz $harbor_target_bucket sudo make package_offline GOBUILDTAGS="include_oss include_gcs" BASEIMAGETAG=${Harbor_Build_Base_Tag} VERSIONTAG=${Harbor_Assets_Version} PKGVERSIONTAG=${Harbor_Package_Version} BUILDBIN=true NOTARYFLAG=true CHARTFLAG=true TRIVYFLAG=true HTTPPROXY=
uploader harbor-offline-installer-latest.tgz.asc $harbor_target_bucket sudo make package_online GOBUILDTAGS="include_oss include_gcs" BASEIMAGETAG=${Harbor_Build_Base_Tag} VERSIONTAG=${Harbor_Assets_Version} PKGVERSIONTAG=${Harbor_Package_Version} BUILDBIN=true NOTARYFLAG=true CHARTFLAG=true TRIVYFLAG=true HTTPPROXY=
echo "BUILD_BUNDLE=$harbor_offline_build_bundle" >> $GITHUB_ENV harbor_offline_build_bundle=$(basename harbor-offline-installer-*.tgz)
harbor_online_build_bundle=$(basename harbor-online-installer-*.tgz)
publishImage $target_branch $Harbor_Assets_Version "${{ secrets.DOCKER_HUB_USERNAME }}" "${{ secrets.DOCKER_HUB_PASSWORD }}" echo "Package name is: $harbor_offline_build_bundle"
echo "Package name is: $harbor_online_build_bundle"
- name: Slack Notification
uses: sonots/slack-notice-action@v3 echo -en "${{ secrets.HARBOR_SIGN_KEY }}" | gpg --import
with: gpg -v -ab -u ${{ secrets.HARBOR_SIGN_KEY_ID }} $harbor_offline_build_bundle
status: ${{ job.status }} gpg -v -ab -u ${{ secrets.HARBOR_SIGN_KEY_ID }} $harbor_online_build_bundle
title: Build Package - ${{ env.BUILD_BUNDLE }}
env: source tests/ci/build_util.sh
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} cp ${harbor_offline_build_bundle} harbor-offline-installer-latest.tgz
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} cp ${harbor_offline_build_bundle}.asc harbor-offline-installer-latest.tgz.asc
if: always() uploader ${harbor_offline_build_bundle} $harbor_target_bucket
uploader ${harbor_offline_build_bundle}.asc $harbor_target_bucket
uploader ${harbor_online_build_bundle} $harbor_target_bucket
uploader ${harbor_online_build_bundle}.asc $harbor_target_bucket
uploader harbor-offline-installer-latest.tgz $harbor_target_bucket
uploader harbor-offline-installer-latest.tgz.asc $harbor_target_bucket
echo "BUILD_BUNDLE=$harbor_offline_build_bundle" >> $GITHUB_ENV
publishImage $target_branch $Harbor_Assets_Version "${{ secrets.DOCKER_HUB_USERNAME }}" "${{ secrets.DOCKER_HUB_PASSWORD }}"
- name: Slack Notification
uses: sonots/slack-notice-action@v3
with:
status: ${{ job.status }}
title: Build Package - ${{ env.BUILD_BUNDLE }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
if: always()

2
.gitignore vendored
View File

@ -48,3 +48,5 @@ src/core/conf/app.conf
src/server/v2.0/models/ src/server/v2.0/models/
src/server/v2.0/restapi/ src/server/v2.0/restapi/
.editorconfig

View File

@ -112,3 +112,16 @@ if [ $? -ne 0 ];then
else else
success "Pushing image $IMAGE succeeded"; success "Pushing image $IMAGE succeeded";
fi fi
h2 "Remove local goharbor images"
DOCKER_RMI="docker rmi -f $(docker images | grep "goharbor" | awk '{print $3}')"
info "$DOCKER_RMI"
DOCKER_RMI_OUTPUT=$($DOCKER_RMI)
if [ $? -ne 0 ];then
warn $DOCKER_RMI_OUTPUT
error "Clean local goharbor images failed";
else
success "Clean local goharbor images succeeded";
fi

View File

@ -1,250 +1,250 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import base import base
import subprocess import subprocess
import json import json
from testutils import DOCKER_USER, DOCKER_PWD, BASE_IMAGE, BASE_IMAGE_ABS_PATH_NAME from testutils import DOCKER_USER, DOCKER_PWD, BASE_IMAGE, BASE_IMAGE_ABS_PATH_NAME
try: try:
import docker import docker
except ImportError: except ImportError:
import pip import pip
pip.main(['install', 'docker']) pip.main(['install', 'docker'])
import docker import docker
def docker_info_display(): def docker_info_display():
command = ["docker", "info", "-f", "'{{.OSType}}/{{.Architecture}}'"] command = ["docker", "info", "-f", "'{{.OSType}}/{{.Architecture}}'"]
print("Docker Info: ", command) print("Docker Info: ", command)
ret = base.run_command(command) ret = base.run_command(command)
print("Command return: ", ret) print("Command return: ", ret)
def docker_login_cmd(harbor_host, username, password, cfg_file = "./tests/apitests/python/update_docker_cfg.sh", enable_manifest = True): def docker_login_cmd(harbor_host, username, password, cfg_file = "./tests/apitests/python/update_docker_cfg.sh", enable_manifest = True):
if username == "" or password == "": if username == "" or password == "":
print("[Warnig]: No docker credential was provided.") print("[Warnig]: No docker credential was provided.")
return return
command = ["docker", "login", harbor_host, "-u", username, "-p", password] command = ["docker", "login", harbor_host, "-u", username, "-p", password]
print( "Docker Login Command: ", command) print( "Docker Login Command: ", command)
base.run_command(command) base.run_command(command)
if enable_manifest == True: if enable_manifest == True:
try: try:
ret = subprocess.check_output([cfg_file], shell=False) ret = subprocess.check_output([cfg_file], shell=False)
print("docker login cmd ret:", ret) print("docker login cmd ret:", ret)
except subprocess.CalledProcessError as exc: except subprocess.CalledProcessError as exc:
raise Exception("Failed to update docker config, error is {} {}.".format(exc.returncode, exc.output)) raise Exception("Failed to update docker config, error is {} {}.".format(exc.returncode, exc.output))
def docker_manifest_create(index, manifests): def docker_manifest_create(index, manifests):
command = ["docker","manifest","create", "--amend", index] command = ["docker","manifest","create", "--amend", index]
command.extend(manifests) command.extend(manifests)
print( "Docker Manifest Command: ", command) print( "Docker Manifest Command: ", command)
base.run_command(command) base.run_command(command)
def docker_images_all_list(): def docker_images_all_list():
command = ["docker","images","-a"] command = ["docker","images","-a"]
base.run_command(command) base.run_command(command)
def docker_load_image(image): def docker_load_image(image):
command = ["docker","load","-i", image] command = ["docker","load","-i", image]
base.run_command(command) base.run_command(command)
def docker_image_clean_all(): def docker_image_clean_all():
docker_images_all_list() docker_images_all_list()
command = ["docker rmi -f $(docker images -a -q)"] command = ["docker rmi -f $(docker images -a -q)"]
base.run_command_with_popen(command) base.run_command_with_popen(command)
command = ["docker","system", "prune", "-a", "-f"] command = ["docker","system", "prune", "-a", "-f"]
base.run_command(command) base.run_command(command)
docker_images_all_list() docker_images_all_list()
def docker_manifest_push(index): def docker_manifest_push(index):
command = ["docker","manifest","push",index] command = ["docker","manifest","push",index]
print( "Docker Manifest Command: ", command) print( "Docker Manifest Command: ", command)
ret = base.run_command(command) ret = base.run_command(command)
index_sha256="" index_sha256=""
manifest_list=[] manifest_list=[]
for line in ret.split("\n"): for line in ret.split("\n"):
if line[:7] == "sha256:": if line[:7] == "sha256:":
index_sha256 = line index_sha256 = line
if line.find('Pushed ref') == 0: if line.find('Pushed ref') == 0:
manifest_list.append(line[-71:]) manifest_list.append(line[-71:])
return index_sha256, manifest_list return index_sha256, manifest_list
def docker_manifest_push_to_harbor(index, manifests, harbor_server, username, password, cfg_file = "./tests/apitests/python/update_docker_cfg.sh"): def docker_manifest_push_to_harbor(index, manifests, harbor_server, username, password, cfg_file = "./tests/apitests/python/update_docker_cfg.sh"):
docker_login_cmd(harbor_server, username, password, cfg_file=cfg_file) docker_login_cmd(harbor_server, username, password, cfg_file=cfg_file)
docker_manifest_create(index, manifests) docker_manifest_create(index, manifests)
return docker_manifest_push(index) return docker_manifest_push(index)
def list_repositories(harbor_host, username, password, n = None, last = None): def list_repositories(harbor_host, username, password, n = None, last = None):
if n is not None and last is not None: if n is not None and last is not None:
command = ["curl", "-s", "-u", username+":"+password, "https://"+harbor_host+"/v2/_catalog"+"?n=%d"%n+"&last="+last, "--insecure"] command = ["curl", "-s", "-u", username+":"+password, "https://"+harbor_host+"/v2/_catalog"+"?n=%d"%n+"&last="+last, "--insecure"]
elif n is not None: elif n is not None:
command = ["curl", "-s", "-u", username+":"+password, "https://"+harbor_host+"/v2/_catalog"+"?n=%d"%n, "--insecure"] command = ["curl", "-s", "-u", username+":"+password, "https://"+harbor_host+"/v2/_catalog"+"?n=%d"%n, "--insecure"]
else: else:
command = ["curl", "-s", "-u", username+":"+password, "https://"+harbor_host+"/v2/_catalog", "--insecure"] command = ["curl", "-s", "-u", username+":"+password, "https://"+harbor_host+"/v2/_catalog", "--insecure"]
print( "List Repositories Command: ", command) print( "List Repositories Command: ", command)
ret = base.run_command(command) ret = base.run_command(command)
repos = json.loads(ret).get("repositories","") repos = json.loads(ret).get("repositories","")
return repos return repos
def list_image_tags(harbor_host, repository, username, password, n = None, last = None): def list_image_tags(harbor_host, repository, username, password, n = None, last = None):
if n is not None and last is not None: if n is not None and last is not None:
command = ["curl", "-s", "-u", username+":"+password, "https://"+harbor_host+"/v2/"+repository+"/tags/list"+"?n=%d"%n+"&last="+last, "--insecure"] command = ["curl", "-s", "-u", username+":"+password, "https://"+harbor_host+"/v2/"+repository+"/tags/list"+"?n=%d"%n+"&last="+last, "--insecure"]
elif n is not None: elif n is not None:
command = ["curl", "-s", "-u", username+":"+password, "https://"+harbor_host+"/v2/"+repository+"/tags/list"+"?n=%d"%n, "--insecure"] command = ["curl", "-s", "-u", username+":"+password, "https://"+harbor_host+"/v2/"+repository+"/tags/list"+"?n=%d"%n, "--insecure"]
else: else:
command = ["curl", "-s", "-u", username+":"+password, "https://"+harbor_host+"/v2/"+repository+"/tags/list", "--insecure"] command = ["curl", "-s", "-u", username+":"+password, "https://"+harbor_host+"/v2/"+repository+"/tags/list", "--insecure"]
print( "List Image Tags Command: ", command) print( "List Image Tags Command: ", command)
ret = base.run_command(command) ret = base.run_command(command)
tags = json.loads(ret).get("tags","") tags = json.loads(ret).get("tags","")
return tags return tags
class DockerAPI(object): class DockerAPI(object):
def __init__(self): def __init__(self):
self.DCLIENT = docker.APIClient(base_url='unix://var/run/docker.sock',version='auto',timeout=30) self.DCLIENT = docker.APIClient(base_url='unix://var/run/docker.sock',version='auto',timeout=30)
self.DCLIENT2 = docker.from_env() self.DCLIENT2 = docker.from_env()
def docker_login(self, registry, username, password, expected_error_message = None): def docker_login(self, registry, username, password, expected_error_message = None):
ret = "" ret = ""
err_message = "" err_message = ""
if username == "" or password == "": if username == "" or password == "":
print("[Warnig]: No docker credential was provided.") print("[Warnig]: No docker credential was provided.")
return return
if expected_error_message == "": if expected_error_message == "":
expected_error_message = None expected_error_message = None
if registry == "docker": if registry == "docker":
registry = None registry = None
try: try:
print("Docker login: {}:{}:{}".format(registry,username,password)) print("Docker login: {}:{}:{}".format(registry,username,password))
ret = self.DCLIENT.login(registry = registry, username=username, password=password) ret = self.DCLIENT.login(registry = registry, username=username, password=password)
except Exception as err: except Exception as err:
print( "Docker image pull catch exception:", str(err)) print( "Docker image pull catch exception:", str(err))
err_message = str(err) err_message = str(err)
if expected_error_message is None: if expected_error_message is None:
raise Exception(r" Docker pull image {} failed, error is [{}]".format (image, str(err))) raise Exception(r" Docker pull image {} failed, error is [{}]".format (image, str(err)))
else: else:
print("Docker image login did not catch exception and return message is:", ret) print("Docker image login did not catch exception and return message is:", ret)
err_message = ret err_message = ret
finally: finally:
if expected_error_message is not None: if expected_error_message is not None:
if str(err_message).lower().find(expected_error_message.lower()) < 0: if str(err_message).lower().find(expected_error_message.lower()) < 0:
raise Exception(r" Failed to catch error [{}] when login registry {}, return message: {}".format (expected_error_message, registry, err_message)) raise Exception(r" Failed to catch error [{}] when login registry {}, return message: {}".format (expected_error_message, registry, err_message))
else: else:
print(r"Docker image login got expected error message:{}".format(expected_error_message)) print(r"Docker image login got expected error message:{}".format(expected_error_message))
else: else:
if str(err_message).lower().find("error".lower()) >= 0: if str(err_message).lower().find("error".lower()) >= 0:
raise Exception(r" It's was not suppose to catch error when login registry {}, return message is [{}]".format (registry, err_message)) raise Exception(r" It's was not suppose to catch error when login registry {}, return message is [{}]".format (registry, err_message))
def docker_image_pull(self, image, tag = None, expected_error_message = None, is_clean_all_img = True): def docker_image_pull(self, image, tag = None, expected_error_message = None, is_clean_all_img = True):
ret = "" ret = ""
err_message = "" err_message = ""
if tag is not None: if tag is not None:
_tag = tag _tag = tag
else: else:
_tag = "latest" _tag = "latest"
if expected_error_message == "": if expected_error_message == "":
expected_error_message = None expected_error_message = None
try: try:
ret = self.DCLIENT.pull(r'{}:{}'.format(image, _tag)) ret = self.DCLIENT.pull(r'{}:{}'.format(image, _tag))
except Exception as err: except Exception as err:
print( "Docker image pull catch exception:", str(err)) print( "Docker image pull catch exception:", str(err))
err_message = str(err) err_message = str(err)
if expected_error_message is None: if expected_error_message is None:
raise Exception(r" Docker pull image {} failed, error is [{}]".format (image, str(err))) raise Exception(r" Docker pull image {} failed, error is [{}]".format (image, str(err)))
else: else:
print("Docker image pull did not catch exception and return message is:", ret) print("Docker image pull did not catch exception and return message is:", ret)
err_message = ret err_message = ret
finally: finally:
if expected_error_message is not None: if expected_error_message is not None:
if str(err_message).lower().find(expected_error_message.lower()) < 0: if str(err_message).lower().find(expected_error_message.lower()) < 0:
raise Exception(r" Failed to catch error [{}] when pull image {}, return message: {}".format (expected_error_message, image, err_message)) raise Exception(r" Failed to catch error [{}] when pull image {}, return message: {}".format (expected_error_message, image, err_message))
else: else:
print(r"Docker image pull got expected error message:{}".format(expected_error_message)) print(r"Docker image pull got expected error message:{}".format(expected_error_message))
else: else:
if str(err_message).lower().find("error".lower()) >= 0: if str(err_message).lower().find("error".lower()) >= 0:
raise Exception(r" It's was not suppose to catch error when pull image {}, return message is [{}]".format (image, err_message)) raise Exception(r" It's was not suppose to catch error when pull image {}, return message is [{}]".format (image, err_message))
if is_clean_all_img: if is_clean_all_img:
docker_image_clean_all() docker_image_clean_all()
def docker_image_tag(self, image, harbor_registry, tag = None): def docker_image_tag(self, image, harbor_registry, tag = None):
_tag = base._random_name("tag") _tag = base._random_name("tag")
if tag is not None: if tag is not None:
_tag = tag _tag = tag
ret = "" ret = ""
try: try:
ret = self.DCLIENT.tag(image, harbor_registry, _tag, force=True) ret = self.DCLIENT.tag(image, harbor_registry, _tag, force=True)
print("Docker image tag commond return:", ret) print("Docker image tag commond return:", ret)
return harbor_registry, _tag return harbor_registry, _tag
except docker.errors.APIError as err: except docker.errors.APIError as err:
raise Exception(r" Docker tag image {} failed, error is [{}]".format (image, str(err))) raise Exception(r" Docker tag image {} failed, error is [{}]".format (image, str(err)))
def docker_image_push(self, harbor_registry, tag, expected_error_message = None): def docker_image_push(self, harbor_registry, tag, expected_error_message = None):
ret = "" ret = ""
err_message = "" err_message = ""
docker_images_all_list() docker_images_all_list()
if expected_error_message == "": if expected_error_message == "":
expected_error_message = None expected_error_message = None
try: try:
ret = self.DCLIENT.push(harbor_registry, tag) ret = self.DCLIENT.push(harbor_registry, tag)
except Exception as err: except Exception as err:
print( "Docker image push catch exception:", str(err)) print( "Docker image push catch exception:", str(err))
err_message = str(err) err_message = str(err)
if expected_error_message is None: if expected_error_message is None:
raise Exception(r" Docker push image {} failed, error is [{}]".format (image, str(err))) raise Exception(r" Docker push image {} failed, error is [{}]".format (image, str(err)))
else: else:
print("Docker image push did not catch exception and return message is:", ret) print("Docker image push did not catch exception and return message is:", ret)
err_message = ret err_message = ret
finally: finally:
if expected_error_message is not None: if expected_error_message is not None:
if str(err_message).lower().find(expected_error_message.lower()) < 0: if str(err_message).lower().find(expected_error_message.lower()) < 0:
raise Exception(r" Failed to catch error [{}] when push image {}, return message: {}".format (expected_error_message, harbor_registry, err_message)) raise Exception(r" Failed to catch error [{}] when push image {}, return message: {}".format (expected_error_message, harbor_registry, err_message))
else: else:
print(r"Docker image push got expected error message:{}".format(expected_error_message)) print(r"Docker image push got expected error message:{}".format(expected_error_message))
else: else:
if str(err_message).lower().find("error".lower()) >= 0: if str(err_message).lower().find("error".lower()) >= 0:
raise Exception(r" It's was not suppose to catch error when push image {}, return message is [{}]".format (harbor_registry, err_message)) raise Exception(r" It's was not suppose to catch error when push image {}, return message is [{}]".format (harbor_registry, err_message))
docker_images_all_list() docker_images_all_list()
def docker_image_build(self, harbor_registry, tags=None, size=1, expected_error_message = None): def docker_image_build(self, harbor_registry, tags=None, size=1, expected_error_message = None):
ret = "" ret = ""
err_message = "" err_message = ""
docker_images_all_list() docker_images_all_list()
try: try:
baseimage = BASE_IMAGE['name'] + ":" + BASE_IMAGE['tag'] baseimage = BASE_IMAGE['name'] + ":" + BASE_IMAGE['tag']
if not self.DCLIENT.images(name=baseimage): if not self.DCLIENT.images(name=baseimage):
print( "Docker load is triggered when building {}".format(harbor_registry)) print( "Docker load is triggered when building {}".format(harbor_registry))
docker_load_image(BASE_IMAGE_ABS_PATH_NAME) docker_load_image(BASE_IMAGE_ABS_PATH_NAME)
docker_images_all_list() docker_images_all_list()
c = self.DCLIENT.create_container(image=baseimage, c = self.DCLIENT.create_container(image=baseimage,
command='dd if=/dev/urandom of=test bs=1M count={}'.format(size)) command='dd if=/dev/urandom of=test bs=1M count={}'.format(size))
self.DCLIENT.start(c) self.DCLIENT.start(c)
self.DCLIENT.wait(c) self.DCLIENT.wait(c)
if not tags: if not tags:
tags=['latest'] tags=['latest']
firstrepo="{}:{}".format(harbor_registry, tags[0]) firstrepo="{}:{}".format(harbor_registry, tags[0])
#self.DCLIENT.commit(c, firstrepo) #self.DCLIENT.commit(c, firstrepo)
self.DCLIENT2.containers.get(c).commit(harbor_registry, tags[0]) self.DCLIENT2.containers.get(c).commit(harbor_registry, tags[0])
for tag in tags[1:]: for tag in tags[1:]:
repo="{}:{}".format(harbor_registry, tag) repo="{}:{}".format(harbor_registry, tag)
self.DCLIENT.tag(firstrepo, repo) self.DCLIENT.tag(firstrepo, repo)
for tag in tags: for tag in tags:
repo="{}:{}".format(harbor_registry, tag) repo="{}:{}".format(harbor_registry, tag)
ret = self.DCLIENT.push(repo) ret = self.DCLIENT.push(repo)
print("docker_image_push ret:", ret) print("docker_image_push ret:", ret)
print("build image {} with size {}".format(repo, size)) print("build image {} with size {}".format(repo, size))
self.DCLIENT.remove_container(c) self.DCLIENT.remove_container(c)
except Exception as err: except Exception as err:
print( "Docker image build catch exception:", str(err)) print( "Docker image build catch exception:", str(err))
err_message = str(err) err_message = str(err)
if expected_error_message is None: if expected_error_message is None:
raise Exception(r" Docker push image {} failed, error is [{}]".format (harbor_registry, str(err))) raise Exception(r" Docker push image {} failed, error is [{}]".format (harbor_registry, str(err)))
else: else:
print("Docker image build did not catch exception and return message is:", ret) print("Docker image build did not catch exception and return message is:", ret)
err_message = ret err_message = ret
finally: finally:
if expected_error_message is not None: if expected_error_message is not None:
if str(err_message).lower().find(expected_error_message.lower()) < 0: if str(err_message).lower().find(expected_error_message.lower()) < 0:
raise Exception(r" Failed to catch error [{}] when build image {}, return message: {}".format (expected_error_message, harbor_registry, err_message)) raise Exception(r" Failed to catch error [{}] when build image {}, return message: {}".format (expected_error_message, harbor_registry, err_message))
else: else:
print(r"Docker image build got expected error message: {}".format(expected_error_message)) print(r"Docker image build got expected error message: {}".format(expected_error_message))
else: else:
if str(err_message).lower().find("error".lower()) >= 0: if str(err_message).lower().find("error".lower()) >= 0:
raise Exception(r" It's was not suppose to catch error when build image {}, return message is [{}]".format (harbor_registry, err_message)) raise Exception(r" It's was not suppose to catch error when build image {}, return message is [{}]".format (harbor_registry, err_message))
docker_image_clean_all() docker_image_clean_all()

View File

@ -1,95 +1,95 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import base import base
import v2_swagger_client import v2_swagger_client
from v2_swagger_client.rest import ApiException from v2_swagger_client.rest import ApiException
class Tag_Immutability(base.Base, object): class Tag_Immutability(base.Base, object):
def __init__(self): def __init__(self):
super(Tag_Immutability,self).__init__(api_type = "immutable") super(Tag_Immutability,self).__init__(api_type = "immutable")
def create_tag_immutability_policy_rule(self, project_id, selector_repository_decoration = "repoMatches", def create_tag_immutability_policy_rule(self, project_id, selector_repository_decoration = "repoMatches",
selector_repository="**", selector_tag_decoration = "matches", selector_repository="**", selector_tag_decoration = "matches",
selector_tag="**", expect_status_code = 201, **kwargs): selector_tag="**", expect_status_code = 201, **kwargs):
#repoExcludes,excludes #repoExcludes,excludes
immutable_rule = v2_swagger_client.ImmutableRule( immutable_rule = v2_swagger_client.ImmutableRule(
action="immutable", action="immutable",
template="immutable_template", template="immutable_template",
priority = 0, priority = 0,
scope_selectors={ scope_selectors={
"repository": [ "repository": [
{ {
"kind": "doublestar", "kind": "doublestar",
"decoration": selector_repository_decoration, "decoration": selector_repository_decoration,
"pattern": selector_repository "pattern": selector_repository
} }
] ]
}, },
tag_selectors=[ tag_selectors=[
{ {
"kind": "doublestar", "kind": "doublestar",
"decoration": selector_tag_decoration, "decoration": selector_tag_decoration,
"pattern": selector_tag "pattern": selector_tag
} }
] ]
) )
try: try:
_, status_code, header = self._get_client(**kwargs).create_immu_rule_with_http_info(project_id, immutable_rule) _, status_code, header = self._get_client(**kwargs).create_immu_rule_with_http_info(project_id, immutable_rule)
except ApiException as e: except ApiException as e:
base._assert_status_code(expect_status_code, e.status) base._assert_status_code(expect_status_code, e.status)
else: else:
base._assert_status_code(expect_status_code, status_code) base._assert_status_code(expect_status_code, status_code)
base._assert_status_code(201, status_code) base._assert_status_code(201, status_code)
return base._get_id_from_header(header) return base._get_id_from_header(header)
def list_tag_immutability_policy_rules(self, project_id, **kwargs): def list_tag_immutability_policy_rules(self, project_id, **kwargs):
return self._get_client(**kwargs).list_immu_rules_with_http_info(project_id) return self._get_client(**kwargs).list_immu_rules_with_http_info(project_id)
def get_rule(self, project_id, rule_id, **kwargs): def get_rule(self, project_id, rule_id, **kwargs):
rules = self.list_tag_immutability_policy_rules(project_id, **kwargs) rules = self.list_tag_immutability_policy_rules(project_id, **kwargs)
if len(rules) <= 0: if len(rules) <= 0:
return None return None
for r in rules[0]: for r in rules[0]:
if r.id == rule_id: if r.id == rule_id:
return r return r
return None return None
def update_tag_immutability_policy_rule(self, project_id, rule_id, selector_repository_decoration = None, def update_tag_immutability_policy_rule(self, project_id, rule_id, selector_repository_decoration = None,
selector_repository=None, selector_tag_decoration = None, selector_repository=None, selector_tag_decoration = None,
selector_tag=None, disabled = None, expect_status_code = 200, **kwargs): selector_tag=None, disabled = None, expect_status_code = 200, **kwargs):
rule = self.get_rule( project_id, rule_id,**kwargs) rule = self.get_rule( project_id, rule_id,**kwargs)
if selector_repository_decoration: if selector_repository_decoration:
rule.scope_selectors["repository"][0].decoration = selector_repository_decoration rule.scope_selectors["repository"][0].decoration = selector_repository_decoration
if selector_repository: if selector_repository:
rule.scope_selectors["repository"][0].pattern = selector_repository rule.scope_selectors["repository"][0].pattern = selector_repository
if selector_tag_decoration: if selector_tag_decoration:
rule.tag_selectors[0].decoration = selector_tag_decoration rule.tag_selectors[0].decoration = selector_tag_decoration
if selector_tag: if selector_tag:
rule.tag_selectors[0].pattern = selector_tag rule.tag_selectors[0].pattern = selector_tag
if disabled is not None: if disabled is not None:
rule.disabled = disabled rule.disabled = disabled
try: try:
_, status_code, header = self._get_client(**kwargs).update_immu_rule_with_http_info(project_id, rule_id, rule) _, status_code, header = self._get_client(**kwargs).update_immu_rule_with_http_info(project_id, rule_id, rule)
except ApiException as e: except ApiException as e:
base._assert_status_code(expect_status_code, e.status) base._assert_status_code(expect_status_code, e.status)
if expect_response_body is not None: if expect_response_body is not None:
base._assert_status_body(expect_response_body, e.body) base._assert_status_body(expect_response_body, e.body)
else: else:
base._assert_status_code(expect_status_code, status_code) base._assert_status_code(expect_status_code, status_code)
base._assert_status_code(200, status_code) base._assert_status_code(200, status_code)
return base._get_id_from_header(header) return base._get_id_from_header(header)
def create_rule(self, project_id, selector_repository_decoration = "repoMatches", selector_repository="**", def create_rule(self, project_id, selector_repository_decoration = "repoMatches", selector_repository="**",
selector_tag_decoration = "matches", selector_tag="**", selector_tag_decoration = "matches", selector_tag="**",
expect_status_code = 201, disabled = False, **kwargs): expect_status_code = 201, disabled = False, **kwargs):
rule_id = self.create_tag_immutability_policy_rule(project_id, selector_repository_decoration = selector_repository_decoration, rule_id = self.create_tag_immutability_policy_rule(project_id, selector_repository_decoration = selector_repository_decoration,
selector_repository = selector_repository, selector_repository = selector_repository,
selector_tag_decoration = selector_tag_decoration, selector_tag_decoration = selector_tag_decoration,
selector_tag = selector_tag, expect_status_code = expect_status_code, **kwargs) selector_tag = selector_tag, expect_status_code = expect_status_code, **kwargs)
if expect_status_code != 201: if expect_status_code != 201:
return return
self.update_tag_immutability_policy_rule(project_id, rule_id, selector_repository_decoration = selector_repository_decoration, self.update_tag_immutability_policy_rule(project_id, rule_id, selector_repository_decoration = selector_repository_decoration,
selector_repository = selector_repository, selector_tag_decoration = selector_tag_decoration, selector_repository = selector_repository, selector_tag_decoration = selector_tag_decoration,
selector_tag = selector_tag, disabled = disabled, expect_status_code = 200, **kwargs) selector_tag = selector_tag, disabled = disabled, expect_status_code = 200, **kwargs)
return rule_id return rule_id

View File

@ -1,94 +1,94 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import base import base
import v2_swagger_client import v2_swagger_client
from v2_swagger_client.rest import ApiException from v2_swagger_client.rest import ApiException
class User(base.Base, object): class User(base.Base, object):
def __init__(self): def __init__(self):
super(User, self).__init__(api_type = "user") super(User, self).__init__(api_type = "user")
def create_user(self, name=None, def create_user(self, name=None,
email=None, user_password=None, realname=None, expect_status_code=201, **kwargs): email=None, user_password=None, realname=None, expect_status_code=201, **kwargs):
if name is None: if name is None:
name = base._random_name("user") name = base._random_name("user")
if realname is None: if realname is None:
realname = base._random_name("realname") realname = base._random_name("realname")
if email is None: if email is None:
email = '%s@%s.com' % (realname, "vmware") email = '%s@%s.com' % (realname, "vmware")
if user_password is None: if user_password is None:
user_password = "Harbor12345678" user_password = "Harbor12345678"
user_req = v2_swagger_client.UserCreationReq(username=name, email=email, password=user_password, realname=realname) user_req = v2_swagger_client.UserCreationReq(username=name, email=email, password=user_password, realname=realname)
try: try:
_, status_code, header = self._get_client(**kwargs).create_user_with_http_info(user_req) _, status_code, header = self._get_client(**kwargs).create_user_with_http_info(user_req)
except ApiException as e: except ApiException as e:
base._assert_status_code(expect_status_code, e.status) base._assert_status_code(expect_status_code, e.status)
else: else:
base._assert_status_code(expect_status_code, status_code) base._assert_status_code(expect_status_code, status_code)
return base._get_id_from_header(header), name return base._get_id_from_header(header), name
def get_users(self, user_name=None, email=None, page=None, page_size=None, expect_status_code=200, **kwargs): def get_users(self, user_name=None, email=None, page=None, page_size=None, expect_status_code=200, **kwargs):
query = [] query = []
if user_name is not None: if user_name is not None:
query.append("username=" + user_name) query.append("username=" + user_name)
if email is not None: if email is not None:
query.append("email=" + email) query.append("email=" + email)
params = {} params = {}
if len(query) > 0: if len(query) > 0:
params["q"] = ",".join(query) params["q"] = ",".join(query)
if page is not None: if page is not None:
params["page"] = page params["page"] = page
if page_size is not None: if page_size is not None:
params["page_size"] = page_size params["page_size"] = page_size
try: try:
data, status_code, _ = self._get_client(**kwargs).list_users_with_http_info(**params) data, status_code, _ = self._get_client(**kwargs).list_users_with_http_info(**params)
except ApiException as e: except ApiException as e:
base._assert_status_code(expect_status_code, e.status) base._assert_status_code(expect_status_code, e.status)
else: else:
base._assert_status_code(expect_status_code, status_code) base._assert_status_code(expect_status_code, status_code)
return data return data
def get_user_by_id(self, user_id, **kwargs): def get_user_by_id(self, user_id, **kwargs):
data, status_code, _ = self._get_client(**kwargs).get_user_with_http_info(user_id) data, status_code, _ = self._get_client(**kwargs).get_user_with_http_info(user_id)
base._assert_status_code(200, status_code) base._assert_status_code(200, status_code)
return data return data
def get_user_by_name(self, name, expect_status_code=200, **kwargs): def get_user_by_name(self, name, expect_status_code=200, **kwargs):
users = self.get_users(user_name=name, expect_status_code=expect_status_code, **kwargs) users = self.get_users(user_name=name, expect_status_code=expect_status_code, **kwargs)
for user in users: for user in users:
if user.username == name: if user.username == name:
return user return user
return None return None
def get_user_current(self, **kwargs): def get_user_current(self, **kwargs):
data, status_code, _ = self._get_client(**kwargs).get_current_user_info_with_http_info() data, status_code, _ = self._get_client(**kwargs).get_current_user_info_with_http_info()
base._assert_status_code(200, status_code) base._assert_status_code(200, status_code)
return data return data
def delete_user(self, user_id, expect_status_code=200, **kwargs): def delete_user(self, user_id, expect_status_code=200, **kwargs):
_, status_code, _ = self._get_client(**kwargs).delete_user_with_http_info(user_id) _, status_code, _ = self._get_client(**kwargs).delete_user_with_http_info(user_id)
base._assert_status_code(expect_status_code, status_code) base._assert_status_code(expect_status_code, status_code)
return user_id return user_id
def update_user_pwd(self, user_id, new_password=None, old_password=None, **kwargs): def update_user_pwd(self, user_id, new_password=None, old_password=None, **kwargs):
if old_password is None: if old_password is None:
old_password = "" old_password = ""
password = v2_swagger_client.PasswordReq(old_password=old_password, new_password=new_password) password = v2_swagger_client.PasswordReq(old_password=old_password, new_password=new_password)
_, status_code, _ = self._get_client(**kwargs).update_user_password_with_http_info(user_id, password) _, status_code, _ = self._get_client(**kwargs).update_user_password_with_http_info(user_id, password)
base._assert_status_code(200, status_code) base._assert_status_code(200, status_code)
return user_id return user_id
def update_user_profile(self, user_id, email=None, realname=None, comment=None, **kwargs): def update_user_profile(self, user_id, email=None, realname=None, comment=None, **kwargs):
user_profile = v2_swagger_client.UserProfile(email=email, realname=realname, comment=comment) user_profile = v2_swagger_client.UserProfile(email=email, realname=realname, comment=comment)
_, status_code, _ = self._get_client(**kwargs).update_user_profile_with_http_info(user_id, user_profile) _, status_code, _ = self._get_client(**kwargs).update_user_profile_with_http_info(user_id, user_profile)
base._assert_status_code(200, status_code) base._assert_status_code(200, status_code)
return user_id return user_id
def update_user_role_as_sysadmin(self, user_id, IsAdmin, **kwargs): def update_user_role_as_sysadmin(self, user_id, IsAdmin, **kwargs):
sysadmin_flag = v2_swagger_client.UserSysAdminFlag(sysadmin_flag=IsAdmin) sysadmin_flag = v2_swagger_client.UserSysAdminFlag(sysadmin_flag=IsAdmin)
_, status_code, _ = self._get_client(**kwargs).set_user_sys_admin_with_http_info(user_id, sysadmin_flag) _, status_code, _ = self._get_client(**kwargs).set_user_sys_admin_with_http_info(user_id, sysadmin_flag)
base._assert_status_code(200, status_code) base._assert_status_code(200, status_code)
return user_id return user_id

View File

@ -1,84 +1,84 @@
from __future__ import absolute_import from __future__ import absolute_import
import unittest import unittest
from testutils import harbor_server, suppress_urllib3_warning from testutils import harbor_server, suppress_urllib3_warning
from testutils import TEARDOWN from testutils import TEARDOWN
from testutils import ADMIN_CLIENT from testutils import ADMIN_CLIENT
from library.artifact import Artifact from library.artifact import Artifact
from library.project import Project from library.project import Project
from library.user import User from library.user import User
from library.repository import Repository from library.repository import Repository
from library.repository import push_self_build_image_to_project from library.repository import push_self_build_image_to_project
from library.label import Label from library.label import Label
class TestProjects(unittest.TestCase): class TestProjects(unittest.TestCase):
@suppress_urllib3_warning @suppress_urllib3_warning
def setUp(self): def setUp(self):
self.project = Project() self.project = Project()
self.user = User() self.user = User()
self.artifact = Artifact() self.artifact = Artifact()
self.repo = Repository() self.repo = Repository()
self.label = Label() self.label = Label()
@unittest.skipIf(TEARDOWN == False, "Test data won't be erased.") @unittest.skipIf(TEARDOWN == False, "Test data won't be erased.")
def tearDown(self): def tearDown(self):
#1. Delete repository(RA) by user(UA); #1. Delete repository(RA) by user(UA);
self.repo.delete_repository(TestProjects.project_add_g_lbl_name, TestProjects.repo_name.split('/')[1], **TestProjects.USER_add_g_lbl_CLIENT) self.repo.delete_repository(TestProjects.project_add_g_lbl_name, TestProjects.repo_name.split('/')[1], **TestProjects.USER_add_g_lbl_CLIENT)
#2. Delete project(PA); #2. Delete project(PA);
self.project.delete_project(TestProjects.project_add_g_lbl_id, **TestProjects.USER_add_g_lbl_CLIENT) self.project.delete_project(TestProjects.project_add_g_lbl_id, **TestProjects.USER_add_g_lbl_CLIENT)
#3. Delete user(UA); #3. Delete user(UA);
self.user.delete_user(TestProjects.user_add_g_lbl_id, **ADMIN_CLIENT) self.user.delete_user(TestProjects.user_add_g_lbl_id, **ADMIN_CLIENT)
#4. Delete label(LA). #4. Delete label(LA).
self.label.delete_label(TestProjects.label_id, **ADMIN_CLIENT) self.label.delete_label(TestProjects.label_id, **ADMIN_CLIENT)
def testAddSysLabelToRepo(self): def testAddSysLabelToRepo(self):
""" """
Test case: Test case:
Add Global Label To Tag Add Global Label To Tag
Test step and expected result: Test step and expected result:
1. Create a new user(UA); 1. Create a new user(UA);
2. Create a new private project(PA) by user(UA); 2. Create a new private project(PA) by user(UA);
3. Add user(UA) as a member of project(PA) with project-admin role; 3. Add user(UA) as a member of project(PA) with project-admin role;
4. Get private project of user(UA), user(UA) can see only one private project which is project(PA); 4. Get private project of user(UA), user(UA) can see only one private project which is project(PA);
5. Create a new repository(RA) and tag(TA) in project(PA) by user(UA); 5. Create a new repository(RA) and tag(TA) in project(PA) by user(UA);
6. Create a new label(LA) in project(PA) by admin;; 6. Create a new label(LA) in project(PA) by admin;;
7. Add this system global label to repository(RA)/tag(TA); 7. Add this system global label to repository(RA)/tag(TA);
Tear down: Tear down:
1. Delete repository(RA) by user(UA); 1. Delete repository(RA) by user(UA);
2. Delete project(PA); 2. Delete project(PA);
3. Delete user(UA); 3. Delete user(UA);
4. Delete label(LA). 4. Delete label(LA).
""" """
url = ADMIN_CLIENT["endpoint"] url = ADMIN_CLIENT["endpoint"]
user_001_password = "Aa123456" user_001_password = "Aa123456"
#1. Create user-001 #1. Create user-001
TestProjects.user_add_g_lbl_id, user_add_g_lbl_name = self.user.create_user(user_password = user_001_password, **ADMIN_CLIENT) TestProjects.user_add_g_lbl_id, user_add_g_lbl_name = self.user.create_user(user_password = user_001_password, **ADMIN_CLIENT)
TestProjects.USER_add_g_lbl_CLIENT=dict(endpoint = url, username = user_add_g_lbl_name, password = user_001_password) TestProjects.USER_add_g_lbl_CLIENT=dict(endpoint = url, username = user_add_g_lbl_name, password = user_001_password)
#2. Create private project-001 #2. Create private project-001
TestProjects.project_add_g_lbl_id, TestProjects.project_add_g_lbl_name = self.project.create_project(metadata = {"public": "false"}, **ADMIN_CLIENT) TestProjects.project_add_g_lbl_id, TestProjects.project_add_g_lbl_name = self.project.create_project(metadata = {"public": "false"}, **ADMIN_CLIENT)
#3. Add user-001 as a member of project-001 with project-admin role #3. Add user-001 as a member of project-001 with project-admin role
self.project.add_project_members(TestProjects.project_add_g_lbl_id, user_id=TestProjects.user_add_g_lbl_id, **ADMIN_CLIENT) self.project.add_project_members(TestProjects.project_add_g_lbl_id, user_id=TestProjects.user_add_g_lbl_id, **ADMIN_CLIENT)
#4. Get private project of user(UA), user(UA) can see only one private project which is project(PA); #4. Get private project of user(UA), user(UA) can see only one private project which is project(PA);
self.project.projects_should_exist(dict(public=False), expected_count = 1, self.project.projects_should_exist(dict(public=False), expected_count = 1,
expected_project_id = TestProjects.project_add_g_lbl_id, **TestProjects.USER_add_g_lbl_CLIENT) expected_project_id = TestProjects.project_add_g_lbl_id, **TestProjects.USER_add_g_lbl_CLIENT)
#5. Create a new repository(RA) and tag(TA) in project(PA) by user(UA); #5. Create a new repository(RA) and tag(TA) in project(PA) by user(UA);
TestProjects.repo_name, tag = push_self_build_image_to_project(TestProjects.project_add_g_lbl_name, harbor_server, user_add_g_lbl_name, user_001_password, "test_sys_label", "latest") TestProjects.repo_name, tag = push_self_build_image_to_project(TestProjects.project_add_g_lbl_name, harbor_server, user_add_g_lbl_name, user_001_password, "test_sys_label", "latest")
#6. Create a new label(LA) in project(PA) by admin; #6. Create a new label(LA) in project(PA) by admin;
TestProjects.label_id, _ = self.label.create_label(**ADMIN_CLIENT) TestProjects.label_id, _ = self.label.create_label(**ADMIN_CLIENT)
#7. Add this system global label to repository(RA)/tag(TA). #7. Add this system global label to repository(RA)/tag(TA).
self.artifact.add_label_to_reference(TestProjects.project_add_g_lbl_name, TestProjects.repo_name.split('/')[1], tag, int(TestProjects.label_id), **TestProjects.USER_add_g_lbl_CLIENT) self.artifact.add_label_to_reference(TestProjects.project_add_g_lbl_name, TestProjects.repo_name.split('/')[1], tag, int(TestProjects.label_id), **TestProjects.USER_add_g_lbl_CLIENT)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()

View File

@ -1,91 +1,91 @@
from __future__ import absolute_import from __future__ import absolute_import
import unittest import unittest
from testutils import harbor_server, suppress_urllib3_warning from testutils import harbor_server, suppress_urllib3_warning
from testutils import TEARDOWN from testutils import TEARDOWN
from testutils import ADMIN_CLIENT from testutils import ADMIN_CLIENT
from testutils import created_user, created_project from testutils import created_user, created_project
from library.project import Project from library.project import Project
from library.user import User from library.user import User
from library.repository import Repository from library.repository import Repository
from library.artifact import Artifact from library.artifact import Artifact
from library.configurations import Configurations from library.configurations import Configurations
from library.projectV2 import ProjectV2 from library.projectV2 import ProjectV2
from library.repository import push_self_build_image_to_project from library.repository import push_self_build_image_to_project
class TestAssignRoleToLdapGroup(unittest.TestCase): class TestAssignRoleToLdapGroup(unittest.TestCase):
@suppress_urllib3_warning @suppress_urllib3_warning
def setUp(self): def setUp(self):
self.conf= Configurations() self.conf= Configurations()
self.project = Project() self.project = Project()
self.artifact = Artifact() self.artifact = Artifact()
self.repo = Repository() self.repo = Repository()
self.user= User() self.user= User()
@unittest.skipIf(TEARDOWN == False, "Test data won't be erased.") @unittest.skipIf(TEARDOWN == False, "Test data won't be erased.")
def tearDown(self): def tearDown(self):
print("Case completed") print("Case completed")
def testAssignRoleToLdapGroup(self): def testAssignRoleToLdapGroup(self):
""" """
Test case: Test case:
Assign Role To Ldap Group Assign Role To Ldap Group
Test step and expected result: Test step and expected result:
1. Set LDAP Auth configurations; 1. Set LDAP Auth configurations;
2. Create a new public project(PA) by Admin; 2. Create a new public project(PA) by Admin;
3. Add 3 member groups to project(PA); 3. Add 3 member groups to project(PA);
4. Push image by each member role; 4. Push image by each member role;
5. Verfify that admin_user can add project member, dev_user and guest_user can not add project member; 5. Verfify that admin_user can add project member, dev_user and guest_user can not add project member;
6. Verfify that admin_user and dev_user can push image, guest_user can not push image; 6. Verfify that admin_user and dev_user can push image, guest_user can not push image;
7. Verfify that admin_user, dev_user and guest_user can view logs, test user can not view logs. 7. Verfify that admin_user, dev_user and guest_user can view logs, test user can not view logs.
8. Delete repository(RA) by user(UA); 8. Delete repository(RA) by user(UA);
9. Delete project(PA); 9. Delete project(PA);
""" """
url = ADMIN_CLIENT["endpoint"] url = ADMIN_CLIENT["endpoint"]
USER_ADMIN=dict(endpoint = url, username = "admin_user", password = "zhu88jie", repo = "haproxy") USER_ADMIN=dict(endpoint = url, username = "admin_user", password = "zhu88jie", repo = "haproxy")
USER_DEV=dict(endpoint = url, username = "dev_user", password = "zhu88jie", repo = "alpine") USER_DEV=dict(endpoint = url, username = "dev_user", password = "zhu88jie", repo = "alpine")
USER_GUEST=dict(endpoint = url, username = "guest_user", password = "zhu88jie", repo = "busybox") USER_GUEST=dict(endpoint = url, username = "guest_user", password = "zhu88jie", repo = "busybox")
USER_TEST=dict(endpoint = url, username = "test", password = "123456") USER_TEST=dict(endpoint = url, username = "test", password = "123456")
USER_MIKE=dict(endpoint = url, username = "mike", password = "zhu88jie") USER_MIKE=dict(endpoint = url, username = "mike", password = "zhu88jie")
#USER001 is in group harbor_group3 #USER001 is in group harbor_group3
self.conf.set_configurations_of_ldap(ldap_filter="", ldap_group_attribute_name="cn", ldap_group_base_dn="ou=groups,dc=example,dc=com", self.conf.set_configurations_of_ldap(ldap_filter="", ldap_group_attribute_name="cn", ldap_group_base_dn="ou=groups,dc=example,dc=com",
ldap_group_search_filter="objectclass=groupOfNames", ldap_group_search_scope=2, **ADMIN_CLIENT) ldap_group_search_filter="objectclass=groupOfNames", ldap_group_search_scope=2, **ADMIN_CLIENT)
with created_project(metadata={"public": "false"}) as (project_id, project_name): with created_project(metadata={"public": "false"}) as (project_id, project_name):
self.project.add_project_members(project_id, member_role_id = 1, _ldap_group_dn = "cn=harbor_admin,ou=groups,dc=example,dc=com", **ADMIN_CLIENT) self.project.add_project_members(project_id, member_role_id = 1, _ldap_group_dn = "cn=harbor_admin,ou=groups,dc=example,dc=com", **ADMIN_CLIENT)
self.project.add_project_members(project_id, member_role_id = 2, _ldap_group_dn = "cn=harbor_dev,ou=groups,dc=example,dc=com", **ADMIN_CLIENT) self.project.add_project_members(project_id, member_role_id = 2, _ldap_group_dn = "cn=harbor_dev,ou=groups,dc=example,dc=com", **ADMIN_CLIENT)
self.project.add_project_members(project_id, member_role_id = 3, _ldap_group_dn = "cn=harbor_guest,ou=groups,dc=example,dc=com", **ADMIN_CLIENT) self.project.add_project_members(project_id, member_role_id = 3, _ldap_group_dn = "cn=harbor_guest,ou=groups,dc=example,dc=com", **ADMIN_CLIENT)
projects = self.project.get_projects(dict(name=project_name), **USER_ADMIN) projects = self.project.get_projects(dict(name=project_name), **USER_ADMIN)
self.assertTrue(len(projects) == 1) self.assertTrue(len(projects) == 1)
self.assertEqual(1, projects[0].current_user_role_id) self.assertEqual(1, projects[0].current_user_role_id)
#Mike has logged in harbor in previous test. #Mike has logged in harbor in previous test.
mike = self.user.get_user_by_name(USER_MIKE["username"], **ADMIN_CLIENT) mike = self.user.get_user_by_name(USER_MIKE["username"], **ADMIN_CLIENT)
#Verify role difference in add project member feature, to distinguish between admin and dev role #Verify role difference in add project member feature, to distinguish between admin and dev role
self.project.add_project_members(project_id, user_id=mike.user_id, member_role_id = 3, **USER_ADMIN) self.project.add_project_members(project_id, user_id=mike.user_id, member_role_id = 3, **USER_ADMIN)
self.project.add_project_members(project_id, user_id=mike.user_id, member_role_id = 3, expect_status_code=403, **USER_DEV) self.project.add_project_members(project_id, user_id=mike.user_id, member_role_id = 3, expect_status_code=403, **USER_DEV)
self.project.add_project_members(project_id, user_id=mike.user_id, member_role_id = 3, expect_status_code=403, **USER_GUEST) self.project.add_project_members(project_id, user_id=mike.user_id, member_role_id = 3, expect_status_code=403, **USER_GUEST)
repo_name_admin, _ = push_self_build_image_to_project(project_name, harbor_server, USER_ADMIN["username"], USER_ADMIN["password"], USER_ADMIN["repo"], "latest") repo_name_admin, _ = push_self_build_image_to_project(project_name, harbor_server, USER_ADMIN["username"], USER_ADMIN["password"], USER_ADMIN["repo"], "latest")
artifacts = self.artifact.list_artifacts(project_name, USER_ADMIN["repo"], **USER_ADMIN) artifacts = self.artifact.list_artifacts(project_name, USER_ADMIN["repo"], **USER_ADMIN)
self.assertTrue(len(artifacts) == 1) self.assertTrue(len(artifacts) == 1)
repo_name_dev, _ = push_self_build_image_to_project(project_name, harbor_server, USER_DEV["username"], USER_DEV["password"], USER_DEV["repo"], "latest") repo_name_dev, _ = push_self_build_image_to_project(project_name, harbor_server, USER_DEV["username"], USER_DEV["password"], USER_DEV["repo"], "latest")
artifacts = self.artifact.list_artifacts(project_name, USER_DEV["repo"], **USER_DEV) artifacts = self.artifact.list_artifacts(project_name, USER_DEV["repo"], **USER_DEV)
self.assertTrue(len(artifacts) == 1) self.assertTrue(len(artifacts) == 1)
push_self_build_image_to_project(project_name, harbor_server, USER_GUEST["username"], USER_GUEST["password"], USER_GUEST["repo"], "latest", expected_error_message = "unauthorized to access repository") push_self_build_image_to_project(project_name, harbor_server, USER_GUEST["username"], USER_GUEST["password"], USER_GUEST["repo"], "latest", expected_error_message = "unauthorized to access repository")
artifacts = self.artifact.list_artifacts(project_name, USER_GUEST["repo"], **USER_GUEST) artifacts = self.artifact.list_artifacts(project_name, USER_GUEST["repo"], **USER_GUEST)
self.assertTrue(len(artifacts) == 0) self.assertTrue(len(artifacts) == 0)
self.assertTrue(self.project.query_user_logs(project_name, **USER_ADMIN)>0, "admin user can see logs") self.assertTrue(self.project.query_user_logs(project_name, **USER_ADMIN)>0, "admin user can see logs")
self.assertTrue(self.project.query_user_logs(project_name, **USER_DEV)>0, "dev user can see logs") self.assertTrue(self.project.query_user_logs(project_name, **USER_DEV)>0, "dev user can see logs")
self.assertTrue(self.project.query_user_logs(project_name, **USER_GUEST)>0, "guest user can see logs") self.assertTrue(self.project.query_user_logs(project_name, **USER_GUEST)>0, "guest user can see logs")
self.assertTrue(self.project.query_user_logs(project_name, status_code=403, **USER_TEST)==0, "test user can not see any logs") self.assertTrue(self.project.query_user_logs(project_name, status_code=403, **USER_TEST)==0, "test user can not see any logs")
self.repo.delete_repository(project_name, repo_name_admin.split('/')[1], **USER_ADMIN) self.repo.delete_repository(project_name, repo_name_admin.split('/')[1], **USER_ADMIN)
self.repo.delete_repository(project_name, repo_name_dev.split('/')[1], **USER_ADMIN) self.repo.delete_repository(project_name, repo_name_dev.split('/')[1], **USER_ADMIN)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()

View File

@ -1,72 +1,72 @@
from __future__ import absolute_import from __future__ import absolute_import
import unittest import unittest
from testutils import ADMIN_CLIENT, suppress_urllib3_warning from testutils import ADMIN_CLIENT, suppress_urllib3_warning
from testutils import harbor_server from testutils import harbor_server
from testutils import TEARDOWN from testutils import TEARDOWN
from library.base import _assert_status_code from library.base import _assert_status_code
from library.project import Project from library.project import Project
from library.user import User from library.user import User
from library.repository import Repository from library.repository import Repository
from library.repository import push_self_build_image_to_project from library.repository import push_self_build_image_to_project
class TestProjects(unittest.TestCase): class TestProjects(unittest.TestCase):
@suppress_urllib3_warning @suppress_urllib3_warning
def setUp(self): def setUp(self):
self.project= Project() self.project= Project()
self.user= User() self.user= User()
self.repo= Repository() self.repo= Repository()
@unittest.skipIf(TEARDOWN == False, "Test data won't be erased.") @unittest.skipIf(TEARDOWN == False, "Test data won't be erased.")
def tearDown(self): def tearDown(self):
#1. Delete project(PA); #1. Delete project(PA);
self.project.delete_project(TestProjects.project_del_repo_id, **TestProjects.USER_del_repo_CLIENT) self.project.delete_project(TestProjects.project_del_repo_id, **TestProjects.USER_del_repo_CLIENT)
#2. Delete user(UA). #2. Delete user(UA).
self.user.delete_user(TestProjects.user_del_repo_id, **ADMIN_CLIENT) self.user.delete_user(TestProjects.user_del_repo_id, **ADMIN_CLIENT)
def testDelRepo(self): def testDelRepo(self):
""" """
Test case: Test case:
Delete a repository Delete a repository
Test step and expected result: Test step and expected result:
1. Create a new user(UA); 1. Create a new user(UA);
2. Create a new project(PA) by user(UA); 2. Create a new project(PA) by user(UA);
3. Create a new repository(RA) in project(PA) by user(UA); 3. Create a new repository(RA) in project(PA) by user(UA);
4. Get repository in project(PA), there should be one repository which was created by user(UA); 4. Get repository in project(PA), there should be one repository which was created by user(UA);
5. Delete repository(RA) by user(UA); 5. Delete repository(RA) by user(UA);
6. Get repository by user(UA), it should get nothing; 6. Get repository by user(UA), it should get nothing;
Tear down: Tear down:
1. Delete project(PA); 1. Delete project(PA);
2. Delete user(UA). 2. Delete user(UA).
""" """
url = ADMIN_CLIENT["endpoint"] url = ADMIN_CLIENT["endpoint"]
user_del_repo_password = "Aa123456" user_del_repo_password = "Aa123456"
#1. Create a new user(UA); #1. Create a new user(UA);
TestProjects.user_del_repo_id, user_del_repo_name = self.user.create_user(user_password = user_del_repo_password, **ADMIN_CLIENT) TestProjects.user_del_repo_id, user_del_repo_name = self.user.create_user(user_password = user_del_repo_password, **ADMIN_CLIENT)
TestProjects.USER_del_repo_CLIENT=dict(endpoint = url, username = user_del_repo_name, password = user_del_repo_password) TestProjects.USER_del_repo_CLIENT=dict(endpoint = url, username = user_del_repo_name, password = user_del_repo_password)
#2. Create a new project(PA) by user(UA); #2. Create a new project(PA) by user(UA);
TestProjects.project_del_repo_id, TestProjects.project_del_repo_name = self.project.create_project(metadata = {"public": "false"}, **TestProjects.USER_del_repo_CLIENT) TestProjects.project_del_repo_id, TestProjects.project_del_repo_name = self.project.create_project(metadata = {"public": "false"}, **TestProjects.USER_del_repo_CLIENT)
#3. Create a new repository(RA) in project(PA) by user(UA); #3. Create a new repository(RA) in project(PA) by user(UA);
repo_name, _ = push_self_build_image_to_project(TestProjects.project_del_repo_name, harbor_server, 'admin', 'Harbor12345', "test_del_repo", "latest", size=512) repo_name, _ = push_self_build_image_to_project(TestProjects.project_del_repo_name, harbor_server, 'admin', 'Harbor12345', "test_del_repo", "latest", size=512)
#4. Get repository in project(PA), there should be one repository which was created by user(UA); #4. Get repository in project(PA), there should be one repository which was created by user(UA);
repo_data = self.repo.list_repositories(TestProjects.project_del_repo_name, **TestProjects.USER_del_repo_CLIENT) repo_data = self.repo.list_repositories(TestProjects.project_del_repo_name, **TestProjects.USER_del_repo_CLIENT)
_assert_status_code(repo_name, repo_data[0].name) _assert_status_code(repo_name, repo_data[0].name)
#5. Delete repository(RA) by user(UA); #5. Delete repository(RA) by user(UA);
self.repo.delete_repository(TestProjects.project_del_repo_name, repo_name.split('/')[1], **TestProjects.USER_del_repo_CLIENT) self.repo.delete_repository(TestProjects.project_del_repo_name, repo_name.split('/')[1], **TestProjects.USER_del_repo_CLIENT)
#6. Get repository by user(UA), it should get nothing; #6. Get repository by user(UA), it should get nothing;
repo_data = self.repo.list_repositories(TestProjects.project_del_repo_name, **TestProjects.USER_del_repo_CLIENT) repo_data = self.repo.list_repositories(TestProjects.project_del_repo_name, **TestProjects.USER_del_repo_CLIENT)
_assert_status_code(len(repo_data), 0) _assert_status_code(len(repo_data), 0)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()

View File

@ -1,135 +1,135 @@
from __future__ import absolute_import from __future__ import absolute_import
import unittest import unittest
import urllib import urllib
import sys import sys
from testutils import ADMIN_CLIENT, suppress_urllib3_warning, DOCKER_USER, DOCKER_PWD from testutils import ADMIN_CLIENT, suppress_urllib3_warning, DOCKER_USER, DOCKER_PWD
from testutils import harbor_server from testutils import harbor_server
from testutils import TEARDOWN from testutils import TEARDOWN
from library.base import _random_name from library.base import _random_name
from library.base import _assert_status_code from library.base import _assert_status_code
from library.project import Project from library.project import Project
from library.user import User from library.user import User
from library.repository import Repository from library.repository import Repository
from library.registry import Registry from library.registry import Registry
from library.repository import pull_harbor_image from library.repository import pull_harbor_image
from library.artifact import Artifact from library.artifact import Artifact
import library.containerd import library.containerd
class TestProxyCache(unittest.TestCase): class TestProxyCache(unittest.TestCase):
@suppress_urllib3_warning @suppress_urllib3_warning
def setUp(self): def setUp(self):
self.url = ADMIN_CLIENT["endpoint"] self.url = ADMIN_CLIENT["endpoint"]
self.user_password = "Aa123456" self.user_password = "Aa123456"
self.project= Project() self.project= Project()
self.user= User() self.user= User()
self.repo= Repository() self.repo= Repository()
self.registry = Registry() self.registry = Registry()
self.artifact = Artifact() self.artifact = Artifact()
@unittest.skipIf(TEARDOWN == False, "Test data won't be erased.") @unittest.skipIf(TEARDOWN == False, "Test data won't be erased.")
def tearDown(self): def tearDown(self):
print("Case completed") print("Case completed")
def do_validate(self, registry_type): def do_validate(self, registry_type):
""" """
Test case: Test case:
Proxy Cache Image From Harbor Proxy Cache Image From Harbor
Test step and expected result: Test step and expected result:
1. Create a new registry; 1. Create a new registry;
2. Create a new project; 2. Create a new project;
3. Add a new user as a member of project; 3. Add a new user as a member of project;
4. Pull image from this project by docker CLI; 4. Pull image from this project by docker CLI;
5. Pull image from this project by ctr CLI; 5. Pull image from this project by ctr CLI;
6. Pull manifest index from this project by docker CLI; 6. Pull manifest index from this project by docker CLI;
7. Pull manifest from this project by ctr CLI; 7. Pull manifest from this project by ctr CLI;
8. Image pulled by docker CLI should be cached; 8. Image pulled by docker CLI should be cached;
9. Image pulled by ctr CLI should be cached; 9. Image pulled by ctr CLI should be cached;
10. Manifest index pulled by docker CLI should be cached; 10. Manifest index pulled by docker CLI should be cached;
11. Manifest index pulled by ctr CLI should be cached; 11. Manifest index pulled by ctr CLI should be cached;
Tear down: Tear down:
1. Delete project(PA); 1. Delete project(PA);
2. Delete user(UA). 2. Delete user(UA).
""" """
user_id, user_name = self.user.create_user(user_password = self.user_password, **ADMIN_CLIENT) user_id, user_name = self.user.create_user(user_password = self.user_password, **ADMIN_CLIENT)
USER_CLIENT=dict(with_signature = True, endpoint = self.url, username = user_name, password = self.user_password) USER_CLIENT=dict(with_signature = True, endpoint = self.url, username = user_name, password = self.user_password)
image_for_docker = dict(image = "for_proxy", tag = "1.0") image_for_docker = dict(image = "for_proxy", tag = "1.0")
image_for_ctr = dict(image = "redis", tag = "latest") image_for_ctr = dict(image = "redis", tag = "latest")
index_for_docker = dict(image = "index081597864867", tag = "index_tag081597864867") index_for_docker = dict(image = "index081597864867", tag = "index_tag081597864867")
access_key = "" access_key = ""
access_secret = "" access_secret = ""
#1. Create a new registry; #1. Create a new registry;
if registry_type == "docker-hub": if registry_type == "docker-hub":
user_namespace = DOCKER_USER user_namespace = DOCKER_USER
access_key = user_namespace access_key = user_namespace
access_secret = DOCKER_PWD access_secret = DOCKER_PWD
registry = "https://hub.docker.com" registry = "https://hub.docker.com"
# Memo: ctr will not send image pull request if manifest list already exist, so we pull different manifest list for different registry; # Memo: ctr will not send image pull request if manifest list already exist, so we pull different manifest list for different registry;
index_for_ctr = dict(image = "alpine", tag = "3.12.0") index_for_ctr = dict(image = "alpine", tag = "3.12.0")
else: else:
user_namespace = "nightly" user_namespace = "nightly"
registry = "https://cicd.harbor.vmwarecna.net" registry = "https://cicd.harbor.vmwarecna.net"
index_for_ctr = dict(image = "busybox", tag = "1.32.0") index_for_ctr = dict(image = "busybox", tag = "1.32.0")
registry_id, _ = self.registry.create_registry(registry, name=_random_name(registry_type), registry_type=registry_type, access_key = access_key, access_secret = access_secret, insecure=False, **ADMIN_CLIENT) registry_id, _ = self.registry.create_registry(registry, name=_random_name(registry_type), registry_type=registry_type, access_key = access_key, access_secret = access_secret, insecure=False, **ADMIN_CLIENT)
print("registry_id:", registry_id) print("registry_id:", registry_id)
#2. Create a new project; #2. Create a new project;
project_id, project_name = self.project.create_project(registry_id = registry_id, metadata = {"public": "false"}, **ADMIN_CLIENT) project_id, project_name = self.project.create_project(registry_id = registry_id, metadata = {"public": "false"}, **ADMIN_CLIENT)
print("project_id:",project_id) print("project_id:",project_id)
print("project_name:",project_name) print("project_name:",project_name)
#3. Add a new user as a member of project; #3. Add a new user as a member of project;
self.project.add_project_members(project_id, user_id=user_id, **ADMIN_CLIENT) self.project.add_project_members(project_id, user_id=user_id, **ADMIN_CLIENT)
#4. Pull image from this project by docker CLI; #4. Pull image from this project by docker CLI;
pull_harbor_image(harbor_server, USER_CLIENT["username"], USER_CLIENT["password"], project_name + "/" + user_namespace + "/" + image_for_docker["image"], image_for_docker["tag"]) pull_harbor_image(harbor_server, USER_CLIENT["username"], USER_CLIENT["password"], project_name + "/" + user_namespace + "/" + image_for_docker["image"], image_for_docker["tag"])
#5. Pull image from this project by ctr CLI; #5. Pull image from this project by ctr CLI;
oci_ref = harbor_server + "/" + project_name + "/" + user_namespace + "/" + image_for_ctr["image"] + ":" + image_for_ctr["tag"] oci_ref = harbor_server + "/" + project_name + "/" + user_namespace + "/" + image_for_ctr["image"] + ":" + image_for_ctr["tag"]
library.containerd.ctr_images_pull(user_name, self.user_password, oci_ref) library.containerd.ctr_images_pull(user_name, self.user_password, oci_ref)
library.containerd.ctr_images_list(oci_ref = oci_ref) library.containerd.ctr_images_list(oci_ref = oci_ref)
#6. Pull manifest index from this project by docker CLI; #6. Pull manifest index from this project by docker CLI;
index_repo_name = user_namespace + "/" + index_for_docker["image"] index_repo_name = user_namespace + "/" + index_for_docker["image"]
pull_harbor_image(harbor_server, user_name, self.user_password, project_name + "/" + index_repo_name, index_for_docker["tag"]) pull_harbor_image(harbor_server, user_name, self.user_password, project_name + "/" + index_repo_name, index_for_docker["tag"])
#7. Pull manifest from this project by ctr CLI; #7. Pull manifest from this project by ctr CLI;
index_repo_name_for_ctr = user_namespace + "/" + index_for_ctr["image"] index_repo_name_for_ctr = user_namespace + "/" + index_for_ctr["image"]
oci_ref = harbor_server + "/" + project_name + "/" + index_repo_name_for_ctr + ":" + index_for_ctr["tag"] oci_ref = harbor_server + "/" + project_name + "/" + index_repo_name_for_ctr + ":" + index_for_ctr["tag"]
library.containerd.ctr_images_pull(user_name, self.user_password, oci_ref) library.containerd.ctr_images_pull(user_name, self.user_password, oci_ref)
library.containerd.ctr_images_list(oci_ref = oci_ref) library.containerd.ctr_images_list(oci_ref = oci_ref)
#8. Image pulled by docker CLI should be cached; #8. Image pulled by docker CLI should be cached;
self.artifact.waiting_for_reference_exist(project_name, urllib.parse.quote(user_namespace + "/" + image_for_docker["image"],'utf-8'), image_for_docker["tag"], **USER_CLIENT) self.artifact.waiting_for_reference_exist(project_name, urllib.parse.quote(user_namespace + "/" + image_for_docker["image"],'utf-8'), image_for_docker["tag"], **USER_CLIENT)
#9. Image pulled by ctr CLI should be cached; #9. Image pulled by ctr CLI should be cached;
self.artifact.waiting_for_reference_exist(project_name, urllib.parse.quote(user_namespace + "/" + image_for_ctr["image"],'utf-8'), image_for_ctr["tag"], **USER_CLIENT) self.artifact.waiting_for_reference_exist(project_name, urllib.parse.quote(user_namespace + "/" + image_for_ctr["image"],'utf-8'), image_for_ctr["tag"], **USER_CLIENT)
#10. Manifest index pulled by docker CLI should be cached; #10. Manifest index pulled by docker CLI should be cached;
ret_index_by_d = self.artifact.waiting_for_reference_exist(project_name, urllib.parse.quote(index_repo_name,'utf-8'), index_for_docker["tag"], **USER_CLIENT) ret_index_by_d = self.artifact.waiting_for_reference_exist(project_name, urllib.parse.quote(index_repo_name,'utf-8'), index_for_docker["tag"], **USER_CLIENT)
print("Index's reference by docker CLI:", ret_index_by_d.references) print("Index's reference by docker CLI:", ret_index_by_d.references)
self.assertTrue(len(ret_index_by_d.references) == 1) self.assertTrue(len(ret_index_by_d.references) == 1)
#11. Manifest index pulled by ctr CLI should be cached; #11. Manifest index pulled by ctr CLI should be cached;
ret_index_by_c = self.artifact.waiting_for_reference_exist(project_name, urllib.parse.quote(index_repo_name_for_ctr,'utf-8'), index_for_ctr["tag"], **USER_CLIENT) ret_index_by_c = self.artifact.waiting_for_reference_exist(project_name, urllib.parse.quote(index_repo_name_for_ctr,'utf-8'), index_for_ctr["tag"], **USER_CLIENT)
print("Index's reference by ctr CLI:", ret_index_by_c.references) print("Index's reference by ctr CLI:", ret_index_by_c.references)
self.assertTrue(len(ret_index_by_c.references) == 1) self.assertTrue(len(ret_index_by_c.references) == 1)
def test_proxy_cache_from_harbor(self): def test_proxy_cache_from_harbor(self):
self.do_validate("harbor") self.do_validate("harbor")
#def test_proxy_cache_from_dockerhub(self): #def test_proxy_cache_from_dockerhub(self):
# self.do_validate("docker-hub") # self.do_validate("docker-hub")
if __name__ == '__main__': if __name__ == '__main__':
suite = unittest.TestSuite(unittest.makeSuite(TestProxyCache)) suite = unittest.TestSuite(unittest.makeSuite(TestProxyCache))
result = unittest.TextTestRunner(sys.stdout, verbosity=2, failfast=True).run(suite) result = unittest.TextTestRunner(sys.stdout, verbosity=2, failfast=True).run(suite)
if not result.wasSuccessful(): if not result.wasSuccessful():
raise Exception(r"Proxy cache test failed: ".format(result)) raise Exception(r"Proxy cache test failed: ".format(result))

View File

@ -1,299 +1,299 @@
from __future__ import absolute_import from __future__ import absolute_import
import unittest import unittest
import sys import sys
from testutils import ADMIN_CLIENT, TEARDOWN, suppress_urllib3_warning from testutils import ADMIN_CLIENT, TEARDOWN, suppress_urllib3_warning
from testutils import harbor_server from testutils import harbor_server
from library.project import Project from library.project import Project
from library.user import User from library.user import User
from library.repository import Repository from library.repository import Repository
from library.registry import Registry from library.registry import Registry
from library.artifact import Artifact from library.artifact import Artifact
from library.tag_immutability import Tag_Immutability from library.tag_immutability import Tag_Immutability
from library.repository import push_special_image_to_project from library.repository import push_special_image_to_project
class TestTagImmutability(unittest.TestCase): class TestTagImmutability(unittest.TestCase):
@suppress_urllib3_warning @suppress_urllib3_warning
def setUp(self): def setUp(self):
self.url = ADMIN_CLIENT["endpoint"] self.url = ADMIN_CLIENT["endpoint"]
self.user_password = "Aa123456" self.user_password = "Aa123456"
self.project= Project() self.project= Project()
self.user= User() self.user= User()
self.repo= Repository() self.repo= Repository()
self.registry = Registry() self.registry = Registry()
self.artifact = Artifact() self.artifact = Artifact()
self.tag_immutability = Tag_Immutability() self.tag_immutability = Tag_Immutability()
self.project_id, self.project_name, self.user_id, self.user_name = [None] * 4 self.project_id, self.project_name, self.user_id, self.user_name = [None] * 4
self.user_id, self.user_name = self.user.create_user(user_password = self.user_password, **ADMIN_CLIENT) self.user_id, self.user_name = self.user.create_user(user_password = self.user_password, **ADMIN_CLIENT)
self.USER_CLIENT = dict(with_signature = True, with_immutable_status = True, endpoint = self.url, username = self.user_name, password = self.user_password) self.USER_CLIENT = dict(with_signature = True, with_immutable_status = True, endpoint = self.url, username = self.user_name, password = self.user_password)
self.exsiting_rule = dict(selector_repository="rel*", selector_tag="v2.*") self.exsiting_rule = dict(selector_repository="rel*", selector_tag="v2.*")
self.project_id, self.project_name = self.project.create_project(metadata = {"public": "false"}, **self.USER_CLIENT) self.project_id, self.project_name = self.project.create_project(metadata = {"public": "false"}, **self.USER_CLIENT)
@unittest.skipIf(TEARDOWN == False, "Test data won't be erased.") @unittest.skipIf(TEARDOWN == False, "Test data won't be erased.")
def tearDown(self): def tearDown(self):
print("Case completed") print("Case completed")
def check_tag_immutability(self, artifact, tag_name, status = True): def check_tag_immutability(self, artifact, tag_name, status = True):
for tag in artifact.tags: for tag in artifact.tags:
if tag.name == tag_name: if tag.name == tag_name:
self.assertTrue(tag.immutable == status) self.assertTrue(tag.immutable == status)
return return
raise Exception("No tag {} found in artifact {}".format(tag, artifact)) raise Exception("No tag {} found in artifact {}".format(tag, artifact))
def test_disability_of_rules(self): def test_disability_of_rules(self):
""" """
Test case: Test case:
Test Disability Of Rules Test Disability Of Rules
Test step and expected result: Test step and expected result:
1. Create a new project; 1. Create a new project;
2. Push image A to the project with 2 tags A and B; 2. Push image A to the project with 2 tags A and B;
3. Create a disabled rule matched image A with tag A; 3. Create a disabled rule matched image A with tag A;
4. Both tags of image A should not be immutable; 4. Both tags of image A should not be immutable;
5. Enable this rule; 5. Enable this rule;
6. image A with tag A should be immutable. 6. image A with tag A should be immutable.
""" """
image_a = dict(name="image_disability_a", tag1="latest", tag2="6.2.2") image_a = dict(name="image_disability_a", tag1="latest", tag2="6.2.2")
#1. Create a new project; #1. Create a new project;
project_id, project_name = self.project.create_project(metadata = {"public": "false"}, **self.USER_CLIENT) project_id, project_name = self.project.create_project(metadata = {"public": "false"}, **self.USER_CLIENT)
#2. Push image A to the project with 2 tags; #2. Push image A to the project with 2 tags;
push_special_image_to_project(project_name, harbor_server, self.user_name, self.user_password, image_a["name"], [image_a["tag1"], image_a["tag2"]]) push_special_image_to_project(project_name, harbor_server, self.user_name, self.user_password, image_a["name"], [image_a["tag1"], image_a["tag2"]])
#3. Create a disabled rule matched image A; #3. Create a disabled rule matched image A;
rule_id = self.tag_immutability.create_rule(project_id, disabled = True, selector_repository=image_a["name"], selector_tag=str(image_a["tag1"])[0:2] + "*", **self.USER_CLIENT) rule_id = self.tag_immutability.create_rule(project_id, disabled = True, selector_repository=image_a["name"], selector_tag=str(image_a["tag1"])[0:2] + "*", **self.USER_CLIENT)
#4. Both tags of image A should not be immutable; #4. Both tags of image A should not be immutable;
artifact_a = self.artifact.get_reference_info(project_name, image_a["name"], image_a["tag2"], **self.USER_CLIENT) artifact_a = self.artifact.get_reference_info(project_name, image_a["name"], image_a["tag2"], **self.USER_CLIENT)
print("[test_disability_of_rules] - artifact:{}".format(artifact_a)) print("[test_disability_of_rules] - artifact:{}".format(artifact_a))
self.assertTrue(artifact_a) self.assertTrue(artifact_a)
self.check_tag_immutability(artifact_a, image_a["tag1"], status = False) self.check_tag_immutability(artifact_a, image_a["tag1"], status = False)
self.check_tag_immutability(artifact_a, image_a["tag2"], status = False) self.check_tag_immutability(artifact_a, image_a["tag2"], status = False)
#5. Enable this rule; #5. Enable this rule;
self.tag_immutability.update_tag_immutability_policy_rule(project_id, rule_id, disabled = False, **self.USER_CLIENT) self.tag_immutability.update_tag_immutability_policy_rule(project_id, rule_id, disabled = False, **self.USER_CLIENT)
#6. image A with tag A should be immutable. #6. image A with tag A should be immutable.
artifact_a = self.artifact.get_reference_info(project_name, image_a["name"], image_a["tag2"], **self.USER_CLIENT) artifact_a = self.artifact.get_reference_info(project_name, image_a["name"], image_a["tag2"], **self.USER_CLIENT)
print("[test_disability_of_rules] - artifact:{}".format(artifact_a)) print("[test_disability_of_rules] - artifact:{}".format(artifact_a))
self.assertTrue(artifact_a) self.assertTrue(artifact_a)
self.check_tag_immutability(artifact_a, image_a["tag1"], status = True) self.check_tag_immutability(artifact_a, image_a["tag1"], status = True)
self.check_tag_immutability(artifact_a, image_a["tag2"], status = False) self.check_tag_immutability(artifact_a, image_a["tag2"], status = False)
def test_artifact_and_repo_is_undeletable(self): def test_artifact_and_repo_is_undeletable(self):
""" """
Test case: Test case:
Test Artifact And Repo is Undeleteable Test Artifact And Repo is Undeleteable
Test step and expected result: Test step and expected result:
1. Create a new project; 1. Create a new project;
2. Push image A to the project with 2 tags A and B; 2. Push image A to the project with 2 tags A and B;
3. Create a enabled rule matched image A with tag A; 3. Create a enabled rule matched image A with tag A;
4. Tag A should be immutable; 4. Tag A should be immutable;
5. Artifact is undeletable; 5. Artifact is undeletable;
6. Repository is undeletable. 6. Repository is undeletable.
""" """
image_a = dict(name="image_repo_undeletable_a", tag1="latest", tag2="1.3.2") image_a = dict(name="image_repo_undeletable_a", tag1="latest", tag2="1.3.2")
#1. Create a new project; #1. Create a new project;
project_id, project_name = self.project.create_project(metadata = {"public": "false"}, **self.USER_CLIENT) project_id, project_name = self.project.create_project(metadata = {"public": "false"}, **self.USER_CLIENT)
#2. Push image A to the project with 2 tags A and B; #2. Push image A to the project with 2 tags A and B;
push_special_image_to_project(project_name, harbor_server, self.user_name, self.user_password, image_a["name"], [image_a["tag1"], image_a["tag2"]]) push_special_image_to_project(project_name, harbor_server, self.user_name, self.user_password, image_a["name"], [image_a["tag1"], image_a["tag2"]])
#3. Create a enabled rule matched image A with tag A; #3. Create a enabled rule matched image A with tag A;
self.tag_immutability.create_rule(project_id, selector_repository=image_a["name"], selector_tag=str(image_a["tag1"])[0:2] + "*", **self.USER_CLIENT) self.tag_immutability.create_rule(project_id, selector_repository=image_a["name"], selector_tag=str(image_a["tag1"])[0:2] + "*", **self.USER_CLIENT)
#4. Tag A should be immutable; #4. Tag A should be immutable;
artifact_a = self.artifact.get_reference_info(project_name, image_a["name"], image_a["tag2"], **self.USER_CLIENT) artifact_a = self.artifact.get_reference_info(project_name, image_a["name"], image_a["tag2"], **self.USER_CLIENT)
print("[test_artifact_and_repo_is_undeletable] - artifact:{}".format(artifact_a)) print("[test_artifact_and_repo_is_undeletable] - artifact:{}".format(artifact_a))
self.assertTrue(artifact_a) self.assertTrue(artifact_a)
self.check_tag_immutability(artifact_a, image_a["tag1"], status = True) self.check_tag_immutability(artifact_a, image_a["tag1"], status = True)
self.check_tag_immutability(artifact_a, image_a["tag2"], status = False) self.check_tag_immutability(artifact_a, image_a["tag2"], status = False)
#5. Artifact is undeletable; #5. Artifact is undeletable;
self.artifact.delete_artifact(project_name, image_a["name"], image_a["tag1"], expect_status_code = 412,expect_response_body = "configured as immutable, cannot be deleted", **self.USER_CLIENT) self.artifact.delete_artifact(project_name, image_a["name"], image_a["tag1"], expect_status_code = 412,expect_response_body = "configured as immutable, cannot be deleted", **self.USER_CLIENT)
#6. Repository is undeletable. #6. Repository is undeletable.
self.repo.delete_repository(project_name, image_a["name"], expect_status_code = 412, expect_response_body = "configured as immutable, cannot be deleted", **self.USER_CLIENT) self.repo.delete_repository(project_name, image_a["name"], expect_status_code = 412, expect_response_body = "configured as immutable, cannot be deleted", **self.USER_CLIENT)
def test_tag_is_undeletable(self): def test_tag_is_undeletable(self):
""" """
Test case: Test case:
Test Tag is Undeleteable Test Tag is Undeleteable
Test step and expected result: Test step and expected result:
1. Push image A to the project with 2 tags A and B; 1. Push image A to the project with 2 tags A and B;
2. Create a enabled rule matched image A with tag A; 2. Create a enabled rule matched image A with tag A;
3. Tag A should be immutable; 3. Tag A should be immutable;
4. Tag A is undeletable; 4. Tag A is undeletable;
5. Tag B is deletable. 5. Tag B is deletable.
""" """
image_a = dict(name="image_undeletable_a", tag1="latest", tag2="9.3.2") image_a = dict(name="image_undeletable_a", tag1="latest", tag2="9.3.2")
#1. Push image A to the project with 2 tags A and B; #1. Push image A to the project with 2 tags A and B;
push_special_image_to_project(self.project_name, harbor_server, self.user_name, self.user_password, image_a["name"], [image_a["tag1"], image_a["tag2"]]) push_special_image_to_project(self.project_name, harbor_server, self.user_name, self.user_password, image_a["name"], [image_a["tag1"], image_a["tag2"]])
#2. Create a enabled rule matched image A with tag A; #2. Create a enabled rule matched image A with tag A;
self.tag_immutability.create_rule(self.project_id, selector_repository=image_a["name"], selector_tag=str(image_a["tag2"])[0:2] + "*", **self.USER_CLIENT) self.tag_immutability.create_rule(self.project_id, selector_repository=image_a["name"], selector_tag=str(image_a["tag2"])[0:2] + "*", **self.USER_CLIENT)
#3. Tag A should be immutable; #3. Tag A should be immutable;
artifact_a = self.artifact.get_reference_info(self.project_name, image_a["name"], image_a["tag2"], **self.USER_CLIENT) artifact_a = self.artifact.get_reference_info(self.project_name, image_a["name"], image_a["tag2"], **self.USER_CLIENT)
print("[test_tag_is_undeletable] - artifact:{}".format(artifact_a)) print("[test_tag_is_undeletable] - artifact:{}".format(artifact_a))
self.assertTrue(artifact_a) self.assertTrue(artifact_a)
self.check_tag_immutability(artifact_a, image_a["tag2"], status = True) self.check_tag_immutability(artifact_a, image_a["tag2"], status = True)
#4. Tag A is undeletable; #4. Tag A is undeletable;
self.artifact.delete_tag(self.project_name, image_a["name"], image_a["tag1"], image_a["tag2"], expect_status_code = 412, **self.USER_CLIENT) self.artifact.delete_tag(self.project_name, image_a["name"], image_a["tag1"], image_a["tag2"], expect_status_code = 412, **self.USER_CLIENT)
#5. Tag B is deletable. #5. Tag B is deletable.
self.artifact.delete_tag(self.project_name, image_a["name"], image_a["tag1"], image_a["tag1"], **self.USER_CLIENT) self.artifact.delete_tag(self.project_name, image_a["name"], image_a["tag1"], image_a["tag1"], **self.USER_CLIENT)
def test_image_is_unpushable(self): def test_image_is_unpushable(self):
""" """
Test case: Test case:
Test Image is Unpushable Test Image is Unpushable
Test step and expected result: Test step and expected result:
1. Create a new project; 1. Create a new project;
2. Push image A to the project with 2 tags A and B; 2. Push image A to the project with 2 tags A and B;
3. Create a enabled rule matched image A with tag A; 3. Create a enabled rule matched image A with tag A;
4. Tag A should be immutable; 4. Tag A should be immutable;
5. Can not push image with the same image name and with the same tag name. 5. Can not push image with the same image name and with the same tag name.
""" """
image_a = dict(name="image_unpushable_a", tag1="latest", tag2="1.3.2") image_a = dict(name="image_unpushable_a", tag1="latest", tag2="1.3.2")
#1. Create a new project; #1. Create a new project;
project_id, project_name = self.project.create_project(metadata = {"public": "false"}, **self.USER_CLIENT) project_id, project_name = self.project.create_project(metadata = {"public": "false"}, **self.USER_CLIENT)
#2. Push image A to the project with 2 tags A and B; #2. Push image A to the project with 2 tags A and B;
push_special_image_to_project(project_name, harbor_server, self.user_name, self.user_password, image_a["name"], [image_a["tag1"], image_a["tag2"]]) push_special_image_to_project(project_name, harbor_server, self.user_name, self.user_password, image_a["name"], [image_a["tag1"], image_a["tag2"]])
#3. Create a enabled rule matched image A with tag A; #3. Create a enabled rule matched image A with tag A;
self.tag_immutability.create_rule(project_id, selector_repository=image_a["name"], selector_tag=str(image_a["tag1"])[0:2] + "*", **self.USER_CLIENT) self.tag_immutability.create_rule(project_id, selector_repository=image_a["name"], selector_tag=str(image_a["tag1"])[0:2] + "*", **self.USER_CLIENT)
#4. Tag A should be immutable; #4. Tag A should be immutable;
artifact_a = self.artifact.get_reference_info(project_name, image_a["name"], image_a["tag2"], **self.USER_CLIENT) artifact_a = self.artifact.get_reference_info(project_name, image_a["name"], image_a["tag2"], **self.USER_CLIENT)
print("[test_image_is_unpushable] - artifact:{}".format(artifact_a)) print("[test_image_is_unpushable] - artifact:{}".format(artifact_a))
self.assertTrue(artifact_a) self.assertTrue(artifact_a)
self.check_tag_immutability(artifact_a, image_a["tag1"], status = True) self.check_tag_immutability(artifact_a, image_a["tag1"], status = True)
self.check_tag_immutability(artifact_a, image_a["tag2"], status = False) self.check_tag_immutability(artifact_a, image_a["tag2"], status = False)
#5. Can not push image with the same image name and with the same tag name. #5. Can not push image with the same image name and with the same tag name.
push_special_image_to_project(project_name, harbor_server, self.user_name, self.user_password, image_a["name"], [image_a["tag1"]], size=10 push_special_image_to_project(project_name, harbor_server, self.user_name, self.user_password, image_a["name"], [image_a["tag1"]], size=10
, expected_error_message = "configured as immutable") , expected_error_message = "configured as immutable")
def test_copy_disability(self): def test_copy_disability(self):
""" """
Test case: Test case:
Test Copy Disability Test Copy Disability
Test step and expected result: Test step and expected result:
1. Create 2 projects; 1. Create 2 projects;
2. Push image A with tag A and B to project A, push image B which has the same image name and tag name to project B; 2. Push image A with tag A and B to project A, push image B which has the same image name and tag name to project B;
3. Create a enabled rule matched image A with tag A; 3. Create a enabled rule matched image A with tag A;
4. Tag A should be immutable; 4. Tag A should be immutable;
5. Can not copy artifact from project A to project B with the same repository name. 5. Can not copy artifact from project A to project B with the same repository name.
""" """
image_a = dict(name="image_copy_disability_a", tag1="latest", tag2="1.3.2") image_a = dict(name="image_copy_disability_a", tag1="latest", tag2="1.3.2")
#1. Create 2 projects; #1. Create 2 projects;
project_id, project_name = self.project.create_project(metadata = {"public": "false"}, **self.USER_CLIENT) project_id, project_name = self.project.create_project(metadata = {"public": "false"}, **self.USER_CLIENT)
_, project_name_src = self.project.create_project(metadata = {"public": "false"}, **self.USER_CLIENT) _, project_name_src = self.project.create_project(metadata = {"public": "false"}, **self.USER_CLIENT)
#2. Push image A with tag A and B to project A, push image B which has the same image name and tag name to project B; #2. Push image A with tag A and B to project A, push image B which has the same image name and tag name to project B;
push_special_image_to_project(project_name, harbor_server, self.user_name, self.user_password, image_a["name"], [image_a["tag1"], image_a["tag2"]]) push_special_image_to_project(project_name, harbor_server, self.user_name, self.user_password, image_a["name"], [image_a["tag1"], image_a["tag2"]])
push_special_image_to_project(project_name_src, harbor_server, self.user_name, self.user_password, image_a["name"], [image_a["tag1"], image_a["tag2"]]) push_special_image_to_project(project_name_src, harbor_server, self.user_name, self.user_password, image_a["name"], [image_a["tag1"], image_a["tag2"]])
#3. Create a enabled rule matched image A with tag A; #3. Create a enabled rule matched image A with tag A;
self.tag_immutability.create_rule(project_id, selector_repository=image_a["name"], selector_tag=str(image_a["tag1"])[0:2] + "*", **self.USER_CLIENT) self.tag_immutability.create_rule(project_id, selector_repository=image_a["name"], selector_tag=str(image_a["tag1"])[0:2] + "*", **self.USER_CLIENT)
#4. Tag A should be immutable; #4. Tag A should be immutable;
artifact_a = self.artifact.get_reference_info(project_name, image_a["name"], image_a["tag2"], **self.USER_CLIENT) artifact_a = self.artifact.get_reference_info(project_name, image_a["name"], image_a["tag2"], **self.USER_CLIENT)
print("[test_copy_disability] - artifact:{}".format(artifact_a)) print("[test_copy_disability] - artifact:{}".format(artifact_a))
self.assertTrue(artifact_a) self.assertTrue(artifact_a)
self.check_tag_immutability(artifact_a, image_a["tag1"], status = True) self.check_tag_immutability(artifact_a, image_a["tag1"], status = True)
self.check_tag_immutability(artifact_a, image_a["tag2"], status = False) self.check_tag_immutability(artifact_a, image_a["tag2"], status = False)
#5. Can not copy artifact from project A to project B with the same repository name. #5. Can not copy artifact from project A to project B with the same repository name.
artifact_a_src = self.artifact.get_reference_info(project_name_src, image_a["name"], image_a["tag2"], **self.USER_CLIENT) artifact_a_src = self.artifact.get_reference_info(project_name_src, image_a["name"], image_a["tag2"], **self.USER_CLIENT)
print("[test_copy_disability] - artifact_a_src:{}".format(artifact_a_src)) print("[test_copy_disability] - artifact_a_src:{}".format(artifact_a_src))
self.artifact.copy_artifact(project_name, image_a["name"], project_name_src+"/"+ image_a["name"] + "@" + artifact_a_src.digest, expect_status_code=412, expect_response_body = "configured as immutable, cannot be updated", **self.USER_CLIENT) self.artifact.copy_artifact(project_name, image_a["name"], project_name_src+"/"+ image_a["name"] + "@" + artifact_a_src.digest, expect_status_code=412, expect_response_body = "configured as immutable, cannot be updated", **self.USER_CLIENT)
#def test_replication_disability(self): #def test_replication_disability(self):
# pass # pass
def test_priority_of_rules(self): def test_priority_of_rules(self):
""" """
Test case: Test case:
Test Priority Of Rules(excluding rule will not affect matching rule) Test Priority Of Rules(excluding rule will not affect matching rule)
Test step and expected result: Test step and expected result:
1. Push image A, B and C, image A has only 1 tag named tag1; 1. Push image A, B and C, image A has only 1 tag named tag1;
2. Create a matching rule that matches image A and tag named tag2 which is not exist; 2. Create a matching rule that matches image A and tag named tag2 which is not exist;
3. Create a excluding rule to exlude image A and B; 3. Create a excluding rule to exlude image A and B;
4. Add a tag named tag2 to image A, tag2 should be immutable; 4. Add a tag named tag2 to image A, tag2 should be immutable;
5. Tag2 should be immutable; 5. Tag2 should be immutable;
6. All tags in image B should be immutable; 6. All tags in image B should be immutable;
7. All tags in image C should not be immutable; 7. All tags in image C should not be immutable;
8. Disable all rules. 8. Disable all rules.
""" """
image_a = dict(name="image_priority_a", tag1="latest", tag2="6.3.2") image_a = dict(name="image_priority_a", tag1="latest", tag2="6.3.2")
image_b = dict(name="image_priority_b", tag1="latest", tag2="0.12.0") image_b = dict(name="image_priority_b", tag1="latest", tag2="0.12.0")
image_c = dict(name="image_priority_c", tag1="latest", tag2="3.12.0") image_c = dict(name="image_priority_c", tag1="latest", tag2="3.12.0")
#1. Push image A, B and C, image A has only 1 tag named tag1; #1. Push image A, B and C, image A has only 1 tag named tag1;
push_special_image_to_project(self.project_name, harbor_server, self.user_name, self.user_password, image_a["name"], [image_a["tag1"]]) push_special_image_to_project(self.project_name, harbor_server, self.user_name, self.user_password, image_a["name"], [image_a["tag1"]])
push_special_image_to_project(self.project_name, harbor_server, self.user_name, self.user_password, image_b["name"], [image_b["tag1"],image_b["tag2"]]) push_special_image_to_project(self.project_name, harbor_server, self.user_name, self.user_password, image_b["name"], [image_b["tag1"],image_b["tag2"]])
push_special_image_to_project(self.project_name, harbor_server, self.user_name, self.user_password, image_c["name"], [image_c["tag1"],image_c["tag2"]]) push_special_image_to_project(self.project_name, harbor_server, self.user_name, self.user_password, image_c["name"], [image_c["tag1"],image_c["tag2"]])
#2. Create a matching rule that matches image A and tag named tag2 which is not exist; #2. Create a matching rule that matches image A and tag named tag2 which is not exist;
rule_id_1 = self.tag_immutability.create_rule(self.project_id, selector_repository=image_a["name"], selector_tag=image_a["tag2"], **self.USER_CLIENT) rule_id_1 = self.tag_immutability.create_rule(self.project_id, selector_repository=image_a["name"], selector_tag=image_a["tag2"], **self.USER_CLIENT)
#3. Create a excluding rule to exlude image A and B; #3. Create a excluding rule to exlude image A and B;
rule_id_2 = self.tag_immutability.create_rule(self.project_id, selector_repository_decoration = "repoExcludes", rule_id_2 = self.tag_immutability.create_rule(self.project_id, selector_repository_decoration = "repoExcludes",
selector_repository="{image_priority_a,image_priority_b}", selector_tag="**", **self.USER_CLIENT) selector_repository="{image_priority_a,image_priority_b}", selector_tag="**", **self.USER_CLIENT)
#4. Add a tag named tag2 to image A, tag2 should be immutable; #4. Add a tag named tag2 to image A, tag2 should be immutable;
self.artifact.create_tag(self.project_name, image_a["name"], image_a["tag1"], image_a["tag2"], **self.USER_CLIENT) self.artifact.create_tag(self.project_name, image_a["name"], image_a["tag1"], image_a["tag2"], **self.USER_CLIENT)
#5. Tag2 should be immutable; #5. Tag2 should be immutable;
artifact_a = self.artifact.get_reference_info(self.project_name, image_a["name"], image_a["tag2"], **self.USER_CLIENT) artifact_a = self.artifact.get_reference_info(self.project_name, image_a["name"], image_a["tag2"], **self.USER_CLIENT)
print("[test_priority_of_rules] - artifact:{}".format(artifact_a)) print("[test_priority_of_rules] - artifact:{}".format(artifact_a))
self.assertTrue(artifact_a) self.assertTrue(artifact_a)
self.check_tag_immutability(artifact_a, image_a["tag2"], status = True) self.check_tag_immutability(artifact_a, image_a["tag2"], status = True)
self.check_tag_immutability(artifact_a, image_a["tag1"], status = False) self.check_tag_immutability(artifact_a, image_a["tag1"], status = False)
#6. All tags in image B should be immutable; #6. All tags in image B should be immutable;
artifact_b = self.artifact.get_reference_info(self.project_name, image_b["name"], image_b["tag2"], **self.USER_CLIENT) artifact_b = self.artifact.get_reference_info(self.project_name, image_b["name"], image_b["tag2"], **self.USER_CLIENT)
print("[test_priority_of_rules] - artifact:{}".format(artifact_b)) print("[test_priority_of_rules] - artifact:{}".format(artifact_b))
self.assertTrue(artifact_b) self.assertTrue(artifact_b)
self.check_tag_immutability(artifact_b, image_b["tag2"], status = False) self.check_tag_immutability(artifact_b, image_b["tag2"], status = False)
self.check_tag_immutability(artifact_b, image_b["tag1"], status = False) self.check_tag_immutability(artifact_b, image_b["tag1"], status = False)
#7. All tags in image C should not be immutable; #7. All tags in image C should not be immutable;
artifact_c = self.artifact.get_reference_info(self.project_name, image_c["name"], image_c["tag2"], **self.USER_CLIENT) artifact_c = self.artifact.get_reference_info(self.project_name, image_c["name"], image_c["tag2"], **self.USER_CLIENT)
print("[test_priority_of_rules] - artifact:{}".format(artifact_c)) print("[test_priority_of_rules] - artifact:{}".format(artifact_c))
self.assertTrue(artifact_c) self.assertTrue(artifact_c)
self.check_tag_immutability(artifact_c, image_c["tag2"], status = True) self.check_tag_immutability(artifact_c, image_c["tag2"], status = True)
self.check_tag_immutability(artifact_c, image_c["tag1"], status = True) self.check_tag_immutability(artifact_c, image_c["tag1"], status = True)
#8. Disable all rules. #8. Disable all rules.
self.tag_immutability.update_tag_immutability_policy_rule(self.project_id, rule_id_1, disabled = True, **self.USER_CLIENT) self.tag_immutability.update_tag_immutability_policy_rule(self.project_id, rule_id_1, disabled = True, **self.USER_CLIENT)
self.tag_immutability.update_tag_immutability_policy_rule(self.project_id, rule_id_2, disabled = True, **self.USER_CLIENT) self.tag_immutability.update_tag_immutability_policy_rule(self.project_id, rule_id_2, disabled = True, **self.USER_CLIENT)
def test_add_exsiting_rule(self): def test_add_exsiting_rule(self):
""" """
Test case: Test case:
Test Priority Of Rules(excluding rule will not affect matching rule) Test Priority Of Rules(excluding rule will not affect matching rule)
Test step and expected result: Test step and expected result:
1. Push image A and B with no tag; 1. Push image A and B with no tag;
2. Create a immutability policy rule A; 2. Create a immutability policy rule A;
3. Fail to create rule B which has the same config as rule A; 3. Fail to create rule B which has the same config as rule A;
""" """
self.tag_immutability.create_tag_immutability_policy_rule(self.project_id, **self.exsiting_rule, **self.USER_CLIENT) self.tag_immutability.create_tag_immutability_policy_rule(self.project_id, **self.exsiting_rule, **self.USER_CLIENT)
self.tag_immutability.create_tag_immutability_policy_rule(self.project_id, **self.exsiting_rule, expect_status_code = 409, **self.USER_CLIENT) self.tag_immutability.create_tag_immutability_policy_rule(self.project_id, **self.exsiting_rule, expect_status_code = 409, **self.USER_CLIENT)
if __name__ == '__main__': if __name__ == '__main__':
suite = unittest.TestSuite(unittest.makeSuite(TestTagImmutability)) suite = unittest.TestSuite(unittest.makeSuite(TestTagImmutability))
result = unittest.TextTestRunner(sys.stdout, verbosity=2, failfast=True).run(suite) result = unittest.TextTestRunner(sys.stdout, verbosity=2, failfast=True).run(suite)
if not result.wasSuccessful(): if not result.wasSuccessful():
raise Exception(r"Tag immutability test failed: {}".format(result)) raise Exception(r"Tag immutability test failed: {}".format(result))

View File

@ -1,18 +1,18 @@
*** Keywords *** *** Keywords ***
Make Swagger Client Make Swagger Client
${rc} ${output}= Run And Return Rc And Output make swagger_client ${rc} ${output}= Run And Return Rc And Output make swagger_client
Log ${output} Log ${output}
[Return] ${rc} [Return] ${rc}
Setup API Test Setup API Test
Retry Keyword N Times When Error 10 Make Swagger Client Retry Keyword N Times When Error 10 Make Swagger Client
Harbor API Test Harbor API Test
[Arguments] ${testcase_name} [Arguments] ${testcase_name}
${current_dir}= Run pwd ${current_dir}= Run pwd
Log To Console ${current_dir} Log To Console ${current_dir}
Log To Console ${ip} Log To Console ${ip}
${rc} ${output}= Run And Return Rc And Output SWAGGER_CLIENT_PATH=${current_dir}/harborclient HARBOR_HOST=${ip} DOCKER_USER=${DOCKER_USER} DOCKER_PWD=${DOCKER_PWD} python ${testcase_name} ${rc} ${output}= Run And Return Rc And Output SWAGGER_CLIENT_PATH=${current_dir}/harborclient HARBOR_HOST=${ip} DOCKER_USER=${DOCKER_USER} DOCKER_PWD=${DOCKER_PWD} python ${testcase_name}
Log To Console ${output} Log To Console ${output}
Log ${output} Log ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0

View File

@ -1,26 +1,26 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides helper functions for docker operations Documentation This resource provides helper functions for docker operations
Library OperatingSystem Library OperatingSystem
Library Process Library Process
*** Keywords *** *** Keywords ***
CNAB Push Bundle CNAB Push Bundle
[Arguments] ${ip} ${user} ${pwd} ${target} ${bundle_file} ${docker_user} ${docker_pwd} [Arguments] ${ip} ${user} ${pwd} ${target} ${bundle_file} ${docker_user} ${docker_pwd}
${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/cnab_push_bundle.sh ${ip} ${user} ${pwd} ${target} ${bundle_file} ${docker_user} ${docker_pwd} ${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/cnab_push_bundle.sh ${ip} ${user} ${pwd} ${target} ${bundle_file} ${docker_user} ${docker_pwd}
Log To Console ${output} Log To Console ${output}
Log ${output} Log ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0

View File

@ -1,116 +1,116 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource contains keywords related to creating and using certificates. Requires scripts in infra/integration-image/scripts be available in PATH Documentation This resource contains keywords related to creating and using certificates. Requires scripts in infra/integration-image/scripts be available in PATH
*** Keywords *** *** Keywords ***
Generate Certificate Authority For Chrome Generate Certificate Authority For Chrome
# add the ca to chrome trust list to enable https testing. # add the ca to chrome trust list to enable https testing.
[Arguments] ${password}=%{HARBOR_PASSWORD} ${cert}=harbor_ca.crt [Arguments] ${password}=%{HARBOR_PASSWORD} ${cert}=harbor_ca.crt
${rand}= Evaluate random.randint(0, 100000) modules=random ${rand}= Evaluate random.randint(0, 100000) modules=random
Log To Console Generate Certificate Authority For Chrome Log To Console Generate Certificate Authority For Chrome
${rc} ${out}= Run And Return Rc And Output echo ${password} > password${rand}.ca ${rc} ${out}= Run And Return Rc And Output echo ${password} > password${rand}.ca
Log ALL ${out} Log ALL ${out}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
${rc} ${out}= Run And Return Rc And Output certutil -d sql:$HOME/.pki/nssdb -A -t TC -f password${rand}.ca -n "Harbor${rand}" -i ./harbor_ca.crt ${rc} ${out}= Run And Return Rc And Output certutil -d sql:$HOME/.pki/nssdb -A -t TC -f password${rand}.ca -n "Harbor${rand}" -i ./harbor_ca.crt
Log ALL ${out} Log ALL ${out}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Generate Certificate Authority Generate Certificate Authority
# Generates CA (private/ca.key.pem, certs/ca.cert.pem, certs/STARK_ENTERPRISES_ROOT_CA.crt) in OUT_DIR # Generates CA (private/ca.key.pem, certs/ca.cert.pem, certs/STARK_ENTERPRISES_ROOT_CA.crt) in OUT_DIR
[Arguments] ${CA_NAME}=STARK_ENTERPRISES_ROOT_CA ${OUT_DIR}=/root/ca [Arguments] ${CA_NAME}=STARK_ENTERPRISES_ROOT_CA ${OUT_DIR}=/root/ca
Log To Console Generating Certificate Authority Log To Console Generating Certificate Authority
${rc} ${out}= Run And Return Rc And Output generate-ca.sh -c ${CA_NAME} -d ${OUT_DIR} ${rc} ${out}= Run And Return Rc And Output generate-ca.sh -c ${CA_NAME} -d ${OUT_DIR}
Log ${out} Log ${out}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Generate Wildcard Server Certificate Generate Wildcard Server Certificate
# Generates key and signs with CA for *.DOMAIN (csr/*.DOMAIN.csr.pem, # Generates key and signs with CA for *.DOMAIN (csr/*.DOMAIN.csr.pem,
# private/*.DOMAIN.key.pem, certs/*.DOMAIN.cert.pem) in OUT_DIR # private/*.DOMAIN.key.pem, certs/*.DOMAIN.cert.pem) in OUT_DIR
[Arguments] ${DOMAIN}=%{DOMAIN} ${OUT_DIR}=/root/ca ${CA_NAME}=STARK_ENTERPRISES_ROOT_CA [Arguments] ${DOMAIN}=%{DOMAIN} ${OUT_DIR}=/root/ca ${CA_NAME}=STARK_ENTERPRISES_ROOT_CA
Log To Console Generating Wildcard Server Certificate Log To Console Generating Wildcard Server Certificate
Run Keyword Generate Server Key And CSR *.${DOMAIN} ${OUT_DIR} Run Keyword Generate Server Key And CSR *.${DOMAIN} ${OUT_DIR}
Run Keyword Sign Server CSR ${CA_NAME} *.${DOMAIN} ${OUT_DIR} Run Keyword Sign Server CSR ${CA_NAME} *.${DOMAIN} ${OUT_DIR}
Run Keyword Create Certificate Bundle CA_NAME=${CA_NAME} SRC_DIR=${OUT_DIR} CN=*.${DOMAIN} Run Keyword Create Certificate Bundle CA_NAME=${CA_NAME} SRC_DIR=${OUT_DIR} CN=*.${DOMAIN}
${out}= Run ls -al ${OUT_DIR}/csr ${out}= Run ls -al ${OUT_DIR}/csr
Log ${out} Log ${out}
${out}= Run ls -al ${OUT_DIR}/private ${out}= Run ls -al ${OUT_DIR}/private
Log ${out} Log ${out}
${out}= Run ls -al ${OUT_DIR}/certs ${out}= Run ls -al ${OUT_DIR}/certs
Log ${out} Log ${out}
Generate Server Key And CSR Generate Server Key And CSR
# Generates key and CSR (private/DOMAIN.key.pem, csr/DOMAIN.csr.pem) in OUT_DIR # Generates key and CSR (private/DOMAIN.key.pem, csr/DOMAIN.csr.pem) in OUT_DIR
[Arguments] ${CN}=%{DOMAIN} ${OUT_DIR}=/root/ca [Arguments] ${CN}=%{DOMAIN} ${OUT_DIR}=/root/ca
Log To Console Generating Server Key And CSR Log To Console Generating Server Key And CSR
${out}= Run generate-server-key-csr.sh -d ${OUT_DIR} -n ${CN} ${out}= Run generate-server-key-csr.sh -d ${OUT_DIR} -n ${CN}
Log ${out} Log ${out}
Sign Server CSR Sign Server CSR
# Generates certificate signed by CA (certs/DOMAIN.cert.pem) in OUT_DIR # Generates certificate signed by CA (certs/DOMAIN.cert.pem) in OUT_DIR
[Arguments] ${CA_NAME}=STARK_ENTERPRISES_ROOT_CA ${CN}=%{DOMAIN} ${OUT_DIR}=/root/ca [Arguments] ${CA_NAME}=STARK_ENTERPRISES_ROOT_CA ${CN}=%{DOMAIN} ${OUT_DIR}=/root/ca
Log To Console Signing Server CSR Log To Console Signing Server CSR
${out}= Run sign-csr.sh -c ${CA_NAME} -d ${OUT_DIR} -n ${CN} ${out}= Run sign-csr.sh -c ${CA_NAME} -d ${OUT_DIR} -n ${CN}
Log ${out} Log ${out}
Trust Certificate Authority Trust Certificate Authority
# Installs root certificate into trust store on Debian based distro # Installs root certificate into trust store on Debian based distro
[Arguments] ${CRT_FILE}=/root/ca/certs/STARK_ENTERPRISES_ROOT_CA.crt [Arguments] ${CRT_FILE}=/root/ca/certs/STARK_ENTERPRISES_ROOT_CA.crt
Log To Console Installing CA Log To Console Installing CA
${rc} ${out}= Run And Return Rc And Output ubuntu-install-ca.sh -f ${CRT_FILE} ${rc} ${out}= Run And Return Rc And Output ubuntu-install-ca.sh -f ${CRT_FILE}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Log ${out} Log ${out}
Reload Default Certificate Authorities Reload Default Certificate Authorities
# Reloads default certificates into trust store on Debian based distro # Reloads default certificates into trust store on Debian based distro
# Removes all user provided CAs # Removes all user provided CAs
Log To Console Reloading Default CAs Log To Console Reloading Default CAs
${rc} ${out}= Run And Return Rc And Output ubuntu-reload-cas.sh ${rc} ${out}= Run And Return Rc And Output ubuntu-reload-cas.sh
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Log ${out} Log ${out}
Create Certificate Bundle Create Certificate Bundle
[Arguments] ${CA_NAME}=STARK_ENTERPRISES_ROOT_CA ${SRC_DIR}=/root/ca ${OUT_FILE}=/root/ca/cert-bundle.tgz ${CN}=%{DOMAIN} ${TMP_DIR}=/root/ca/bundle [Arguments] ${CA_NAME}=STARK_ENTERPRISES_ROOT_CA ${SRC_DIR}=/root/ca ${OUT_FILE}=/root/ca/cert-bundle.tgz ${CN}=%{DOMAIN} ${TMP_DIR}=/root/ca/bundle
${rc} ${out}= Run And Return Rc And Output bundle-certs.sh -c ${CA_NAME} -d ${SRC_DIR} -f ${OUT_FILE} -n ${CN} -o ${TMP_DIR} ${rc} ${out}= Run And Return Rc And Output bundle-certs.sh -c ${CA_NAME} -d ${SRC_DIR} -f ${OUT_FILE} -n ${CN} -o ${TMP_DIR}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Log ${out} Log ${out}
Get Certificate Authority CRT Get Certificate Authority CRT
# Return ascii armored certificate from file e.g. `-----BEGIN CERTIFICATE-----` # Return ascii armored certificate from file e.g. `-----BEGIN CERTIFICATE-----`
[Arguments] ${CA_CRT}=STARK_ENTERPRISES_ROOT_CA.crt ${DIR}=/root/ca/certs [Arguments] ${CA_CRT}=STARK_ENTERPRISES_ROOT_CA.crt ${DIR}=/root/ca/certs
${out}= Run cat ${DIR}/${CA_CRT} ${out}= Run cat ${DIR}/${CA_CRT}
[Return] ${out} [Return] ${out}
Get Server Certificate Get Server Certificate
# Return ascii armored certificate from file e.g. `-----BEGIN CERTIFICATE-----` # Return ascii armored certificate from file e.g. `-----BEGIN CERTIFICATE-----`
# PEM must be provided if using a wildcard cert not specified by DOMAIN # PEM must be provided if using a wildcard cert not specified by DOMAIN
[Arguments] ${PEM}=%{DOMAIN}.cert.pem ${DIR}=/root/ca/certs [Arguments] ${PEM}=%{DOMAIN}.cert.pem ${DIR}=/root/ca/certs
${out}= Run cat ${DIR}/${PEM} ${out}= Run cat ${DIR}/${PEM}
[Return] ${out} [Return] ${out}
Get Server Key Get Server Key
# Return ascii armored key from file e.g. `-----BEGIN RSA PRIVATE KEY-----` # Return ascii armored key from file e.g. `-----BEGIN RSA PRIVATE KEY-----`
# PEM must be provided if using a wildcard cert not specified by DOMAIN # PEM must be provided if using a wildcard cert not specified by DOMAIN
[Arguments] ${PEM}=%{DOMAIN}.key.pem ${DIR}=/root/ca/private [Arguments] ${PEM}=%{DOMAIN}.key.pem ${DIR}=/root/ca/private
${out}= Run cat ${DIR}/${PEM} ${out}= Run cat ${DIR}/${PEM}
[Return] ${out} [Return] ${out}

View File

@ -1,279 +1,279 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides helper functions for docker operations Documentation This resource provides helper functions for docker operations
Library OperatingSystem Library OperatingSystem
Library Process Library Process
*** Keywords *** *** Keywords ***
Run Docker Info Run Docker Info
[Arguments] ${docker-params} [Arguments] ${docker-params}
Wait Unitl Command Success docker ${docker-params} info Wait Unitl Command Success docker ${docker-params} info
Pull image Pull image
[Arguments] ${ip} ${user} ${pwd} ${project} ${image} ${tag}=${null} ${is_robot}=${false} [Arguments] ${ip} ${user} ${pwd} ${project} ${image} ${tag}=${null} ${is_robot}=${false}
Log To Console \nRunning docker pull ${image}... Log To Console \nRunning docker pull ${image}...
${image_with_tag}= Set Variable If '${tag}'=='${null}' ${image} ${image}:${tag} ${image_with_tag}= Set Variable If '${tag}'=='${null}' ${image} ${image}:${tag}
Run Keyword If ${is_robot}==${false} Wait Unitl Command Success docker login -u ${user} -p ${pwd} ${ip} Run Keyword If ${is_robot}==${false} Wait Unitl Command Success docker login -u ${user} -p ${pwd} ${ip}
... ELSE Wait Unitl Command Success docker login -u robot\\\$${project}+${user} -p ${pwd} ${ip} ... ELSE Wait Unitl Command Success docker login -u robot\\\$${project}+${user} -p ${pwd} ${ip}
${output}= Docker Pull ${ip}/${project}/${image_with_tag} ${output}= Docker Pull ${ip}/${project}/${image_with_tag}
Log ${output} Log ${output}
Log To Console ${output} Log To Console ${output}
Should Contain ${output} Digest: Should Contain ${output} Digest:
Should Contain ${output} Status: Should Contain ${output} Status:
Should Not Contain ${output} No such image: Should Not Contain ${output} No such image:
#Remove image for docker 20 #Remove image for docker 20
Clean All Local Images Clean All Local Images
Push image Push image
# If no tag provided in $(image_with_or_without_tag}, latest will be the tag pulled from docker-hub or read from local # If no tag provided in $(image_with_or_without_tag}, latest will be the tag pulled from docker-hub or read from local
[Arguments] ${ip} ${user} ${pwd} ${project} ${image_with_or_without_tag} ${need_pull_first}=${true} ${sha256}=${null} ${is_robot}=${false} [Arguments] ${ip} ${user} ${pwd} ${project} ${image_with_or_without_tag} ${need_pull_first}=${true} ${sha256}=${null} ${is_robot}=${false}
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
${image_in_use}= Set Variable If '${sha256}'=='${null}' ${image_with_or_without_tag} ${image_with_or_without_tag}@sha256:${sha256} ${image_in_use}= Set Variable If '${sha256}'=='${null}' ${image_with_or_without_tag} ${image_with_or_without_tag}@sha256:${sha256}
${image_in_use_with_tag}= Set Variable If '${sha256}'=='${null}' ${image_with_or_without_tag} ${image_with_or_without_tag}:${sha256} ${image_in_use_with_tag}= Set Variable If '${sha256}'=='${null}' ${image_with_or_without_tag} ${image_with_or_without_tag}:${sha256}
Sleep 3 Sleep 3
Log To Console \nRunning docker push ${image_with_or_without_tag}... Log To Console \nRunning docker push ${image_with_or_without_tag}...
${image_in_use}= Set Variable If ${need_pull_first}==${true} ${image_in_use} ${image_with_or_without_tag} ${image_in_use}= Set Variable If ${need_pull_first}==${true} ${image_in_use} ${image_with_or_without_tag}
Run Keyword If ${need_pull_first}==${true} Docker Pull ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image_in_use} Run Keyword If ${need_pull_first}==${true} Docker Pull ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image_in_use}
Run Keyword If ${is_robot}==${false} Wait Unitl Command Success docker login -u ${user} -p ${pwd} ${ip} Run Keyword If ${is_robot}==${false} Wait Unitl Command Success docker login -u ${user} -p ${pwd} ${ip}
... ELSE Wait Unitl Command Success docker login -u robot\\\$${project}+${user} -p ${pwd} ${ip} ... ELSE Wait Unitl Command Success docker login -u robot\\\$${project}+${user} -p ${pwd} ${ip}
Run Keyword If ${need_pull_first}==${true} Wait Unitl Command Success docker tag ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image_in_use} ${ip}/${project}/${image_in_use_with_tag} Run Keyword If ${need_pull_first}==${true} Wait Unitl Command Success docker tag ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image_in_use} ${ip}/${project}/${image_in_use_with_tag}
... ELSE Wait Unitl Command Success docker tag ${image_in_use} ${ip}/${project}/${image_in_use_with_tag} ... ELSE Wait Unitl Command Success docker tag ${image_in_use} ${ip}/${project}/${image_in_use_with_tag}
Wait Unitl Command Success docker push ${ip}/${project}/${image_in_use_with_tag} Wait Unitl Command Success docker push ${ip}/${project}/${image_in_use_with_tag}
Wait Unitl Command Success docker logout ${ip} Wait Unitl Command Success docker logout ${ip}
#Remove image for docker 20 #Remove image for docker 20
Clean All Local Images Clean All Local Images
Sleep 1 Sleep 1
Push Image With Tag Push Image With Tag
#tag1 is tag of image on docker hub,default latest,use a existed version if you do not want to use latest #tag1 is tag of image on docker hub,default latest,use a existed version if you do not want to use latest
[Arguments] ${ip} ${user} ${pwd} ${project} ${image} ${tag} ${tag1}=latest [Arguments] ${ip} ${user} ${pwd} ${project} ${image} ${tag} ${tag1}=latest
Log To Console \nRunning docker push ${image}... Log To Console \nRunning docker push ${image}...
Docker Pull ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image}:${tag1} Docker Pull ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image}:${tag1}
Wait Unitl Command Success docker login -u ${user} -p ${pwd} ${ip} Wait Unitl Command Success docker login -u ${user} -p ${pwd} ${ip}
Wait Unitl Command Success docker tag ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image}:${tag1} ${ip}/${project}/${image}:${tag} Wait Unitl Command Success docker tag ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image}:${tag1} ${ip}/${project}/${image}:${tag}
Wait Unitl Command Success docker push ${ip}/${project}/${image}:${tag} Wait Unitl Command Success docker push ${ip}/${project}/${image}:${tag}
Wait Unitl Command Success docker logout ${ip} Wait Unitl Command Success docker logout ${ip}
#Remove image for docker 20 #Remove image for docker 20
Clean All Local Images Clean All Local Images
Clean All Local Images Clean All Local Images
${rc} ${out}= Run Keyword And Ignore Error Run docker rmi -f $(docker images -a -q) ${rc} ${out}= Run Keyword And Ignore Error Run docker rmi -f $(docker images -a -q)
Log All ${out} Log All ${out}
${rc} ${out}= Run Keyword And Ignore Error Run docker system prune -a -f ${rc} ${out}= Run Keyword And Ignore Error Run docker system prune -a -f
Log All ${out} Log All ${out}
Cannot Docker Login Harbor Cannot Docker Login Harbor
[Arguments] ${ip} ${user} ${pwd} [Arguments] ${ip} ${user} ${pwd}
Command Should be Failed docker login -u ${user} -p ${pwd} ${ip} Command Should be Failed docker login -u ${user} -p ${pwd} ${ip}
Cannot Pull Image Cannot Pull Image
[Arguments] ${ip} ${user} ${pwd} ${project} ${image} ${tag}=${null} ${err_msg}=${null} [Arguments] ${ip} ${user} ${pwd} ${project} ${image} ${tag}=${null} ${err_msg}=${null}
Restart Process Locally containerd Restart Process Locally containerd
Restart Process Locally dockerd Restart Process Locally dockerd
${image_with_tag}= Set Variable If '${tag}'=='${null}' ${image} ${image}:${tag} ${image_with_tag}= Set Variable If '${tag}'=='${null}' ${image} ${image}:${tag}
Wait Unitl Command Success docker login -u ${user} -p ${pwd} ${ip} Wait Unitl Command Success docker login -u ${user} -p ${pwd} ${ip}
FOR ${idx} IN RANGE 0 30 FOR ${idx} IN RANGE 0 30
${out} Run Keyword And Ignore Error Command Should be Failed docker pull ${ip}/${project}/${image_with_tag} ${out} Run Keyword And Ignore Error Command Should be Failed docker pull ${ip}/${project}/${image_with_tag}
Exit For Loop If '${out[0]}'=='PASS' Exit For Loop If '${out[0]}'=='PASS'
Sleep 3 Sleep 3
END END
Clean All Local Images Clean All Local Images
Log To Console Cannot Pull Image - Pull Log: ${out[1]} Log To Console Cannot Pull Image - Pull Log: ${out[1]}
Should Be Equal As Strings '${out[0]}' 'PASS' Should Be Equal As Strings '${out[0]}' 'PASS'
Run Keyword If '${err_msg}' != '${null}' Should Contain ${out[1]} ${err_msg} Run Keyword If '${err_msg}' != '${null}' Should Contain ${out[1]} ${err_msg}
Cannot Push image Cannot Push image
[Arguments] ${ip} ${user} ${pwd} ${project} ${image} ${err_msg}=${null} ${err_msg_2}=${null} [Arguments] ${ip} ${user} ${pwd} ${project} ${image} ${err_msg}=${null} ${err_msg_2}=${null}
Log To Console \nRunning docker push ${image}... Log To Console \nRunning docker push ${image}...
Docker Pull ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image} Docker Pull ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image}
Wait Unitl Command Success docker login -u ${user} -p ${pwd} ${ip} Wait Unitl Command Success docker login -u ${user} -p ${pwd} ${ip}
Wait Unitl Command Success docker tag ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image} ${ip}/${project}/${image} Wait Unitl Command Success docker tag ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image} ${ip}/${project}/${image}
${output}= Command Should be Failed docker push ${ip}/${project}/${image} ${output}= Command Should be Failed docker push ${ip}/${project}/${image}
Log To Console ${output} Log To Console ${output}
Run Keyword If '${err_msg}' != '${null}' Should Contain ${output} ${err_msg} Run Keyword If '${err_msg}' != '${null}' Should Contain ${output} ${err_msg}
Run Keyword If '${err_msg_2}' != '${null}' Should Contain ${output} ${err_msg_2} Run Keyword If '${err_msg_2}' != '${null}' Should Contain ${output} ${err_msg_2}
Wait Unitl Command Success docker logout ${ip} Wait Unitl Command Success docker logout ${ip}
Clean All Local Images Clean All Local Images
Wait Until Container Stops Wait Until Container Stops
[Arguments] ${container} [Arguments] ${container}
FOR ${idx} IN RANGE 0 60 FOR ${idx} IN RANGE 0 60
${out}= Run docker %{VCH-PARAMS} inspect ${container} | grep Status ${out}= Run docker %{VCH-PARAMS} inspect ${container} | grep Status
${status}= Run Keyword And Return Status Should Contain ${out} exited ${status}= Run Keyword And Return Status Should Contain ${out} exited
Return From Keyword If ${status} Return From Keyword If ${status}
Sleep 1 Sleep 1
END END
Fail Container did not stop within 60 seconds Fail Container did not stop within 60 seconds
Hit Nginx Endpoint Hit Nginx Endpoint
[Arguments] ${vch-ip} ${port} [Arguments] ${vch-ip} ${port}
Wait Unitl Command Success wget ${vch-ip}:${port} Wait Unitl Command Success wget ${vch-ip}:${port}
Get Container IP Get Container IP
[Arguments] ${docker-params} ${id} ${network}=default ${dockercmd}=docker [Arguments] ${docker-params} ${id} ${network}=default ${dockercmd}=docker
${ip}= Wait Unitl Command Success ${dockercmd} ${docker-params} network inspect ${network} | jq '.[0].Containers."${id}".IPv4Address' | cut -d \\" -f 2 | cut -d \\/ -f 1 ${ip}= Wait Unitl Command Success ${dockercmd} ${docker-params} network inspect ${network} | jq '.[0].Containers."${id}".IPv4Address' | cut -d \\" -f 2 | cut -d \\/ -f 1
[Return] ${ip} [Return] ${ip}
# The local dind version is embedded in Dockerfile # The local dind version is embedded in Dockerfile
# docker:1.13-dind # docker:1.13-dind
# If you are running this keyword in a container, make sure it is run with --privileged turned on # If you are running this keyword in a container, make sure it is run with --privileged turned on
Start Docker Daemon Locally Start Docker Daemon Locally
${pid}= Run pidof dockerd ${pid}= Run pidof dockerd
#${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/docker_config.sh #${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/docker_config.sh
#Log ${output} #Log ${output}
#Should Be Equal As Integers ${rc} 0 #Should Be Equal As Integers ${rc} 0
Return From Keyword If '${pid}' != '${EMPTY}' Return From Keyword If '${pid}' != '${EMPTY}'
OperatingSystem.File Should Exist /usr/local/bin/dockerd-entrypoint.sh 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 ${handle}= Start Process /usr/local/bin/dockerd-entrypoint.sh dockerd>./daemon-local.log 2>&1 shell=True
Process Should Be Running ${handle} Process Should Be Running ${handle}
FOR ${IDX} IN RANGE 5 FOR ${IDX} IN RANGE 5
${pid}= Run pidof dockerd ${pid}= Run pidof dockerd
Exit For Loop If '${pid}' != '${EMPTY}' Exit For Loop If '${pid}' != '${EMPTY}'
Sleep 2s Sleep 2s
END END
Sleep 2s Sleep 2s
[Return] ${handle} [Return] ${handle}
Start Containerd Daemon Locally Start Containerd Daemon Locally
${handle}= Start Process /usr/local/bin/containerd > ./daemon-local.log 2>&1 & shell=True ${handle}= Start Process /usr/local/bin/containerd > ./daemon-local.log 2>&1 & shell=True
FOR ${IDX} IN RANGE 5 FOR ${IDX} IN RANGE 5
${pid}= Run pidof /usr/local/bin/containerd ${pid}= Run pidof /usr/local/bin/containerd
Log To Console pid: ${pid} Log To Console pid: ${pid}
Exit For Loop If '${pid}' != '${EMPTY}' Exit For Loop If '${pid}' != '${EMPTY}'
Sleep 2s Sleep 2s
END END
Sleep 2s Sleep 2s
[Return] ${handle} [Return] ${handle}
Restart Process Locally Restart Process Locally
[Arguments] ${process} [Arguments] ${process}
${full_process}= Set Variable If ${full_process}= Set Variable If
... '${process}'=='containerd' /usr/local/bin/containerd dockerd ... '${process}'=='containerd' /usr/local/bin/containerd dockerd
${start_process_cmd}= Set Variable If ${start_process_cmd}= Set Variable If
... '${process}'=='dockerd' /usr/local/bin/dockerd-entrypoint.sh dockerd>./daemon-local.log 2>&1 ... '${process}'=='dockerd' /usr/local/bin/dockerd-entrypoint.sh dockerd>./daemon-local.log 2>&1
... '${process}'=='containerd' ${full_process} > ./daemon-local.log 2>&1 & ... '${process}'=='containerd' ${full_process} > ./daemon-local.log 2>&1 &
Should Be True '${start_process_cmd}' != '${EMPTY}' Should Be True '${start_process_cmd}' != '${EMPTY}'
Run Keyword If '${process}'=='dockerd' OperatingSystem.File Should Exist /usr/local/bin/dockerd-entrypoint.sh Run Keyword If '${process}'=='dockerd' OperatingSystem.File Should Exist /usr/local/bin/dockerd-entrypoint.sh
FOR ${IDX} IN RANGE 5 FOR ${IDX} IN RANGE 5
${pid}= Run pidof ${full_process} ${pid}= Run pidof ${full_process}
Exit For Loop If '${pid}' == '${EMPTY}' Exit For Loop If '${pid}' == '${EMPTY}'
${result}= Run kill ${pid} ${result}= Run kill ${pid}
Log To Console Kill docker process: ${result} Log To Console Kill docker process: ${result}
Sleep 2s Sleep 2s
END END
${pid}= Run pidof ${full_process} ${pid}= Run pidof ${full_process}
Should Be Equal As Strings '${pid}' '${EMPTY}' Should Be Equal As Strings '${pid}' '${EMPTY}'
${result}= Run rm -rf /var/lib/${process}/* ${result}= Run rm -rf /var/lib/${process}/*
Log All Clear /var/lib/${process}: ${result} Log All Clear /var/lib/${process}: ${result}
${handle}= Start Process ${start_process_cmd} shell=True ${handle}= Start Process ${start_process_cmd} shell=True
Log All handle : ${handle} Log All handle : ${handle}
FOR ${IDX} IN RANGE 5 FOR ${IDX} IN RANGE 5
${pid}= Run pidof ${full_process} ${pid}= Run pidof ${full_process}
Log All pid : ${pid} Log All pid : ${pid}
Exit For Loop If '${pid}' != '${EMPTY}' Exit For Loop If '${pid}' != '${EMPTY}'
Sleep 2s Sleep 2s
END END
Sleep 2s Sleep 2s
#Process Should Be Running ${handle} #Process Should Be Running ${handle}
${result}= Run ps aux |grep ${full_process} ${result}= Run ps aux |grep ${full_process}
Log All result : ${result} Log All result : ${result}
[Return] ${handle} [Return] ${handle}
Prepare Docker Cert In Ubuntu Prepare Docker Cert In Ubuntu
[Arguments] ${ip} ${cert} [Arguments] ${ip} ${cert}
Wait Unitl Command Success mkdir -p /etc/docker/certs.d/${ip} Wait Unitl Command Success mkdir -p /etc/docker/certs.d/${ip}
Wait Unitl Command Success cp ${cert} /etc/docker/certs.d/${ip} Wait Unitl Command Success cp ${cert} /etc/docker/certs.d/${ip}
Wait Unitl Command Success cp ${cert} /usr/local/share/ca-certificates/ Wait Unitl Command Success cp ${cert} /usr/local/share/ca-certificates/
#Add pivotal ecs cert for docker manifest push test. #Add pivotal ecs cert for docker manifest push test.
Wait Unitl Command Success cp /ecs_ca/vmwarecert.crt /usr/local/share/ca-certificates/ Wait Unitl Command Success cp /ecs_ca/vmwarecert.crt /usr/local/share/ca-certificates/
Wait Unitl Command Success update-ca-certificates Wait Unitl Command Success update-ca-certificates
Prepare Docker Cert In Photon Prepare Docker Cert In Photon
[Arguments] ${ip} ${cert} [Arguments] ${ip} ${cert}
Log All Prepare Docker Cert In Photon ${cert} Log All Prepare Docker Cert In Photon ${cert}
${rc} ${output}= Run And Return Rc and Output cat ${cert} ${rc} ${output}= Run And Return Rc and Output cat ${cert}
Log All CA output: ${output} Log All CA output: ${output}
Wait Unitl Command Success cat ${cert} >> /etc/pki/tls/certs/ca-bundle.crt Wait Unitl Command Success cat ${cert} >> /etc/pki/tls/certs/ca-bundle.crt
Wait Unitl Command Success mkdir -p /etc/docker/certs.d/${ip} Wait Unitl Command Success mkdir -p /etc/docker/certs.d/${ip}
Wait Unitl Command Success cp ${cert} /etc/docker/certs.d/${ip} Wait Unitl Command Success cp ${cert} /etc/docker/certs.d/${ip}
Kill Local Docker Daemon Kill Local Docker Daemon
[Arguments] ${handle} ${dockerd-pid} [Arguments] ${handle} ${dockerd-pid}
Terminate Process ${handle} Terminate Process ${handle}
Process Should Be Stopped ${handle} Process Should Be Stopped ${handle}
Wait Unitl Command Success kill -9 ${dockerd-pid} Wait Unitl Command Success kill -9 ${dockerd-pid}
Docker Login Fail Docker Login Fail
[Arguments] ${ip} ${user} ${pwd} [Arguments] ${ip} ${user} ${pwd}
Log To Console \nRunning docker login ${ip} ... Log To Console \nRunning docker login ${ip} ...
${output}= Command Should be Failed docker login -u ${user} -p ${pwd} ${ip} ${output}= Command Should be Failed docker login -u ${user} -p ${pwd} ${ip}
Should Contain ${output} unauthorized Should Contain ${output} unauthorized
Should Not Contain ${output} 500 Internal Server Error Should Not Contain ${output} 500 Internal Server Error
Docker Login Docker Login
[Arguments] ${server} ${username} ${password} [Arguments] ${server} ${username} ${password}
Wait Unitl Command Success docker login -u ${username} -p ${password} ${server} Wait Unitl Command Success docker login -u ${username} -p ${password} ${server}
Docker Pull Docker Pull
[Arguments] ${image} [Arguments] ${image}
${output}= Retry Keyword N Times When Error 6 Wait Unitl Command Success docker pull ${image} ${output}= Retry Keyword N Times When Error 6 Wait Unitl Command Success docker pull ${image}
Log All Docker Pull: ${output} Log All Docker Pull: ${output}
[Return] ${output} [Return] ${output}
Docker Tag Docker Tag
[Arguments] ${src_image} ${dst_image} [Arguments] ${src_image} ${dst_image}
Wait Unitl Command Success docker tag ${src_image} ${dst_image} Wait Unitl Command Success docker tag ${src_image} ${dst_image}
Docker Push Docker Push
[Arguments] ${image} [Arguments] ${image}
Wait Unitl Command Success docker push ${image} Wait Unitl Command Success docker push ${image}
Docker Push Index Docker Push Index
[Arguments] ${ip} ${user} ${pwd} ${index} ${image1} ${image2} [Arguments] ${ip} ${user} ${pwd} ${index} ${image1} ${image2}
${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/docker_push_manifest_list.sh ${ip} ${user} ${pwd} ${index} ${image1} ${image2} ${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/docker_push_manifest_list.sh ${ip} ${user} ${pwd} ${index} ${image1} ${image2}
Log ${output} Log ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Docker Image Can Not Be Pulled Docker Image Can Not Be Pulled
[Arguments] ${image} [Arguments] ${image}
FOR ${idx} IN RANGE 0 30 FOR ${idx} IN RANGE 0 30
${out}= Run Keyword And Ignore Error Docker Login "" ${DOCKER_USER} ${DOCKER_PWD} ${out}= Run Keyword And Ignore Error Docker Login "" ${DOCKER_USER} ${DOCKER_PWD}
Log To Console Return value is ${out} Log To Console Return value is ${out}
${out}= Run Keyword And Ignore Error Command Should be Failed docker pull ${image} ${out}= Run Keyword And Ignore Error Command Should be Failed docker pull ${image}
Exit For Loop If '${out[0]}'=='PASS' Exit For Loop If '${out[0]}'=='PASS'
Log To Console Docker pull return value is ${out} Log To Console Docker pull return value is ${out}
Sleep 3 Sleep 3
END END
Clean All Local Images Clean All Local Images
Log To Console Cannot Pull Image From Docker - Pull Log: ${out[1]} Log To Console Cannot Pull Image From Docker - Pull Log: ${out[1]}
Should Be Equal As Strings '${out[0]}' 'PASS' Should Be Equal As Strings '${out[0]}' 'PASS'
Docker Image Can Be Pulled Docker Image Can Be Pulled
[Arguments] ${image} ${period}=60 ${times}=2 [Arguments] ${image} ${period}=60 ${times}=2
FOR ${n} IN RANGE 1 ${times} FOR ${n} IN RANGE 1 ${times}
Sleep ${period} Sleep ${period}
${out}= Run Keyword And Ignore Error Docker Login "" ${DOCKER_USER} ${DOCKER_PWD} ${out}= Run Keyword And Ignore Error Docker Login "" ${DOCKER_USER} ${DOCKER_PWD}
Log To Console Return value is ${out} Log To Console Return value is ${out}
${out}= Run Keyword And Ignore Error Docker Pull ${image} ${out}= Run Keyword And Ignore Error Docker Pull ${image}
Log To Console Return value is ${out[0]} Log To Console Return value is ${out[0]}
Exit For Loop If '${out[0]}'=='PASS' Exit For Loop If '${out[0]}'=='PASS'
Sleep 5 Sleep 5
END END
Clean All Local Images Clean All Local Images
Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot
Should Be Equal As Strings '${out[0]}' 'PASS' Should Be Equal As Strings '${out[0]}' 'PASS'

View File

@ -1,31 +1,31 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource contains any keywords related to using the Drone CI Build System Documentation This resource contains any keywords related to using the Drone CI Build System
*** Keywords *** *** Keywords ***
Get State Of Drone Build Get State Of Drone Build
[Arguments] ${num} [Arguments] ${num}
Return From Keyword If '${num}' == '0' local Return From Keyword If '${num}' == '0' local
${out}= Run drone build info vmware/vic ${num} ${out}= Run drone build info vmware/vic ${num}
${lines}= Split To Lines ${out} ${lines}= Split To Lines ${out}
[Return] @{lines}[2] [Return] @{lines}[2]
Get Title of Drone Build Get Title of Drone Build
[Arguments] ${num} [Arguments] ${num}
Return From Keyword If '${num}' == '0' local Return From Keyword If '${num}' == '0' local
${out}= Run drone build info vmware/vic ${num} ${out}= Run drone build info vmware/vic ${num}
${lines}= Split To Lines ${out} ${lines}= Split To Lines ${out}
[Return] @{lines}[-1] [Return] @{lines}[-1]

View File

@ -1,29 +1,29 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides keywords to interact with Github Documentation This resource provides keywords to interact with Github
*** Keywords *** *** Keywords ***
Get State Of Github Issue Get State Of Github Issue
[Arguments] ${num} [Arguments] ${num}
[Tags] secret [Tags] secret
FOR ${idx} IN RANGE 0 5 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} ${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}' Exit For Loop If '${status}'
Sleep 1 Sleep 1
END END
Should Be Equal ${result.status_code} ${200} Should Be Equal ${result.status_code} ${200}
${status}= Get From Dictionary ${result.json()} state ${status}= Get From Dictionary ${result.json()} state
[Return] ${status} [Return] ${status}

View File

@ -1,60 +1,60 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
*** Variables *** *** Variables ***
*** Keywords *** *** Keywords ***
Assign User Admin Assign User Admin
[Arguments] ${user} [Arguments] ${user}
Retry Element Click xpath=//harbor-user//hbr-filter//clr-icon Retry Element Click xpath=//harbor-user//hbr-filter//clr-icon
Input Text xpath=//harbor-user//hbr-filter//input ${user} Input Text xpath=//harbor-user//hbr-filter//input ${user}
Sleep 2 Sleep 2
#select checkbox #select checkbox
Retry Element Click //clr-dg-row[contains(.,'${user}')]//label Retry Element Click //clr-dg-row[contains(.,'${user}')]//label
#click assign admin #click assign admin
Retry Element Click //*[@id='set-admin'] Retry Element Click //*[@id='set-admin']
Sleep 1 Sleep 1
Switch to User Tag Switch to User Tag
Retry Element Click xpath=${administration_user_tag_xpath} Retry Element Click xpath=${administration_user_tag_xpath}
Sleep 1 Sleep 1
Administration Tag Should Display Administration Tag Should Display
Retry Wait Until Page Contains Element xpath=${administration_tag_xpath} Retry Wait Until Page Contains Element xpath=${administration_tag_xpath}
User Email Should Exist User Email Should Exist
[Arguments] ${email} [Arguments] ${email}
Sign In Harbor ${HARBOR_URL} %{HARBOR_ADMIN} %{HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} %{HARBOR_ADMIN} %{HARBOR_PASSWORD}
Switch to User Tag Switch to User Tag
Retry Wait Until Page Contains Element xpath=//clr-dg-cell[contains(., '${email}')] Retry Wait Until Page Contains Element xpath=//clr-dg-cell[contains(., '${email}')]
Add User Button Should Be Disabled Add User Button Should Be Disabled
Sleep 1 Sleep 1
Retry Wait Until Page Contains Element //button[contains(.,'New') and @disabled=''] Retry Wait Until Page Contains Element //button[contains(.,'New') and @disabled='']
Add A New User Add A New User
[Arguments] ${username} ${email} ${realname} ${newPassword} ${comment} [Arguments] ${username} ${email} ${realname} ${newPassword} ${comment}
Retry Element Click xpath=${add_new_user_button} Retry Element Click xpath=${add_new_user_button}
Retry Text Input xpath=${username_xpath} ${username} Retry Text Input xpath=${username_xpath} ${username}
Retry Text Input xpath=${email_xpath} ${email} Retry Text Input xpath=${email_xpath} ${email}
Retry Text Input xpath=${realname_xpath} ${realname} Retry Text Input xpath=${realname_xpath} ${realname}
Retry Text Input xpath=${newPassword_xpath} ${newPassword} Retry Text Input xpath=${newPassword_xpath} ${newPassword}
Retry Text Input xpath=${confirmPassword_xpath} ${newPassword} Retry Text Input xpath=${confirmPassword_xpath} ${newPassword}
Retry Text Input xpath=${comment_xpath} ${comment} Retry Text Input xpath=${comment_xpath} ${comment}
Retry Double Keywords When Error Retry Element Click xpath=${save_new_user_button} Retry Wait Until Page Not Contains Element xpath=${save_new_user_button} Retry Double Keywords When Error Retry Element Click xpath=${save_new_user_button} Retry Wait Until Page Not Contains Element xpath=${save_new_user_button}
Retry Wait Until Page Contains Element xpath=//harbor-user//clr-dg-row//clr-dg-cell[contains(., '${username}')] Retry Wait Until Page Contains Element xpath=//harbor-user//clr-dg-row//clr-dg-cell[contains(., '${username}')]

View File

@ -1,22 +1,22 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
*** Variables *** *** Variables ***
${administration_user_tag_xpath} //clr-vertical-nav-group-children/a[contains(.,'Users')] ${administration_user_tag_xpath} //clr-vertical-nav-group-children/a[contains(.,'Users')]
${administration_tag_xpath} //clr-vertical-nav-group[contains(.,'Admin')] ${administration_tag_xpath} //clr-vertical-nav-group[contains(.,'Admin')]
${add_new_user_button} //*[@id='add-new-user'] ${add_new_user_button} //*[@id='add-new-user']
${save_new_user_button} //*[@id='save-button'] ${save_new_user_button} //*[@id='save-button']

View File

@ -1,424 +1,424 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
*** Variables *** *** Variables ***
*** Keywords *** *** Keywords ***
Init LDAP Init LDAP
${rc} ${output}= Run And Return Rc And Output ip addr s eth0 |grep "inet "|awk '{print $2}' |awk -F "/" '{print $1}' ${rc} ${output}= Run And Return Rc And Output ip addr s eth0 |grep "inet "|awk '{print $2}' |awk -F "/" '{print $1}'
Log ${output} Log ${output}
Sleep 2 Sleep 2
Input Text xpath=//*[@id='ldapUrl'] ldaps://${output} Input Text xpath=//*[@id='ldapUrl'] ldaps://${output}
Sleep 1 Sleep 1
Input Text xpath=//*[@id='ldapSearchDN'] cn=admin,dc=example,dc=com Input Text xpath=//*[@id='ldapSearchDN'] cn=admin,dc=example,dc=com
Sleep 1 Sleep 1
Input Text xpath=//*[@id='ldapSearchPwd'] admin Input Text xpath=//*[@id='ldapSearchPwd'] admin
Sleep 1 Sleep 1
Input Text xpath=//*[@id='ldapBaseDN'] dc=example,dc=com Input Text xpath=//*[@id='ldapBaseDN'] dc=example,dc=com
Sleep 1 Sleep 1
Input Text xpath=//*[@id='ldapFilter'] (&(objectclass=inetorgperson)(memberof=cn=harbor_users,ou=groups,dc=example,dc=com)) Input Text xpath=//*[@id='ldapFilter'] (&(objectclass=inetorgperson)(memberof=cn=harbor_users,ou=groups,dc=example,dc=com))
Sleep 1 Sleep 1
Input Text xpath=//*[@id='ldapUid'] cn Input Text xpath=//*[@id='ldapUid'] cn
Sleep 1 Sleep 1
Disable Ldap Verify Cert Checkbox Disable Ldap Verify Cert Checkbox
Retry Element Click xpath=${config_auth_save_button_xpath} Retry Element Click xpath=${config_auth_save_button_xpath}
Sleep 2 Sleep 2
Retry Element Click xpath=/html/body/harbor-app/harbor-shell/clr-main-container/div/div/config/div/div/div/button[3] Retry Element Click xpath=/html/body/harbor-app/harbor-shell/clr-main-container/div/div/config/div/div/div/button[3]
Sleep 1 Sleep 1
Switch To Configure Switch To Configure
Retry Element Click xpath=${configuration_xpath} Retry Element Click xpath=${configuration_xpath}
Sleep 2 Sleep 2
Test Ldap Connection Test Ldap Connection
${rc} ${output}= Run And Return Rc And Output ip addr s eth0 |grep "inet "|awk '{print $2}' |awk -F "/" '{print $1}' ${rc} ${output}= Run And Return Rc And Output ip addr s eth0 |grep "inet "|awk '{print $2}' |awk -F "/" '{print $1}'
Log ${output} Log ${output}
Sleep 2 Sleep 2
Input Text xpath=//*[@id='ldapUrl'] ldaps://${output} Input Text xpath=//*[@id='ldapUrl'] ldaps://${output}
Sleep 1 Sleep 1
Input Text xpath=//*[@id='ldapSearchDN'] cn=admin,dc=example,dc=com Input Text xpath=//*[@id='ldapSearchDN'] cn=admin,dc=example,dc=com
Sleep 1 Sleep 1
Input Text xpath=//*[@id='ldapSearchPwd'] admin Input Text xpath=//*[@id='ldapSearchPwd'] admin
Sleep 1 Sleep 1
Input Text xpath=//*[@id='ldapBaseDN'] dc=example,dc=com Input Text xpath=//*[@id='ldapBaseDN'] dc=example,dc=com
Sleep 1 Sleep 1
Input Text xpath=//*[@id='ldapUid'] cn Input Text xpath=//*[@id='ldapUid'] cn
Sleep 1 Sleep 1
# default is checked, click test connection to verify fail as no cert. # default is checked, click test connection to verify fail as no cert.
Retry Element Click xpath=${test_ldap_xpath} Retry Element Click xpath=${test_ldap_xpath}
Sleep 1 Sleep 1
Wait Until Page Contains Failed to verify LDAP server with error Wait Until Page Contains Failed to verify LDAP server with error
Sleep 5 Sleep 5
Disable Ldap Verify Cert Checkbox Disable Ldap Verify Cert Checkbox
# ldap checkbox unchecked, click test connection to verify success. # ldap checkbox unchecked, click test connection to verify success.
Sleep 1 Sleep 1
Retry Element Click xpath=${test_ldap_xpath} Retry Element Click xpath=${test_ldap_xpath}
Wait Until Page Contains Connection to LDAP server is verified timeout=15 Wait Until Page Contains Connection to LDAP server is verified timeout=15
Test LDAP Server Success Test LDAP Server Success
Retry Element Click xpath=${test_ldap_xpath} Retry Element Click xpath=${test_ldap_xpath}
Wait Until Page Contains Connection to LDAP server is verified timeout=15 Wait Until Page Contains Connection to LDAP server is verified timeout=15
Disable Ldap Verify Cert Checkbox Disable Ldap Verify Cert Checkbox
Mouse Down xpath=//*[@id='clr-checkbox-ldapVerifyCert'] Mouse Down xpath=//*[@id='clr-checkbox-ldapVerifyCert']
Mouse Up xpath=//*[@id='clr-checkbox-ldapVerifyCert'] Mouse Up xpath=//*[@id='clr-checkbox-ldapVerifyCert']
Sleep 2 Sleep 2
Ldap Verify Cert Checkbox Should Be Disabled Ldap Verify Cert Checkbox Should Be Disabled
Ldap Verify Cert Checkbox Should Be Disabled Ldap Verify Cert Checkbox Should Be Disabled
Checkbox Should Not Be Selected xpath=//*[@id='clr-checkbox-ldapVerifyCert'] Checkbox Should Not Be Selected xpath=//*[@id='clr-checkbox-ldapVerifyCert']
Set Pro Create Admin Only Set Pro Create Admin Only
#set limit to admin only #set limit to admin only
Retry Element Click xpath=${configuration_xpath} Retry Element Click xpath=${configuration_xpath}
Sleep 2 Sleep 2
Retry Element Click xpath=${configuration_system_tabsheet_id} Retry Element Click xpath=${configuration_system_tabsheet_id}
Sleep 1 Sleep 1
Retry Element Click xpath=//select[@id='proCreation'] Retry Element Click xpath=//select[@id='proCreation']
Retry Element Click xpath=//select[@id='proCreation']//option[@value='adminonly'] Retry Element Click xpath=//select[@id='proCreation']//option[@value='adminonly']
Sleep 1 Sleep 1
Retry Element Click xpath=${config_system_save_button_xpath} Retry Element Click xpath=${config_system_save_button_xpath}
Set Pro Create Every One Set Pro Create Every One
Retry Element Click xpath=${configuration_xpath} Retry Element Click xpath=${configuration_xpath}
sleep 1 sleep 1
#set limit to Every One #set limit to Every One
Retry Element Click xpath=${configuration_system_tabsheet_id} Retry Element Click xpath=${configuration_system_tabsheet_id}
Sleep 1 Sleep 1
Retry Element Click xpath=//select[@id='proCreation'] Retry Element Click xpath=//select[@id='proCreation']
Retry Element Click xpath=//select[@id='proCreation']//option[@value='everyone'] Retry Element Click xpath=//select[@id='proCreation']//option[@value='everyone']
Sleep 1 Sleep 1
Retry Element Click xpath=${config_system_save_button_xpath} Retry Element Click xpath=${config_system_save_button_xpath}
Sleep 2 Sleep 2
Disable Self Reg Disable Self Reg
Retry Element Click xpath=${configuration_xpath} Retry Element Click xpath=${configuration_xpath}
Mouse Down xpath=${self_reg_xpath} Mouse Down xpath=${self_reg_xpath}
Mouse Up xpath=${self_reg_xpath} Mouse Up xpath=${self_reg_xpath}
Sleep 1 Sleep 1
Self Reg Should Be Disabled Self Reg Should Be Disabled
Retry Element Click xpath=${config_auth_save_button_xpath} Retry Element Click xpath=${config_auth_save_button_xpath}
Sleep 1 Sleep 1
Enable Self Reg Enable Self Reg
Mouse Down xpath=${self_reg_xpath} Mouse Down xpath=${self_reg_xpath}
Mouse Up xpath=${self_reg_xpath} Mouse Up xpath=${self_reg_xpath}
Sleep 1 Sleep 1
Self Reg Should Be Enabled Self Reg Should Be Enabled
Retry Element Click xpath=${config_auth_save_button_xpath} Retry Element Click xpath=${config_auth_save_button_xpath}
Sleep 1 Sleep 1
Self Reg Should Be Disabled Self Reg Should Be Disabled
Checkbox Should Not Be Selected xpath=${self_reg_xpath} Checkbox Should Not Be Selected xpath=${self_reg_xpath}
Self Reg Should Be Enabled Self Reg Should Be Enabled
Checkbox Should Be Selected xpath=${self_reg_xpath} Checkbox Should Be Selected xpath=${self_reg_xpath}
Project Creation Should Display Project Creation Should Display
Retry Wait Until Page Contains Element xpath=${project_create_xpath} Retry Wait Until Page Contains Element xpath=${project_create_xpath}
Project Creation Should Not Display Project Creation Should Not Display
Retry Wait Until Page Not Contains Element xpath=${project_create_xpath} Retry Wait Until Page Not Contains Element xpath=${project_create_xpath}
## System settings ## System settings
Switch To System Settings Switch To System Settings
Sleep 1 Sleep 1
Retry Element Click xpath=${configuration_xpath} Retry Element Click xpath=${configuration_xpath}
Retry Element Click xpath=${configuration_system_tabsheet_id} Retry Element Click xpath=${configuration_system_tabsheet_id}
Sleep 1 Sleep 1
Switch To Project Quotas Switch To Project Quotas
Sleep 1 Sleep 1
Retry Element Click xpath=${configuration_xpath} Retry Element Click xpath=${configuration_xpath}
Sleep 1 Sleep 1
Retry Element Click xpath=//clr-main-container//clr-vertical-nav//a[contains(.,'Project Quotas')] Retry Element Click xpath=//clr-main-container//clr-vertical-nav//a[contains(.,'Project Quotas')]
Sleep 1 Sleep 1
Switch To Distribution Switch To Distribution
Sleep 1 Sleep 1
Retry Element Click xpath=//clr-main-container//clr-vertical-nav-group//span[contains(.,'Distributions')] Retry Element Click xpath=//clr-main-container//clr-vertical-nav-group//span[contains(.,'Distributions')]
Sleep 1 Sleep 1
Switch To Robot Account Switch To Robot Account
Sleep 1 Sleep 1
Retry Element Click xpath=//clr-main-container//clr-vertical-nav-group//span[contains(.,'Robot Accounts')] Retry Element Click xpath=//clr-main-container//clr-vertical-nav-group//span[contains(.,'Robot Accounts')]
Sleep 1 Sleep 1
Modify Token Expiration Modify Token Expiration
[Arguments] ${minutes} [Arguments] ${minutes}
Input Text xpath=//*[@id='tokenExpiration'] ${minutes} Input Text xpath=//*[@id='tokenExpiration'] ${minutes}
Click Button xpath=${config_system_save_button_xpath} Click Button xpath=${config_system_save_button_xpath}
Sleep 1 Sleep 1
Token Must Be Match Token Must Be Match
[Arguments] ${minutes} [Arguments] ${minutes}
Textfield Value Should Be xpath=//*[@id='tokenExpiration'] ${minutes} Textfield Value Should Be xpath=//*[@id='tokenExpiration'] ${minutes}
Robot Account Token Must Be Match Robot Account Token Must Be Match
[Arguments] ${days} [Arguments] ${days}
Textfield Value Should Be xpath=//*[@id='robotTokenExpiration'] ${days} Textfield Value Should Be xpath=//*[@id='robotTokenExpiration'] ${days}
## Replication ## Replication
Check Verify Remote Cert Check Verify Remote Cert
Mouse Down xpath=//*[@id='clr-checkbox-verifyRemoteCert'] Mouse Down xpath=//*[@id='clr-checkbox-verifyRemoteCert']
Mouse Up xpath=//*[@id='clr-checkbox-verifyRemoteCert'] Mouse Up xpath=//*[@id='clr-checkbox-verifyRemoteCert']
Retry Element Click xpath=${config_save_button_xpath} Retry Element Click xpath=${config_save_button_xpath}
Sleep 1 Sleep 1
Switch To System Replication Switch To System Replication
Sleep 1 Sleep 1
Switch To Configure Switch To Configure
Retry Element Click xpath=//*[@id='config-replication'] Retry Element Click xpath=//*[@id='config-replication']
Sleep 1 Sleep 1
Should Verify Remote Cert Be Enabled Should Verify Remote Cert Be Enabled
Checkbox Should Not Be Selected xpath=//*[@id='clr-checkbox-verifyRemoteCert'] Checkbox Should Not Be Selected xpath=//*[@id='clr-checkbox-verifyRemoteCert']
## Email ## Email
Switch To Email Switch To Email
Switch To Configure Switch To Configure
Retry Element Click xpath=//*[@id='config-email'] Retry Element Click xpath=//*[@id='config-email']
Sleep 1 Sleep 1
Config Email Config Email
Input Text xpath=//*[@id='mailServer'] smtp.vmware.com Input Text xpath=//*[@id='mailServer'] smtp.vmware.com
Input Text xpath=//*[@id='emailPort'] 25 Input Text xpath=//*[@id='emailPort'] 25
Input Text xpath=//*[@id='emailUsername'] example@vmware.com Input Text xpath=//*[@id='emailUsername'] example@vmware.com
Input Text xpath=//*[@id='emailPassword'] example Input Text xpath=//*[@id='emailPassword'] example
Input Text xpath=//*[@id='emailFrom'] example<example@vmware.com> Input Text xpath=//*[@id='emailFrom'] example<example@vmware.com>
Sleep 1 Sleep 1
Retry Element Click xpath=//*[@id='emailSSL-wrapper']/label Retry Element Click xpath=//*[@id='emailSSL-wrapper']/label
Sleep 1 Sleep 1
Retry Element Click xpath=//*[@id='emailInsecure-wrapper']/label Retry Element Click xpath=//*[@id='emailInsecure-wrapper']/label
Sleep 1 Sleep 1
Retry Element Click xpath=${config_email_save_button_xpath} Retry Element Click xpath=${config_email_save_button_xpath}
Sleep 6 Sleep 6
Verify Email Verify Email
Textfield Value Should Be xpath=//*[@id='mailServer'] smtp.vmware.com Textfield Value Should Be xpath=//*[@id='mailServer'] smtp.vmware.com
Textfield Value Should Be xpath=//*[@id='emailPort'] 25 Textfield Value Should Be xpath=//*[@id='emailPort'] 25
Textfield Value Should Be xpath=//*[@id='emailUsername'] example@vmware.com 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='emailFrom'] example<example@vmware.com>
Checkbox Should Be Selected xpath=//*[@id='emailSSL'] Checkbox Should Be Selected xpath=//*[@id='emailSSL']
Checkbox Should Not Be Selected xpath=//*[@id='emailInsecure'] Checkbox Should Not Be Selected xpath=//*[@id='emailInsecure']
Set Scan All To None Set Scan All To None
Retry Element Click //vulnerability-config//select Retry Element Click //vulnerability-config//select
Retry Element Click //vulnerability-config//select/option[@value='none'] Retry Element Click //vulnerability-config//select/option[@value='none']
sleep 1 sleep 1
Retry Element Click ${vulnerbility_save_button_xpath} Retry Element Click ${vulnerbility_save_button_xpath}
Set Scan All To Daily Set Scan All To Daily
Retry Element Click //vulnerability-config//select Retry Element Click //vulnerability-config//select
Retry Element Click //vulnerability-config//select/option[@value='daily'] Retry Element Click //vulnerability-config//select/option[@value='daily']
sleep 1 sleep 1
Retry Element Click ${vulnerbility_save_button_xpath} Retry Element Click ${vulnerbility_save_button_xpath}
Click Scan Now Click Scan Now
Retry Element Click //vulnerability-config//button[contains(.,'SCAN')] Retry Element Click //vulnerability-config//button[contains(.,'SCAN')]
Enable Read Only Enable Read Only
${rc} ${output}= Run And Return Rc And Output curl -u admin:Harbor12345 -s --insecure -H "Content-Type: application/json" -X PUT -d '{"read_only":true}' "https://${ip}/api/v2.0/configurations" ${rc} ${output}= Run And Return Rc And Output curl -u admin:Harbor12345 -s --insecure -H "Content-Type: application/json" -X PUT -d '{"read_only":true}' "https://${ip}/api/v2.0/configurations"
Log To Console ${output} Log To Console ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Disable Read Only Disable Read Only
${rc} ${output}= Run And Return Rc And Output curl -u admin:Harbor12345 -s --insecure -H "Content-Type: application/json" -X PUT -d '{"read_only":false}' "https://${ip}/api/v2.0/configurations" ${rc} ${output}= Run And Return Rc And Output curl -u admin:Harbor12345 -s --insecure -H "Content-Type: application/json" -X PUT -d '{"read_only":false}' "https://${ip}/api/v2.0/configurations"
Log To Console ${output} Log To Console ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
## System labels ## System labels
Switch To System Labels Switch To System Labels
Sleep 1 Sleep 1
Retry Element Click xpath=//clr-main-container//clr-vertical-nav//a[contains(.,'Labels')] Retry Element Click xpath=//clr-main-container//clr-vertical-nav//a[contains(.,'Labels')]
## System labels ## System labels
Switch To Configuration System Setting Switch To Configuration System Setting
Sleep 1 Sleep 1
Retry Element Click xpath=${configuration_xpath} Retry Element Click xpath=${configuration_xpath}
Retry Element Click xpath=${configuration_system_tabsheet_id} Retry Element Click xpath=${configuration_system_tabsheet_id}
Switch To Configuration Project Quotas Switch To Configuration Project Quotas
Sleep 1 Sleep 1
Retry Element Click xpath=//clr-main-container//clr-vertical-nav//a[contains(.,'Project Quotas')] Retry Element Click xpath=//clr-main-container//clr-vertical-nav//a[contains(.,'Project Quotas')]
Create New Labels Create New Labels
[Arguments] ${labelname} [Arguments] ${labelname}
Retry Element Click xpath=//button[contains(.,'New Label')] Retry Element Click xpath=//button[contains(.,'New Label')]
Sleep 1 Sleep 1
Input Text xpath=//*[@id='name'] ${labelname} Input Text xpath=//*[@id='name'] ${labelname}
Sleep 1 Sleep 1
Retry Element Click xpath=//hbr-create-edit-label//clr-dropdown/clr-icon Retry Element Click xpath=//hbr-create-edit-label//clr-dropdown/clr-icon
Sleep 1 Sleep 1
Retry Element Click xpath=//hbr-create-edit-label//clr-dropdown-menu/label[1] Retry Element Click xpath=//hbr-create-edit-label//clr-dropdown-menu/label[1]
Sleep 1 Sleep 1
Input Text xpath=//*[@id='description'] global Input Text xpath=//*[@id='description'] global
Retry Element Click xpath=//div/form/section/label[4]/button[2] Retry Element Click xpath=//div/form/section/label[4]/button[2]
Wait Until Page Contains ${labelname} Wait Until Page Contains ${labelname}
Update A Label Update A Label
[Arguments] ${labelname} [Arguments] ${labelname}
Retry Element Click xpath=//clr-dg-row[contains(.,'${labelname}')]//clr-checkbox-wrapper Retry Element Click xpath=//clr-dg-row[contains(.,'${labelname}')]//clr-checkbox-wrapper
Sleep 1 Sleep 1
Retry Element Click xpath=//button[contains(.,'Edit')] Retry Element Click xpath=//button[contains(.,'Edit')]
Sleep 1 Sleep 1
Input Text xpath=//*[@id='name'] ${labelname}1 Input Text xpath=//*[@id='name'] ${labelname}1
Sleep 1 Sleep 1
Retry Element Click xpath=//hbr-create-edit-label//form/section//button[2] Retry Element Click xpath=//hbr-create-edit-label//form/section//button[2]
Wait Until Page Contains ${labelname}1 Wait Until Page Contains ${labelname}1
Delete A Label Delete A Label
[Arguments] ${labelname} [Arguments] ${labelname}
Retry Element Click xpath=//clr-dg-row[contains(.,'${labelname}')]//clr-checkbox-wrapper Retry Element Click xpath=//clr-dg-row[contains(.,'${labelname}')]//clr-checkbox-wrapper
Sleep 1 Sleep 1
Retry Element Click xpath=//button[contains(.,'Delete')] Retry Element Click xpath=//button[contains(.,'Delete')]
Sleep 3 Sleep 3
Retry Element Click xpath=//clr-modal//div//button[contains(.,'DELETE')] Retry Element Click xpath=//clr-modal//div//button[contains(.,'DELETE')]
Wait Until Page Contains Element //*[@id='contentAll']//div[contains(.,'${labelname}')]/../div/clr-icon[@shape='success-standard'] Wait Until Page Contains Element //*[@id='contentAll']//div[contains(.,'${labelname}')]/../div/clr-icon[@shape='success-standard']
## Garbage Collection ## Garbage Collection
Switch To Garbage Collection Switch To Garbage Collection
Switch To Configure Switch To Configure
Sleep 1 Sleep 1
Retry Element Click xpath=${gc_config_page} Retry Element Click xpath=${gc_config_page}
Wait Until Page Contains Element ${garbage_collection_xpath} Wait Until Page Contains Element ${garbage_collection_xpath}
Retry Element Click xpath=${garbage_collection_xpath} Retry Element Click xpath=${garbage_collection_xpath}
Set GC Schedule Set GC Schedule
[Arguments] ${type} ${value}=${null} [Arguments] ${type} ${value}=${null}
Switch To Garbage Collection Switch To Garbage Collection
Retry Double Keywords When Error Retry Element Click ${GC_schedule_edit_btn} Retry Wait Until Page Not Contains Element ${GC_schedule_edit_btn} Retry Double Keywords When Error Retry Element Click ${GC_schedule_edit_btn} Retry Wait Until Page Not Contains Element ${GC_schedule_edit_btn}
Retry Element Click ${GC_schedule_select} Retry Element Click ${GC_schedule_select}
Run Keyword If '${type}'=='custom' Run Keywords Retry Element Click ${vulnerability_dropdown_list_item_custom} AND Retry Text Input ${targetCron_id} ${value} Run Keyword If '${type}'=='custom' Run Keywords Retry Element Click ${vulnerability_dropdown_list_item_custom} AND Retry Text Input ${targetCron_id} ${value}
... ELSE Retry Element Click ${vulnerability_dropdown_list_item_none} ... ELSE Retry Element Click ${vulnerability_dropdown_list_item_none}
Retry Double Keywords When Error Retry Element Click ${GC_schedule_save_btn} Retry Wait Until Page Not Contains Element ${GC_schedule_save_btn} Retry Double Keywords When Error Retry Element Click ${GC_schedule_save_btn} Retry Wait Until Page Not Contains Element ${GC_schedule_save_btn}
Capture Page Screenshot Capture Page Screenshot
Click GC Now Click GC Now
Sleep 1 Sleep 1
Retry Element Click xpath=${gc_now_xpath} Retry Element Click xpath=${gc_now_xpath}
Sleep 2 Sleep 2
View GC Details View GC Details
Retry Element Click xpath=${gc_log_details_xpath} Retry Element Click xpath=${gc_log_details_xpath}
Sleep 2 Sleep 2
Switch To GC History Switch To GC History
Retry Element Click xpath=${gc_log_xpath} Retry Element Click xpath=${gc_log_xpath}
Retry Wait Until Page Contains Job Retry Wait Until Page Contains Job
Add Items To System CVE Allowlist Add Items To System CVE Allowlist
[Arguments] ${cve_id} [Arguments] ${cve_id}
Retry Element Click ${configuration_system_wl_add_btn} Retry Element Click ${configuration_system_wl_add_btn}
Retry Text Input ${configuration_system_wl_textarea} ${cve_id} Retry Text Input ${configuration_system_wl_textarea} ${cve_id}
Retry Element Click ${configuration_system_wl_add_confirm_btn} Retry Element Click ${configuration_system_wl_add_confirm_btn}
Retry Element Click ${config_system_save_button_xpath} Retry Element Click ${config_system_save_button_xpath}
Delete Top Item In System CVE Allowlist Delete Top Item In System CVE Allowlist
[Arguments] ${count}=1 [Arguments] ${count}=1
FOR ${idx} IN RANGE 1 ${count} FOR ${idx} IN RANGE 1 ${count}
Retry Element Click ${configuration_system_wl_delete_a_cve_id_icon} Retry Element Click ${configuration_system_wl_delete_a_cve_id_icon}
END END
Retry Element Click ${config_system_save_button_xpath} Retry Element Click ${config_system_save_button_xpath}
Get Project Count Quota Text From Project Quotas List Get Project Count Quota Text From Project Quotas List
[Arguments] ${project_name} [Arguments] ${project_name}
Switch To Project Quotas Switch To Project Quotas
${count_quota}= Get Text xpath=//project-quotas//clr-datagrid//clr-dg-row[contains(.,'${project_name}')]//clr-dg-cell[3]//label ${count_quota}= Get Text xpath=//project-quotas//clr-datagrid//clr-dg-row[contains(.,'${project_name}')]//clr-dg-cell[3]//label
[Return] ${count_quota} [Return] ${count_quota}
Get Project Storage Quota Text From Project Quotas List Get Project Storage Quota Text From Project Quotas List
[Arguments] ${project_name} [Arguments] ${project_name}
Switch To Configure Switch To Configure
Switch To Project Quotas Switch To Project Quotas
${storage_quota}= Get Text xpath=//project-quotas//clr-datagrid//clr-dg-row[contains(.,'${project_name}')]//clr-dg-cell[3]//label ${storage_quota}= Get Text xpath=//project-quotas//clr-datagrid//clr-dg-row[contains(.,'${project_name}')]//clr-dg-cell[3]//label
[Return] ${storage_quota} [Return] ${storage_quota}
Check Automatic Onboarding And Save Check Automatic Onboarding And Save
Switch To Configure Switch To Configure
Retry Element Click ${cfg_auth_automatic_onboarding_checkbox} Retry Element Click ${cfg_auth_automatic_onboarding_checkbox}
Retry Element Click xpath=${config_auth_save_button_xpath} Retry Element Click xpath=${config_auth_save_button_xpath}
Set User Name Claim And Save Set User Name Claim And Save
[Arguments] ${type} [Arguments] ${type}
Switch To Configure Switch To Configure
Retry Clear Element Text ${cfg_auth_user_name_claim_input} Retry Clear Element Text ${cfg_auth_user_name_claim_input}
Run Keyword If '${type}'=='${null}' Retry Text Input ${cfg_auth_user_name_claim_input} anytext Run Keyword If '${type}'=='${null}' Retry Text Input ${cfg_auth_user_name_claim_input} anytext
... ELSE Retry Text Input ${cfg_auth_user_name_claim_input} ${type} ... ELSE Retry Text Input ${cfg_auth_user_name_claim_input} ${type}
Retry Element Click xpath=${config_auth_save_button_xpath} Retry Element Click xpath=${config_auth_save_button_xpath}
Select Distribution Select Distribution
[Arguments] ${name} [Arguments] ${name}
Retry Element Click //clr-dg-row[contains(.,'${name}')]//clr-checkbox-wrapper/label Retry Element Click //clr-dg-row[contains(.,'${name}')]//clr-checkbox-wrapper/label
Distribution Exist Distribution Exist
[Arguments] ${name} ${endpoint} [Arguments] ${name} ${endpoint}
Retry Wait Until Page Contains Element //clr-dg-row[contains(.,'${name}') and contains(.,'${endpoint}')] Retry Wait Until Page Contains Element //clr-dg-row[contains(.,'${name}') and contains(.,'${endpoint}')]
Distribution Not Exist Distribution Not Exist
[Arguments] ${name} ${endpoint} [Arguments] ${name} ${endpoint}
Retry Wait Until Page Not Contains Element //clr-dg-row[contains(.,'${name}') and contains(.,'${endpoint}')] Retry Wait Until Page Not Contains Element //clr-dg-row[contains(.,'${name}') and contains(.,'${endpoint}')]
Filter Distribution List Filter Distribution List
[Arguments] ${name} ${endpoint} ${exsit}=${true} [Arguments] ${name} ${endpoint} ${exsit}=${true}
Retry Double Keywords When Error Retry Element Click ${filter_dist_btn} Wait Until Element Is Visible And Enabled ${filter_dist_input} Retry Double Keywords When Error Retry Element Click ${filter_dist_btn} Wait Until Element Is Visible And Enabled ${filter_dist_input}
Retry Text Input ${filter_dist_input} ${name} Retry Text Input ${filter_dist_input} ${name}
Run Keyword If ${exsit}==${true} Distribution Exist ${name} ${endpoint} Run Keyword If ${exsit}==${true} Distribution Exist ${name} ${endpoint}
... ELSE Distribution Not Exist ${name} ${endpoint} ... ELSE Distribution Not Exist ${name} ${endpoint}
Select Provider Select Provider
[Arguments] ${provider} [Arguments] ${provider}
Retry Element Click ${distribution_provider_select_id} Retry Element Click ${distribution_provider_select_id}
Retry Element Click ${distribution_provider_select_id}//option[contains(.,'${provider}')] Retry Element Click ${distribution_provider_select_id}//option[contains(.,'${provider}')]
Create An New Distribution Create An New Distribution
[Arguments] ${provider} ${name} ${endpoint} [Arguments] ${provider} ${name} ${endpoint}
Switch To Distribution Switch To Distribution
Retry Element Click ${distribution_add_btn_id} Retry Element Click ${distribution_add_btn_id}
Select Provider ${provider} Select Provider ${provider}
Retry Text Input ${distribution_name_input_id} ${name} Retry Text Input ${distribution_name_input_id} ${name}
Retry Text Input ${distribution_endpoint_id} ${endpoint} Retry Text Input ${distribution_endpoint_id} ${endpoint}
Retry Double Keywords When Error Retry Element Click ${distribution_add_save_btn_id} Retry Wait Until Page Not Contains Element xpath=${distribution_add_save_btn_id} Retry Double Keywords When Error Retry Element Click ${distribution_add_save_btn_id} Retry Wait Until Page Not Contains Element xpath=${distribution_add_save_btn_id}
Distribution Exist ${name} ${endpoint} Distribution Exist ${name} ${endpoint}
Delete A Distribution Delete A Distribution
[Arguments] ${name} ${endpoint} ${deletable}=${true} [Arguments] ${name} ${endpoint} ${deletable}=${true}
${is_exsit} evaluate not ${deletable} ${is_exsit} evaluate not ${deletable}
Switch To Distribution Switch To Distribution
Filter Distribution List ${name} ${endpoint} Filter Distribution List ${name} ${endpoint}
Retry Double Keywords When Error Select Distribution ${name} Wait Until Element Is Visible //clr-datagrid//clr-dg-footer//clr-checkbox-wrapper/label Retry Double Keywords When Error Select Distribution ${name} Wait Until Element Is Visible //clr-datagrid//clr-dg-footer//clr-checkbox-wrapper/label
Retry Double Keywords When Error Retry Element Click ${distribution_action_btn_id} Wait Until Element Is Visible And Enabled ${distribution_del_btn_id} Retry Double Keywords When Error Retry Element Click ${distribution_action_btn_id} Wait Until Element Is Visible And Enabled ${distribution_del_btn_id}
Retry Double Keywords When Error Retry Element Click ${distribution_del_btn_id} Wait Until Element Is Visible And Enabled ${delete_confirm_btn} Retry Double Keywords When Error Retry Element Click ${distribution_del_btn_id} Wait Until Element Is Visible And Enabled ${delete_confirm_btn}
Retry Double Keywords When Error Retry Element Click ${delete_confirm_btn} Retry Wait Until Page Not Contains Element ${delete_confirm_btn} Retry Double Keywords When Error Retry Element Click ${delete_confirm_btn} Retry Wait Until Page Not Contains Element ${delete_confirm_btn}
Sleep 10 Sleep 10
Filter Distribution List ${name} ${endpoint} exsit=${is_exsit} Filter Distribution List ${name} ${endpoint} exsit=${is_exsit}
Edit A Distribution Edit A Distribution
[Arguments] ${name} ${endpoint} ${new_endpoint}=${null} [Arguments] ${name} ${endpoint} ${new_endpoint}=${null}
Switch To Distribution Switch To Distribution
Filter Distribution List ${name} ${endpoint} Filter Distribution List ${name} ${endpoint}
Retry Double Keywords When Error Select Distribution ${name} Wait Until Element Is Visible //clr-datagrid//clr-dg-footer//clr-checkbox-wrapper/label times=9 Retry Double Keywords When Error Select Distribution ${name} Wait Until Element Is Visible //clr-datagrid//clr-dg-footer//clr-checkbox-wrapper/label times=9
Retry Double Keywords When Error Retry Element Click ${distribution_action_btn_id} Wait Until Element Is Visible And Enabled ${distribution_edit_btn_id} Retry Double Keywords When Error Retry Element Click ${distribution_action_btn_id} Wait Until Element Is Visible And Enabled ${distribution_edit_btn_id}
Retry Double Keywords When Error Retry Element Click ${distribution_edit_btn_id} Wait Until Element Is Visible And Enabled ${distribution_name_input_id} Retry Double Keywords When Error Retry Element Click ${distribution_edit_btn_id} Wait Until Element Is Visible And Enabled ${distribution_name_input_id}
Retry Text Input ${distribution_endpoint_id} ${new_endpoint} Retry Text Input ${distribution_endpoint_id} ${new_endpoint}
Retry Double Keywords When Error Retry Element Click ${distribution_add_save_btn_id} Retry Wait Until Page Not Contains Element xpath=${distribution_add_save_btn_id} Retry Double Keywords When Error Retry Element Click ${distribution_add_save_btn_id} Retry Wait Until Page Not Contains Element xpath=${distribution_add_save_btn_id}
Filter Distribution List ${name} ${new_endpoint} Filter Distribution List ${name} ${new_endpoint}
Distribution Exist ${name} ${new_endpoint} Distribution Exist ${name} ${new_endpoint}

View File

@ -1,69 +1,69 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
*** Variables *** *** Variables ***
${project_create_xpath} //clr-dg-action-bar//button[contains(.,'New')] ${project_create_xpath} //clr-dg-action-bar//button[contains(.,'New')]
${self_reg_xpath} //input[@id='selfReg'] ${self_reg_xpath} //input[@id='selfReg']
${test_ldap_xpath} //*[@id='authentication']/config-auth/div/button[3] ${test_ldap_xpath} //*[@id='authentication']/config-auth/div/button[3]
${config_save_button_xpath} //config//div/button[contains(.,'SAVE')] ${config_save_button_xpath} //config//div/button[contains(.,'SAVE')]
${config_email_save_button_xpath} //*[@id='config_email_save'] ${config_email_save_button_xpath} //*[@id='config_email_save']
${config_auth_save_button_xpath} //*[@id='config_auth_save'] ${config_auth_save_button_xpath} //*[@id='config_auth_save']
${config_system_save_button_xpath} //*[@id='config_system_save'] ${config_system_save_button_xpath} //*[@id='config_system_save']
${vulnerbility_save_button_xpath} //*[@id='config-save'] ${vulnerbility_save_button_xpath} //*[@id='config-save']
${configuration_xpath} //clr-main-container//clr-vertical-nav//a[contains(.,' Configuration ')] ${configuration_xpath} //clr-main-container//clr-vertical-nav//a[contains(.,' Configuration ')]
${garbage_collection_xpath} //*[@id='config-gc'] ${garbage_collection_xpath} //*[@id='config-gc']
${gc_log_xpath} //*[@id='gc-log'] ${gc_log_xpath} //*[@id='gc-log']
${gc_config_page} //clr-vertical-nav-group-children/a[contains(.,'Garbage')] ${gc_config_page} //clr-vertical-nav-group-children/a[contains(.,'Garbage')]
${gc_now_xpath} //*[@id='gc']/gc-config//button[contains(.,'GC')] ${gc_now_xpath} //*[@id='gc']/gc-config//button[contains(.,'GC')]
${gc_log_details_xpath} //*[@id='clr-dg-row26']/clr-dg-cell[6]/a ${gc_log_details_xpath} //*[@id='clr-dg-row26']/clr-dg-cell[6]/a
${configuration_system_tabsheet_id} //*[@id='config-system'] ${configuration_system_tabsheet_id} //*[@id='config-system']
${configuration_authentication_tabsheet_id} //*[@id="config-auth"] ${configuration_authentication_tabsheet_id} //*[@id="config-auth"]
${configuration_project_quotas_tabsheet_id} //*[@id='config-quotas'] ${configuration_project_quotas_tabsheet_id} //*[@id='config-quotas']
${configuration_system_wl_add_btn} //*[@id='show-add-modal-button'] ${configuration_system_wl_add_btn} //*[@id='show-add-modal-button']
${configuration_system_wl_textarea} //*[@id='allowlist-textarea'] ${configuration_system_wl_textarea} //*[@id='allowlist-textarea']
${configuration_system_wl_add_confirm_btn} //*[@id='add-to-system'] ${configuration_system_wl_add_confirm_btn} //*[@id='add-to-system']
${configuration_system_wl_delete_a_cve_id_icon} //system-settings/form/section//ul/li[1]/a[2]/clr-icon ${configuration_system_wl_delete_a_cve_id_icon} //system-settings/form/section//ul/li[1]/a[2]/clr-icon
${configuration_sys_repo_readonly_chb_id} //*[@id='repo_read_only_lbl'] ${configuration_sys_repo_readonly_chb_id} //*[@id='repo_read_only_lbl']
${checkbox_delete_untagged_artifacts} //gc-config//clr-toggle-wrapper/label[contains(@for,'delete_untagged')] ${checkbox_delete_untagged_artifacts} //gc-config//clr-toggle-wrapper/label[contains(@for,'delete_untagged')]
${cfg_auth_automatic_onboarding_checkbox} //clr-checkbox-wrapper//label[contains(@for,'oidcAutoOnboard')] ${cfg_auth_automatic_onboarding_checkbox} //clr-checkbox-wrapper//label[contains(@for,'oidcAutoOnboard')]
${cfg_auth_user_name_claim_input} //*[@id='oidcUserClaim'] ${cfg_auth_user_name_claim_input} //*[@id='oidcUserClaim']
${cfg_auth_ldap_group_admin_dn} //*[@id='ldapGroupAdminDN'] ${cfg_auth_ldap_group_admin_dn} //*[@id='ldapGroupAdminDN']
${distribution_add_btn_id} //*[@id='new-instance'] ${distribution_add_btn_id} //*[@id='new-instance']
${distribution_provider_select_id} //*[@id='provider'] ${distribution_provider_select_id} //*[@id='provider']
${distribution_name_input_id} //*[@id='name'] ${distribution_name_input_id} //*[@id='name']
${distribution_endpoint_id} //*[@id='endpoint'] ${distribution_endpoint_id} //*[@id='endpoint']
${distribution_description_id} //*[@id='description'] ${distribution_description_id} //*[@id='description']
${distribution_auth_none_mode_ratio_id} //*[@id='none_mode'] ${distribution_auth_none_mode_ratio_id} //*[@id='none_mode']
${distribution_auth_basic_mode_ratio_id} //*[@id='basic_mode'] ${distribution_auth_basic_mode_ratio_id} //*[@id='basic_mode']
${distribution_auth_oauth_mode_ratio_id} //*[@id='token_mode'] ${distribution_auth_oauth_mode_ratio_id} //*[@id='token_mode']
${distribution_enable_checkbox_id} //*[@id='enabled'] ${distribution_enable_checkbox_id} //*[@id='enabled']
${distribution_insecure_checkbox_id} //*[@id='insecure'] ${distribution_insecure_checkbox_id} //*[@id='insecure']
${distribution_add_save_btn_id} //*[@id='instance-ok'] ${distribution_add_save_btn_id} //*[@id='instance-ok']
${distribution_action_btn_id} //*[@id='member-action'] ${distribution_action_btn_id} //*[@id='member-action']
${distribution_del_btn_id} //*[@id='distribution-delete'] ${distribution_del_btn_id} //*[@id='distribution-delete']
${distribution_edit_btn_id} //*[@id='distribution-edit'] ${distribution_edit_btn_id} //*[@id='distribution-edit']
${filter_dist_btn} //hbr-filter//clr-icon[contains(@class,'search-btn')] ${filter_dist_btn} //hbr-filter//clr-icon[contains(@class,'search-btn')]
${filter_dist_input} //hbr-filter//input ${filter_dist_input} //hbr-filter//input
${GC_schedule_edit_btn} //*[@id='editSchedule'] ${GC_schedule_edit_btn} //*[@id='editSchedule']
${GC_schedule_select} //*[@id='selectPolicy'] ${GC_schedule_select} //*[@id='selectPolicy']
${GC_schedule_save_btn} //*[@id='config-save'] ${GC_schedule_save_btn} //*[@id='config-save']

View File

@ -1,53 +1,53 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
*** Variables *** *** Variables ***
*** Keywords *** *** Keywords ***
GC Now GC Now
[Arguments] ${harbor_url} ${login_user} ${login_pwd} ${untag}=${false} [Arguments] ${harbor_url} ${login_user} ${login_pwd} ${untag}=${false}
Switch To Garbage Collection Switch To Garbage Collection
Run Keyword If '${untag}' == '${true}' Retry Element Click xpath=${checkbox_delete_untagged_artifacts} Run Keyword If '${untag}' == '${true}' Retry Element Click xpath=${checkbox_delete_untagged_artifacts}
Click GC Now Click GC Now
Logout Harbor Logout Harbor
Sleep 2 Sleep 2
Sign In Harbor ${harbor_url} ${login_user} ${login_pwd} Sign In Harbor ${harbor_url} ${login_user} ${login_pwd}
Switch To Garbage Collection Switch To Garbage Collection
Sleep 1 Sleep 1
#Switch To GC History #Switch To GC History
#Retry Keyword N Times When Error 60 Retry Wait Until Page Contains Finished #Retry Keyword N Times When Error 60 Retry Wait Until Page Contains Finished
Retry GC Should Be Successful Retry GC Should Be Successful
[Arguments] ${history_id} ${expected_msg} [Arguments] ${history_id} ${expected_msg}
Retry Keyword N Times When Error 15 GC Should Be Successful ${history_id} ${expected_msg} Retry Keyword N Times When Error 15 GC Should Be Successful ${history_id} ${expected_msg}
GC Should Be Successful GC Should Be Successful
[Arguments] ${history_id} ${expected_msg} [Arguments] ${history_id} ${expected_msg}
${rc} ${output}= Run And Return Rc And Output curl -u ${HARBOR_ADMIN}:${HARBOR_PASSWORD} -i --insecure -H "Content-Type: application/json" -X GET "https://${ip}/api/v2.0/system/gc/${history_id}/log" ${rc} ${output}= Run And Return Rc And Output curl -u ${HARBOR_ADMIN}:${HARBOR_PASSWORD} -i --insecure -H "Content-Type: application/json" -X GET "https://${ip}/api/v2.0/system/gc/${history_id}/log"
Log All ${output} Log All ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Run Keyword If '${expected_msg}' != '${null}' Should Contain ${output} ${expected_msg} Run Keyword If '${expected_msg}' != '${null}' Should Contain ${output} ${expected_msg}
Should Contain ${output} success to run gc in job. Should Contain ${output} success to run gc in job.
Get GC Logs Get GC Logs
[Arguments] [Arguments]
${cmd}= Set Variable curl -u ${HARBOR_ADMIN}:${HARBOR_PASSWORD} -s --insecure -H "Content-Type: application/json" -X GET "https://${ip}/api/v2.0/system/gc" ${cmd}= Set Variable curl -u ${HARBOR_ADMIN}:${HARBOR_PASSWORD} -s --insecure -H "Content-Type: application/json" -X GET "https://${ip}/api/v2.0/system/gc"
Log All cmd:${cmd} Log All cmd:${cmd}
${rc} ${output}= Run And Return Rc And Output ${cmd} ${rc} ${output}= Run And Return Rc And Output ${cmd}
Log All ${output} Log All ${output}
[Return] ${output} [Return] ${output}

View File

@ -1,57 +1,57 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
*** Variables *** *** Variables ***
*** Keywords *** *** Keywords ***
Sign In Harbor Sign In Harbor
[Arguments] ${url} ${user} ${pw} [Arguments] ${url} ${user} ${pw}
Go To ${url} Go To ${url}
Retry Wait Element ${harbor_span_title} Retry Wait Element ${harbor_span_title}
Retry Wait Element ${login_name} Retry Wait Element ${login_name}
Retry Wait Element ${login_pwd} Retry Wait Element ${login_pwd}
Input Text ${login_name} ${user} Input Text ${login_name} ${user}
Input Text ${login_pwd} ${pw} Input Text ${login_pwd} ${pw}
Retry Wait Element ${login_btn} Retry Wait Element ${login_btn}
Retry Button Click ${login_btn} Retry Button Click ${login_btn}
Log To Console ${user} Log To Console ${user}
Retry Wait Element xpath=//span[contains(., '${user}')] Retry Wait Element xpath=//span[contains(., '${user}')]
Capture Screenshot And Source Capture Screenshot And Source
Capture Page Screenshot Capture Page Screenshot
Log Source Log Source
Sign Up Should Not Display Sign Up Should Not Display
Retry Wait Until Page Not Contains Element xpath=${sign_up_button_xpath} Retry Wait Until Page Not Contains Element xpath=${sign_up_button_xpath}
Create An New User Create An New User
[Arguments] ${url} ${username} ${email} ${realname} ${newPassword} ${comment} [Arguments] ${url} ${username} ${email} ${realname} ${newPassword} ${comment}
Go To ${url} Go To ${url}
Retry Wait Element ${harbor_span_title} Retry Wait Element ${harbor_span_title}
Retry Element Click xpath=${sign_up_for_an_account_xpath} Retry Element Click xpath=${sign_up_for_an_account_xpath}
Retry Text Input xpath=${username_xpath} ${username} Retry Text Input xpath=${username_xpath} ${username}
Retry Text Input xpath=${email_xpath} ${email} Retry Text Input xpath=${email_xpath} ${email}
Retry Text Input xpath=${realname_xpath} ${realname} Retry Text Input xpath=${realname_xpath} ${realname}
Retry Text Input xpath=${newPassword_xpath} ${newPassword} Retry Text Input xpath=${newPassword_xpath} ${newPassword}
Retry Text Input xpath=${confirmPassword_xpath} ${newPassword} Retry Text Input xpath=${confirmPassword_xpath} ${newPassword}
Retry Text Input xpath=${comment_xpath} ${comment} Retry Text Input xpath=${comment_xpath} ${comment}
Retry Double Keywords When Error Retry Element Click ${signup_xpath} Retry Wait Until Page Not Contains Element ${signup_xpath} Retry Double Keywords When Error Retry Element Click ${signup_xpath} Retry Wait Until Page Not Contains Element ${signup_xpath}
Retry Text Input ${login_name} ${username} Retry Text Input ${login_name} ${username}
Retry Text Input ${login_pwd} ${newPassword} Retry Text Input ${login_pwd} ${newPassword}
Retry Double Keywords When Error Retry Element Click ${login_btn} Retry Wait Until Page Not Contains Element ${login_btn} Retry Double Keywords When Error Retry Element Click ${login_btn} Retry Wait Until Page Not Contains Element ${login_btn}
Retry Wait Element xpath=//span[contains(., '${username}')] Retry Wait Element xpath=//span[contains(., '${username}')]

View File

@ -1,33 +1,33 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
*** Variables *** *** Variables ***
${sign_up_for_an_account_xpath} /html/body/harbor-app/sign-in/clr-main-container/div/form/div[1]/a ${sign_up_for_an_account_xpath} /html/body/harbor-app/sign-in/clr-main-container/div/form/div[1]/a
${sign_up_button_xpath} //a[@class='signup'] ${sign_up_button_xpath} //a[@class='signup']
${username_xpath} //*[@id='username'] ${username_xpath} //*[@id='username']
${email_xpath} //*[@id='email'] ${email_xpath} //*[@id='email']
${realname_xpath} //*[@id='realname'] ${realname_xpath} //*[@id='realname']
${newPassword_xpath} //*[@id='newPassword'] ${newPassword_xpath} //*[@id='newPassword']
${confirmPassword_xpath} //*[@id='confirmPassword'] ${confirmPassword_xpath} //*[@id='confirmPassword']
${comment_xpath} //*[@id='comment'] ${comment_xpath} //*[@id='comment']
${signup_xpath} //*[@id='sign-up'] ${signup_xpath} //*[@id='sign-up']
${search_input} //*[@id='search_input'] ${search_input} //*[@id='search_input']
${login_btn} //*[@id='log_in'] ${login_btn} //*[@id='log_in']
${harbor_span_title} //span[contains(., 'Harbor')] ${harbor_span_title} //span[contains(., 'Harbor')]
${login_name} //*[@id='login_username'] ${login_name} //*[@id='login_username']
${login_pwd} //*[@id='login_password'] ${login_pwd} //*[@id='login_password']

View File

@ -1,38 +1,38 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
*** Variables *** *** Variables ***
*** Keywords *** *** Keywords ***
Switch To Configuration Authentication Switch To Configuration Authentication
Sleep 1 Sleep 1
Retry Element Click xpath=${configuration_xpath} Retry Element Click xpath=${configuration_xpath}
Retry Element Click xpath=${configuration_authentication_tabsheet_id} Retry Element Click xpath=${configuration_authentication_tabsheet_id}
Set LDAP Group Admin DN Set LDAP Group Admin DN
[Arguments] ${group_dn} [Arguments] ${group_dn}
Switch To Configuration Authentication Switch To Configuration Authentication
Retry Text Input ${cfg_auth_ldap_group_admin_dn} ${group_dn} Retry Text Input ${cfg_auth_ldap_group_admin_dn} ${group_dn}
Retry Element Click ${config_auth_save_button_xpath} Retry Element Click ${config_auth_save_button_xpath}
Ldap User Should Not See Change Password Ldap User Should Not See Change Password
Retry Element Click //clr-header//clr-dropdown[2]//button Retry Element Click //clr-header//clr-dropdown[2]//button
Sleep 2 Sleep 2
Page Should Not Contain Password Page Should Not Contain Password

View File

@ -1,67 +1,67 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
*** Variables *** *** Variables ***
*** Keywords *** *** Keywords ***
Sign In Harbor With OIDC User Sign In Harbor With OIDC User
[Arguments] ${url} ${username}=${OIDC_USERNAME} ${password}=password ${is_onboard}=${false} ${username_claim}=${null} ${login_with_provider}=email [Arguments] ${url} ${username}=${OIDC_USERNAME} ${password}=password ${is_onboard}=${false} ${username_claim}=${null} ${login_with_provider}=email
${full_name}= Set Variable If '${login_with_provider}' == 'email' ${username}@example.com ${username} ${full_name}= Set Variable If '${login_with_provider}' == 'email' ${username}@example.com ${username}
${head_username}= Set Variable If '${username_claim}' == 'email' xpath=//harbor-app/harbor-shell/clr-main-container/navigator/clr-header//clr-dropdown//button[contains(.,'${full_name}')] xpath=//harbor-app/harbor-shell/clr-main-container/navigator/clr-header//clr-dropdown//button[contains(.,'${username}')] ${head_username}= Set Variable If '${username_claim}' == 'email' xpath=//harbor-app/harbor-shell/clr-main-container/navigator/clr-header//clr-dropdown//button[contains(.,'${full_name}')] xpath=//harbor-app/harbor-shell/clr-main-container/navigator/clr-header//clr-dropdown//button[contains(.,'${username}')]
Init Chrome Driver Init Chrome Driver
Go To ${url} Go To ${url}
Retry Element Click ${log_oidc_provider_btn} Retry Element Click ${log_oidc_provider_btn}
Run Keyword If '${login_with_provider}' == 'email' Retry Element Click ${login_with_email_btn} Run Keyword If '${login_with_provider}' == 'email' Retry Element Click ${login_with_email_btn}
Run Keyword If '${login_with_provider}' == 'ldap' Retry Element Click ${login_with_ldap_btn} Run Keyword If '${login_with_provider}' == 'ldap' Retry Element Click ${login_with_ldap_btn}
Retry Text Input ${dex_login_btn} ${full_name} Retry Text Input ${dex_login_btn} ${full_name}
Retry Text Input ${dex_pwd_btn} ${password} Retry Text Input ${dex_pwd_btn} ${password}
Retry Element Click ${submit_login_btn} Retry Element Click ${submit_login_btn}
Retry Element Click ${grant_btn} Retry Element Click ${grant_btn}
#If input box for harbor user name is visible, it means it's the 1st time login of this user, #If input box for harbor user name is visible, it means it's the 1st time login of this user,
# but if this user has been logged into harbor successfully, this input box will not show up, # but if this user has been logged into harbor successfully, this input box will not show up,
# so there is condition branch for this stituation. # so there is condition branch for this stituation.
${isVisible}= Run Keyword And Return Status Element Should Be Visible ${oidc_username_input} ${isVisible}= Run Keyword And Return Status Element Should Be Visible ${oidc_username_input}
Run Keyword If ${is_onboard} == ${true} Should Not Be True ${isVisible} Run Keyword If ${is_onboard} == ${true} Should Not Be True ${isVisible}
Run Keyword If '${isVisible}' == 'True' Run Keywords Retry Text Input ${oidc_username_input} ${username} AND Retry Element Click ${save_btn} 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} Retry Wait Element ${head_username}
Capture Page Screenshot 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 xpath=//harbor-app/harbor-shell/clr-main-container/navigator/clr-header//clr-dropdown[2]//button/span
Run Keyword If '${username_claim}' == 'email' Should Be Equal As Strings ${name_display} ${full_name} Run Keyword If '${username_claim}' == 'email' Should Be Equal As Strings ${name_display} ${full_name}
... ELSE Should Be Equal As Strings ${name_display} ${username} ... ELSE Should Be Equal As Strings ${name_display} ${username}
Get Secrete By API Get Secrete By API
[Arguments] ${url} ${username}=${OIDC_USERNAME} [Arguments] ${url} ${username}=${OIDC_USERNAME}
${json}= Run Curl And Return Json curl -s -k -X GET --header 'Accept: application/json' -u '${HARBOR_ADMIN}:${HARBOR_PASSWORD}' '${url}/api/v2.0/users/search?username=${username}' ${json}= Run Curl And Return Json curl -s -k -X GET --header 'Accept: application/json' -u '${HARBOR_ADMIN}:${HARBOR_PASSWORD}' '${url}/api/v2.0/users/search?username=${username}'
${user_info}= Set Variable ${json[0]} ${user_info}= Set Variable ${json[0]}
${user_id}= Set Variable ${user_info["user_id"]} ${user_id}= Set Variable ${user_info["user_id"]}
${json}= Run Curl And Return Json curl -s -k -X GET --header 'Accept: application/json' -u '${HARBOR_ADMIN}:${HARBOR_PASSWORD}' '${url}/api/v2.0/users/${user_id}' ${json}= Run Curl And Return Json curl -s -k -X GET --header 'Accept: application/json' -u '${HARBOR_ADMIN}:${HARBOR_PASSWORD}' '${url}/api/v2.0/users/${user_id}'
${secret}= Set Variable ${json["oidc_user_meta"]["secret"]} ${secret}= Set Variable ${json["oidc_user_meta"]["secret"]}
[Return] ${secret} [Return] ${secret}
Generate And Return Secret Generate And Return Secret
[Arguments] ${url} [Arguments] ${url}
Retry Element Click ${head_admin_xpath} Retry Element Click ${head_admin_xpath}
Retry Element Click ${user_profile_xpath} Retry Element Click ${user_profile_xpath}
Retry Element Click ${more_btn} Retry Element Click ${more_btn}
Retry Element Click ${generate_secret_btn} Retry Element Click ${generate_secret_btn}
Retry Double Keywords When Error Retry Element Click ${confirm_btn} Retry Wait Until Page Not Contains Element ${confirm_btn} Retry Double Keywords When Error Retry Element Click ${confirm_btn} Retry Wait Until Page Not Contains Element ${confirm_btn}
Retry Wait Until Page Contains Cli secret setting is successful Retry Wait Until Page Contains Cli secret setting is successful
${secret}= Get Secrete By API ${url} ${secret}= Get Secrete By API ${url}
[Return] ${secret} [Return] ${secret}

View File

@ -1,30 +1,30 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
*** Variables *** *** Variables ***
${log_oidc_provider_btn} //*[@id='log_oidc'] ${log_oidc_provider_btn} //*[@id='log_oidc']
${login_with_email_btn} //span[contains(., 'Log in with Email')] ${login_with_email_btn} //span[contains(., 'Log in with Email')]
${login_with_ldap_btn} //span[contains(., 'Log in with LDAP')] ${login_with_ldap_btn} //span[contains(., 'Log in with LDAP')]
${dex_login_btn} //*[@id='login'] ${dex_login_btn} //*[@id='login']
${dex_pwd_btn} //*[@id='password'] ${dex_pwd_btn} //*[@id='password']
${submit_login_btn} //*[@id='submit-login'] ${submit_login_btn} //*[@id='submit-login']
${grant_btn} xpath=/html/body/div[2]/div/div[2]/div[1]/form/button ${grant_btn} xpath=/html/body/div[2]/div/div[2]/div[1]/form/button
${oidc_username_input} //*[@id='oidcUsername'] ${oidc_username_input} //*[@id='oidcUsername']
${save_btn} //*[@id='saveButton'] ${save_btn} //*[@id='saveButton']
${OIDC_USERNAME} test1 ${OIDC_USERNAME} test1
${generate_secret_btn} //*[@id='generate-cli-btn'] ${generate_secret_btn} //*[@id='generate-cli-btn']
${more_btn} //*[@id='hidden-generate-cli'] ${more_btn} //*[@id='hidden-generate-cli']

View File

@ -1,32 +1,32 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
*** Variables *** *** Variables ***
${artifact_action_xpath} //clr-dg-action-bar/clr-dropdown/span[contains(@class,'dropdown-toggle')] ${artifact_action_xpath} //clr-dg-action-bar/clr-dropdown/span[contains(@class,'dropdown-toggle')]
${artifact_action_delete_xpath} //clr-dropdown-menu//div[contains(.,'Delete')] ${artifact_action_delete_xpath} //clr-dropdown-menu//div[contains(.,'Delete')]
${artifact_action_copy_xpath} //clr-dropdown-menu//div[contains(.,'Copy') and @aria-label='retag'] ${artifact_action_copy_xpath} //clr-dropdown-menu//div[contains(.,'Copy') and @aria-label='retag']
${artifact_achieve_icon} //artifact-list-tab//clr-datagrid//clr-dg-row[contains(.,'sha256')]//clr-dg-cell[1]//clr-tooltip//a ${artifact_achieve_icon} //artifact-list-tab//clr-datagrid//clr-dg-row[contains(.,'sha256')]//clr-dg-cell[1]//clr-tooltip//a
${artifact_rows} //artifact-list-tab//clr-datagrid//clr-dg-row[contains(.,'sha256')] ${artifact_rows} //artifact-list-tab//clr-datagrid//clr-dg-row[contains(.,'sha256')]
${archive_rows} //artifact-list-tab//clr-datagrid//clr-dg-row[contains(.,'sha256')]//clr-dg-cell[1]//clr-tooltip//a ${archive_rows} //artifact-list-tab//clr-datagrid//clr-dg-row[contains(.,'sha256')]//clr-dg-cell[1]//clr-tooltip//a
${artifact_list_spinner} xpath=//clr-datagrid//clr-spinner ${artifact_list_spinner} xpath=//clr-datagrid//clr-spinner
${artifact_tag_component} xpath=//artifact-tag ${artifact_tag_component} xpath=//artifact-tag
${add_tag_button} xpath=//*[@id='new-tag'] ${add_tag_button} xpath=//*[@id='new-tag']
${tag_name_xpath} xpath=//*[@id='name'] ${tag_name_xpath} xpath=//*[@id='name']
${add_ok_button} xpath=//*[@id='add-ok'] ${add_ok_button} xpath=//*[@id='add-ok']
${delete_tag_button} xpath=//*[@id='delete-tag'] ${delete_tag_button} xpath=//*[@id='delete-tag']
${dialog_delete_button} xpath=//clr-modal//button[contains(.,'DELETE')] ${dialog_delete_button} xpath=//clr-modal//button[contains(.,'DELETE')]

View File

@ -1,51 +1,51 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
*** Keywords *** *** Keywords ***
Go Into Artifact Go Into Artifact
[Arguments] ${tag} [Arguments] ${tag}
Retry Wait Until Page Not Contains Element ${artifact_list_spinner} Retry Wait Until Page Not Contains Element ${artifact_list_spinner}
Retry Element Click xpath=//clr-dg-row[contains(.,'${tag}')]//a[contains(.,'sha256')] Retry Element Click xpath=//clr-dg-row[contains(.,'${tag}')]//a[contains(.,'sha256')]
Retry Wait Until Page Contains Element ${artifact_tag_component} Retry Wait Until Page Contains Element ${artifact_tag_component}
Retry Wait Until Page Not Contains Element ${artifact_list_spinner} Retry Wait Until Page Not Contains Element ${artifact_list_spinner}
Should Contain Tag Should Contain Tag
[Arguments] ${tag} [Arguments] ${tag}
Retry Wait Until Page Contains Element xpath=//artifact-tag//clr-dg-row//clr-dg-cell[contains(.,'${tag}')] Retry Wait Until Page Contains Element xpath=//artifact-tag//clr-dg-row//clr-dg-cell[contains(.,'${tag}')]
Should Not Contain Tag Should Not Contain Tag
[Arguments] ${tag} [Arguments] ${tag}
Retry Wait Until Page Not Contains Element xpath=//artifact-tag//clr-dg-row//clr-dg-cell[contains(.,'${tag}')] Retry Wait Until Page Not Contains Element xpath=//artifact-tag//clr-dg-row//clr-dg-cell[contains(.,'${tag}')]
Add A New Tag Add A New Tag
[Arguments] ${tag} [Arguments] ${tag}
Retry Double Keywords When Error Retry Element Click ${add_tag_button} Retry Wait Element ${tag_name_xpath} Retry Double Keywords When Error Retry Element Click ${add_tag_button} Retry Wait Element ${tag_name_xpath}
Retry Text Input ${tag_name_xpath} ${tag} Retry Text Input ${tag_name_xpath} ${tag}
Retry Double Keywords When Error Retry Element Click ${add_ok_button} Should Contain Tag ${tag} Retry Double Keywords When Error Retry Element Click ${add_ok_button} Should Contain Tag ${tag}
Delete A Tag Delete A Tag
[Arguments] ${tag} [Arguments] ${tag}
Retry Element Click xpath=//clr-dg-row[contains(.,'${tag}')]//clr-checkbox-wrapper//label[contains(@class,'clr-control-label')] Retry Element Click xpath=//clr-dg-row[contains(.,'${tag}')]//clr-checkbox-wrapper//label[contains(@class,'clr-control-label')]
Retry Double Keywords When Error Retry Element Click ${delete_tag_button} Retry Wait Until Page Contains Element ${dialog_delete_button} Retry Double Keywords When Error Retry Element Click ${delete_tag_button} Retry Wait Until Page Contains Element ${dialog_delete_button}
Retry Double Keywords When Error Retry Element Click ${dialog_delete_button} Should Not Contain Tag ${tag} Retry Double Keywords When Error Retry Element Click ${dialog_delete_button} Should Not Contain Tag ${tag}
Should Contain Artifact Should Contain Artifact
Retry Wait Until Page Contains Element xpath=//artifact-list-tab//clr-dg-row//a[contains(.,'sha256')] Retry Wait Until Page Contains Element xpath=//artifact-list-tab//clr-dg-row//a[contains(.,'sha256')]
Should Not Contain Any Artifact Should Not Contain Any Artifact
Retry Wait Until Page Not Contains Element xpath=//artifact-list-tab//clr-dg-row Retry Wait Until Page Not Contains Element xpath=//artifact-list-tab//clr-dg-row

View File

@ -1,6 +1,6 @@
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
*** Variables *** *** Variables ***
${project_configuration_wl_delete_a_cve_id_icon} //hbr-project-policy-config/form/section//ul/li[1]/a[2]/clr-icon ${project_configuration_wl_delete_a_cve_id_icon} //hbr-project-policy-config/form/section//ul/li[1]/a[2]/clr-icon
${project_configuration_wl_project_add_system_btn} //button[@id='add-system'] ${project_configuration_wl_project_add_system_btn} //button[@id='add-system']

View File

@ -1,88 +1,88 @@
*** Settings *** *** Settings ***
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
*** Variables *** *** Variables ***
*** Keywords *** *** Keywords ***
Goto Project Config Goto Project Config
Sleep 3 Sleep 3
Retry Element Click //project-detail//ul/li[contains(.,'Summary')] Retry Element Click //project-detail//ul/li[contains(.,'Summary')]
Sleep 3 Sleep 3
Retry Double Keywords When Error Retry Element Click //project-detail//ul/li[contains(.,'Configuration')] Retry Wait Element //clr-checkbox-wrapper/label[contains(.,'Enable content trust')] Retry Double Keywords When Error Retry Element Click //project-detail//ul/li[contains(.,'Configuration')] Retry Wait Element //clr-checkbox-wrapper/label[contains(.,'Enable content trust')]
Sleep 2 Sleep 2
Click Project Public Click Project Public
Mouse Down //hbr-project-policy-config//input[@name='public'] Mouse Down //hbr-project-policy-config//input[@name='public']
Mouse Up //hbr-project-policy-config//input[@name='public'] Mouse Up //hbr-project-policy-config//input[@name='public']
Click Content Trust Click Content Trust
Mouse Down //hbr-project-policy-config//input[@name='content-trust'] Mouse Down //hbr-project-policy-config//input[@name='content-trust']
Mouse Up //hbr-project-policy-config//input[@name='content-trust'] Mouse Up //hbr-project-policy-config//input[@name='content-trust']
Click Prevent Running Click Prevent Running
Mouse Down //hbr-project-policy-config//input[@name='prevent-vulnerability-image'] Mouse Down //hbr-project-policy-config//input[@name='prevent-vulnerability-image']
Mouse Up //hbr-project-policy-config//input[@name='prevent-vulnerability-image'] Mouse Up //hbr-project-policy-config//input[@name='prevent-vulnerability-image']
Select Prevent Level Select Prevent Level
#value NEGLIGIBLE LOW MEDIUM HIGH #value NEGLIGIBLE LOW MEDIUM HIGH
[Arguments] ${level} [Arguments] ${level}
Retry Element Click //hbr-project-policy-config//select Retry Element Click //hbr-project-policy-config//select
Retry Element Click //hbr-project-policy-config//select/option[contains(.,'${level}')] Retry Element Click //hbr-project-policy-config//select/option[contains(.,'${level}')]
Click Auto Scan Click Auto Scan
Mouse Down //hbr-project-policy-config//input[@name='scan-image-on-push'] Mouse Down //hbr-project-policy-config//input[@name='scan-image-on-push']
Mouse Up //hbr-project-policy-config//input[@name='scan-image-on-push'] Mouse Up //hbr-project-policy-config//input[@name='scan-image-on-push']
Save Project Config Save Project Config
Sleep 1 Sleep 1
Retry Element Click //hbr-project-policy-config//button[contains(.,'SAVE')] Retry Element Click //hbr-project-policy-config//button[contains(.,'SAVE')]
Public Should Be Selected Public Should Be Selected
Checkbox Should Be Selected //hbr-project-policy-config//input[@name='public'] Checkbox Should Be Selected //hbr-project-policy-config//input[@name='public']
Project Should Be Public Project Should Be Public
[Arguments] ${projectName} [Arguments] ${projectName}
Retry Wait Until Page Contains Element //clr-dg-row[contains(.,'${projectName}')]//clr-dg-cell[contains(.,'Public')] Retry Wait Until Page Contains Element //clr-dg-row[contains(.,'${projectName}')]//clr-dg-cell[contains(.,'Public')]
Content Trust Should Be Selected Content Trust Should Be Selected
Checkbox Should Be Selected //hbr-project-policy-config//input[@name='content-trust'] Checkbox Should Be Selected //hbr-project-policy-config//input[@name='content-trust']
Prevent Running Should Be Selected Prevent Running Should Be Selected
Checkbox Should Be Selected //hbr-project-policy-config//input[@name='prevent-vulnerability-image'] Checkbox Should Be Selected //hbr-project-policy-config//input[@name='prevent-vulnerability-image']
Auto Scan Should Be Selected Auto Scan Should Be Selected
Checkbox Should Be Selected //hbr-project-policy-config//input[@name='scan-image-on-push'] Checkbox Should Be Selected //hbr-project-policy-config//input[@name='scan-image-on-push']
Select System CVE Allowlist Select System CVE Allowlist
Retry Element Click ${project_config_system_wl_radio_input} Retry Element Click ${project_config_system_wl_radio_input}
Select Prject CVE Allowlist Select Prject CVE Allowlist
Retry Element Click ${project_config_project_wl_radio_input} Retry Element Click ${project_config_project_wl_radio_input}
Add System CVE Allowlist to Project CVE Allowlist By Add System Button Click Add System CVE Allowlist to Project CVE Allowlist By Add System Button Click
Goto Project Config Goto Project Config
Select Prject CVE Allowlist Select Prject CVE Allowlist
Retry Element Click ${project_configuration_wl_project_add_system_btn} Retry Element Click ${project_configuration_wl_project_add_system_btn}
Retry Element Click ${project_config_save_btn} Retry Element Click ${project_config_save_btn}
Set Project To Project Level CVE Allowlist Set Project To Project Level CVE Allowlist
Goto Project Config Goto Project Config
Select Prject CVE Allowlist Select Prject CVE Allowlist
Retry Element Click ${project_config_save_btn} Retry Element Click ${project_config_save_btn}
Add Items to Project CVE Allowlist Add Items to Project CVE Allowlist
[Arguments] ${cve_id} [Arguments] ${cve_id}
Goto Project Config Goto Project Config
Select Prject CVE Allowlist Select Prject CVE Allowlist
Retry Element Click ${project_config_project_wl_add_btn} Retry Element Click ${project_config_project_wl_add_btn}
Retry Text Input ${configuration_system_wl_textarea} ${cve_id} Retry Text Input ${configuration_system_wl_textarea} ${cve_id}
Retry Element Click ${project_config_project_wl_add_confirm_btn} Retry Element Click ${project_config_project_wl_add_confirm_btn}
Retry Element Click ${project_config_save_btn} Retry Element Click ${project_config_save_btn}
Delete Top Item In Project CVE Allowlist Delete Top Item In Project CVE Allowlist
[Arguments] [Arguments]
Goto Project Config Goto Project Config
Retry Element Click ${project_configuration_wl_delete_a_cve_id_icon} Retry Element Click ${project_configuration_wl_delete_a_cve_id_icon}
Retry Element Click ${project_config_save_btn} Retry Element Click ${project_config_save_btn}

View File

@ -1,14 +1,14 @@
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
*** Variables *** *** Variables ***
${retag_btn} //clr-dg-action-bar//button[contains(.,'Retag')] ${retag_btn} //clr-dg-action-bar//button[contains(.,'Retag')]
${copy_project_name_xpath} //*[@id='project-name'] ${copy_project_name_xpath} //*[@id='project-name']
${copy_repo_name_xpath} //*[@id='repo-name'] ${copy_repo_name_xpath} //*[@id='repo-name']
${tag_name_xpath} //*[@id='tag-name'] ${tag_name_xpath} //*[@id='tag-name']
${confirm_btn} //button[contains(.,'CONFIRM')] ${confirm_btn} //button[contains(.,'CONFIRM')]
${target_image_name} target-alpine ${target_image_name} target-alpine
${image_tag} 3.2.10-alpine ${image_tag} 3.2.10-alpine
${tag_value_xpath} //clr-dg-row[contains(.,'${image_tag}')] ${tag_value_xpath} //clr-dg-row[contains(.,'${image_tag}')]
${modal-dialog} div.modal-dialog ${modal-dialog} div.modal-dialog

View File

@ -1,17 +1,17 @@
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
*** Keywords *** *** Keywords ***
Copy Image Copy Image
[Arguments] ${tag} ${projectname} ${reponame} [Arguments] ${tag} ${projectname} ${reponame}
Retry Element Click xpath=//clr-dg-row[contains(.,'${tag}')]//label Retry Element Click xpath=//clr-dg-row[contains(.,'${tag}')]//label
Sleep 1 Sleep 1
Retry Element Click ${artifact_action_xpath} Retry Element Click ${artifact_action_xpath}
Sleep 1 Sleep 1
Retry Element Click ${artifact_action_copy_xpath} Retry Element Click ${artifact_action_copy_xpath}
Sleep 1 Sleep 1
#input necessary info #input necessary info
Retry Text Input xpath=${copy_project_name_xpath} ${projectname} Retry Text Input xpath=${copy_project_name_xpath} ${projectname}
Retry Text Input xpath=${copy_repo_name_xpath} ${reponame} Retry Text Input xpath=${copy_repo_name_xpath} ${reponame}
Retry Double Keywords When Error Retry Element Click ${confirm_btn} Retry Wait Until Page Not Contains Element ${confirm_btn} Retry Double Keywords When Error Retry Element Click ${confirm_btn} Retry Wait Until Page Not Contains Element ${confirm_btn}

View File

@ -1,50 +1,50 @@
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
*** Keywords *** *** Keywords ***
Switch To Project Charts Switch To Project Charts
Retry Element Click ${project_chart_tabpage} Retry Element Click ${project_chart_tabpage}
Retry Wait Until Page Contains Element ${project_chart_list} Retry Wait Until Page Contains Element ${project_chart_list}
Upload Chart files Upload Chart files
${current_dir}= Run pwd ${current_dir}= Run pwd
Run wget ${harbor_chart_file_url} Run wget ${harbor_chart_file_url}
Run wget ${harbor_chart_prov_file_url} Run wget ${harbor_chart_prov_file_url}
Run wget ${prometheus_chart_file_url} Run wget ${prometheus_chart_file_url}
Retry Double Keywords When Error Retry Element Click xpath=${upload_chart_button} Retry Wait Until Page Contains Element xpath=${upload_action_button} Retry Double Keywords When Error Retry Element Click xpath=${upload_chart_button} Retry Wait Until Page Contains Element xpath=${upload_action_button}
${prometheus_file_path} Set Variable ${current_dir}/${prometheus_chart_filename} ${prometheus_file_path} Set Variable ${current_dir}/${prometheus_chart_filename}
Choose File xpath=${chart_file_browse} ${prometheus_file_path} Choose File xpath=${chart_file_browse} ${prometheus_file_path}
Retry Double Keywords When Error Retry Element Click xpath=${upload_action_button} Retry Wait Until Page Not Contains Element xpath=${upload_action_button} Retry Double Keywords When Error Retry Element Click xpath=${upload_action_button} Retry Wait Until Page Not Contains Element xpath=${upload_action_button}
Retry Double Keywords When Error Retry Element Click xpath=${upload_chart_button} Retry Wait Until Page Contains Element xpath=${upload_action_button} Retry Double Keywords When Error Retry Element Click xpath=${upload_chart_button} Retry Wait Until Page Contains Element xpath=${upload_action_button}
Retry Wait Until Page Contains ${prometheus_chart_name} Retry Wait Until Page Contains ${prometheus_chart_name}
${harbor_file_path} Set Variable ${current_dir}/${harbor_chart_filename} ${harbor_file_path} Set Variable ${current_dir}/${harbor_chart_filename}
${harbor_prov_file_path} Set Variable ${current_dir}/${harbor_chart_prov_filename} ${harbor_prov_file_path} Set Variable ${current_dir}/${harbor_chart_prov_filename}
Choose File xpath=${chart_file_browse} ${harbor_file_path} Choose File xpath=${chart_file_browse} ${harbor_file_path}
Choose File xpath=${chart_prov_browse} ${harbor_prov_file_path} Choose File xpath=${chart_prov_browse} ${harbor_prov_file_path}
Retry Double Keywords When Error Retry Element Click xpath=${upload_action_button} Retry Wait Until Page Not Contains Element xpath=${upload_action_button} Retry Double Keywords When Error Retry Element Click xpath=${upload_action_button} Retry Wait Until Page Not Contains Element xpath=${upload_action_button}
Retry Wait Until Page Contains ${harbor_chart_name} Retry Wait Until Page Contains ${harbor_chart_name}
Go Into Chart Version Go Into Chart Version
[Arguments] ${chart_name} [Arguments] ${chart_name}
Retry Element Click xpath=//hbr-helm-chart//a[contains(., '${chart_name}')] Retry Element Click xpath=//hbr-helm-chart//a[contains(., '${chart_name}')]
Sleep 3 Sleep 3
Go Into Chart Detail Go Into Chart Detail
[Arguments] ${version_name} [Arguments] ${version_name}
Retry Element Click xpath=//hbr-helm-chart-version//a[contains(., '${version_name}')] Retry Element Click xpath=//hbr-helm-chart-version//a[contains(., '${version_name}')]
Retry Wait Until Page Contains Element ${chart_detail} Retry Wait Until Page Contains Element ${chart_detail}
Multi-delete Chart Files Multi-delete Chart Files
[Arguments] @{obj} [Arguments] @{obj}
Switch To Project Charts Switch To Project Charts
FOR ${obj} IN @{obj} FOR ${obj} IN @{obj}
Retry Element Click //clr-dg-row[contains(.,'${obj}')]//label Retry Element Click //clr-dg-row[contains(.,'${obj}')]//label
END END
#Retry Element Click xpath=${version_checkbox} #Retry Element Click xpath=${version_checkbox}
Retry Double Keywords When Error Retry Element Click xpath=${version_delete} Retry Wait Until Page Contains Element ${version_confirm_delete} Retry Double Keywords When Error Retry Element Click xpath=${version_delete} Retry Wait Until Page Contains Element ${version_confirm_delete}
Retry Double Keywords When Error Retry Element Click ${version_confirm_delete} Retry Wait Until Page Not Contains Element xpath=${version_confirm_delete} Retry Double Keywords When Error Retry Element Click ${version_confirm_delete} Retry Wait Until Page Not Contains Element xpath=${version_confirm_delete}
Retry Wait Element xpath=//clr-dg-placeholder[contains(.,\"We couldn\'t find any charts!\")] Retry Wait Element xpath=//clr-dg-placeholder[contains(.,\"We couldn\'t find any charts!\")]

View File

@ -1,38 +1,38 @@
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
*** Variables *** *** Variables ***
${project_chart_tabpage} xpath=//project-detail//a[contains(.,'Charts')] ${project_chart_tabpage} xpath=//project-detail//a[contains(.,'Charts')]
${project_chart_list} xpath=//hbr-helm-chart ${project_chart_list} xpath=//hbr-helm-chart
${upload_chart_button} //*[@id='helm-chart-upload'] ${upload_chart_button} //*[@id='helm-chart-upload']
${chart_file_browse} //*[@id='chart'] ${chart_file_browse} //*[@id='chart']
${chart_prov_browse} //*[@id='prov'] ${chart_prov_browse} //*[@id='prov']
${upload_action_button} //*[@id='upload-chart'] ${upload_action_button} //*[@id='upload-chart']
${harbor_chart_name} harbor ${harbor_chart_name} harbor
${harbor_chart_filename} harbor-0.2.0.tgz ${harbor_chart_filename} harbor-0.2.0.tgz
${harbor_chart_version} 0.2.0 ${harbor_chart_version} 0.2.0
${harbor_chart_prov_filename} harbor-0.2.0.tgz.prov ${harbor_chart_prov_filename} harbor-0.2.0.tgz.prov
${harbor_chart_file_url} https://storage.googleapis.com/harbor-builds/helm-chart-test-files/harbor-0.2.0.tgz ${harbor_chart_file_url} https://storage.googleapis.com/harbor-builds/helm-chart-test-files/harbor-0.2.0.tgz
${harbor_chart_prov_file_url} https://storage.googleapis.com/harbor-builds/helm-chart-test-files/harbor-0.2.0.tgz.prov ${harbor_chart_prov_file_url} https://storage.googleapis.com/harbor-builds/helm-chart-test-files/harbor-0.2.0.tgz.prov
${prometheus_chart_name} prometheus ${prometheus_chart_name} prometheus
${prometheus_chart_filename} prometheus-7.0.2.tgz ${prometheus_chart_filename} prometheus-7.0.2.tgz
${prometheus_chart_version} 7.0.2 ${prometheus_chart_version} 7.0.2
${prometheus_chart_file_url} https://storage.googleapis.com/harbor-builds/helm-chart-test-files/prometheus-7.0.2.tgz ${prometheus_chart_file_url} https://storage.googleapis.com/harbor-builds/helm-chart-test-files/prometheus-7.0.2.tgz
${prometheus_version} //hbr-helm-chart//a[contains(.,'prometheus')] ${prometheus_version} //hbr-helm-chart//a[contains(.,'prometheus')]
${chart_detail} //hbr-chart-detail ${chart_detail} //hbr-chart-detail
${summary_markdown} //*[@id='summary-content']//div[contains(@class,'md-div')] ${summary_markdown} //*[@id='summary-content']//div[contains(@class,'md-div')]
${summary_container} //*[@id='summary-content']//div[contains(@class,'summary-container')] ${summary_container} //*[@id='summary-content']//div[contains(@class,'summary-container')]
${detail_dependency} //*[@id='depend-link'] ${detail_dependency} //*[@id='depend-link']
${dependency_content} //*[@id='depend-content']/hbr-chart-detail-dependency ${dependency_content} //*[@id='depend-content']/hbr-chart-detail-dependency
${detail_value} //*[@id='value-link'] ${detail_value} //*[@id='value-link']
${value_content} //*[@id='value-content']/hbr-chart-detail-value ${value_content} //*[@id='value-content']/hbr-chart-detail-value
${version_bread_crumbs} //project-chart-detail//a[contains(.,'Versions')] ${version_bread_crumbs} //project-chart-detail//a[contains(.,'Versions')]
${version_checkbox} //clr-dg-row//clr-checkbox-wrapper/label ${version_checkbox} //clr-dg-row//clr-checkbox-wrapper/label
${version_delete} //clr-dg-action-bar/button[contains(.,'DELETE')] ${version_delete} //clr-dg-action-bar/button[contains(.,'DELETE')]
${version_confirm_delete} //clr-modal//button[contains(.,'DELETE')] ${version_confirm_delete} //clr-modal//button[contains(.,'DELETE')]
${helmchart_content} //project-detail/project-list-charts/hbr-helm-chart ${helmchart_content} //project-detail/project-list-charts/hbr-helm-chart

View File

@ -1,224 +1,224 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
*** Variables *** *** Variables ***
*** Keywords *** *** Keywords ***
Go Into Project Go Into Project
[Arguments] ${project} ${has_image}=${true} [Arguments] ${project} ${has_image}=${true}
Retry Keyword N Times When Error 5 Clear Search Input And Go Into Project ${project} ${has_image} Retry Keyword N Times When Error 5 Clear Search Input And Go Into Project ${project} ${has_image}
Clear Search Input And Go Into Project Clear Search Input And Go Into Project
[Arguments] ${project} ${has_image} [Arguments] ${project} ${has_image}
# Close prompt in header # Close prompt in header
Sleep 2 Sleep 2
#go To ${url} #go To ${url}
Reload Page Reload Page
Sleep 2 Sleep 2
# Clear Search Input # Clear Search Input
Retry Element Click xpath=//harbor-app/harbor-shell/clr-main-container/navigator/clr-header/div[1]/a/span Retry Element Click xpath=//harbor-app/harbor-shell/clr-main-container/navigator/clr-header/div[1]/a/span
Sleep 2 Sleep 2
Retry Text Input ${search_input} ${project} Retry Text Input ${search_input} ${project}
Sleep 2 Sleep 2
# Go Into Project # Go Into Project
${out} Run Keyword If ${has_image}==${false} Run Keywords Retry Element Click xpath=//*[@id='project-results']//clr-dg-cell[contains(.,'${project}')]/a AND Wait Until Element Is Visible And Enabled xpath=//clr-dg-placeholder[contains(.,\"We couldn\'t find any repositories!\")] ${out} Run Keyword If ${has_image}==${false} Run Keywords Retry Element Click xpath=//*[@id='project-results']//clr-dg-cell[contains(.,'${project}')]/a AND Wait Until Element Is Visible And Enabled xpath=//clr-dg-placeholder[contains(.,\"We couldn\'t find any repositories!\")]
... ELSE Run Keywords Retry Element Click xpath=//*[@id='project-results']//clr-dg-cell[contains(.,'${project}')]/a AND Wait Until Element Is Visible And Enabled xpath=//project-detail//hbr-repository-gridview//clr-dg-cell[contains(.,'${project}/')] ... ELSE Run Keywords Retry Element Click xpath=//*[@id='project-results']//clr-dg-cell[contains(.,'${project}')]/a AND Wait Until Element Is Visible And Enabled xpath=//project-detail//hbr-repository-gridview//clr-dg-cell[contains(.,'${project}/')]
Sleep 1 Sleep 1
Capture Page Screenshot Capture Page Screenshot
Add User To Project Admin Add User To Project Admin
[Arguments] ${project} ${user} [Arguments] ${project} ${user}
# *** this keyword has not been used *** # *** this keyword has not been used ***
Go Into Project Go Into Project
Retry Element Click xpath=${project_member_tag_xpath} Retry Element Click xpath=${project_member_tag_xpath}
Retry Element Click xpath=${project_member_add_button_xpath} Retry Element Click xpath=${project_member_add_button_xpath}
Retry Text Input xpath=${project_member_add_username_xpath} ${user} Retry Text Input xpath=${project_member_add_username_xpath} ${user}
Retry Element Click xpath=${project_member_add_admin_xpath} Retry Element Click xpath=${project_member_add_admin_xpath}
Retry Element Click xpath=${project_member_add_save_button_xpath} Retry Element Click xpath=${project_member_add_save_button_xpath}
Sleep 4 Sleep 4
Search Project Member Search Project Member
[Arguments] ${project} ${user} [Arguments] ${project} ${user}
# *** this keyword has not been used *** # *** this keyword has not been used ***
Go Into Project ${project} Go Into Project ${project}
Retry Element Click xpath=//clr-dg-cell//a[contains(.,'${project}')] Retry Element Click xpath=//clr-dg-cell//a[contains(.,'${project}')]
Retry Element Click xpath=${project_member_search_button_xpath} Retry Element Click xpath=${project_member_search_button_xpath}
Retry Element Click xpath=${project_member_search_text_xpath} Retry Element Click xpath=${project_member_search_text_xpath}
Retry Wait Until Page Contains ${user} Retry Wait Until Page Contains ${user}
Change Project Member Role Change Project Member Role
[Arguments] ${project} ${user} ${role} [Arguments] ${project} ${user} ${role}
Retry Element Click xpath=//clr-dg-cell//a[contains(.,'${project}')] Retry Element Click xpath=//clr-dg-cell//a[contains(.,'${project}')]
Change Member Role ${user} ${role} Change Member Role ${user} ${role}
Change Member Role Change Member Role
[Arguments] ${user} ${role} [Arguments] ${user} ${role}
Retry Element Click xpath=${project_member_tag_xpath} Retry Element Click xpath=${project_member_tag_xpath}
Retry Element Click xpath=//project-detail//clr-dg-row[contains(.,'${user}')]//clr-checkbox-wrapper Retry Element Click xpath=//project-detail//clr-dg-row[contains(.,'${user}')]//clr-checkbox-wrapper
#change role #change role
Retry Element Click ${project_member_action_xpath} Retry Element Click ${project_member_action_xpath}
Retry Element Click //button[contains(.,'${role}')] Retry Element Click //button[contains(.,'${role}')]
Retry Wait Until Page Not Contains Element ${project_member_set_role_xpath} Retry Wait Until Page Not Contains Element ${project_member_set_role_xpath}
#Precondition is that only 1 member is in the list. #Precondition is that only 1 member is in the list.
Retry Wait Until Page Contains ${role} Retry Wait Until Page Contains ${role}
User Can Change Role User Can Change Role
[arguments] ${username} [arguments] ${username}
Retry Element Click xpath=//clr-dg-row[contains(.,'${username}')]//input/../label Retry Element Click xpath=//clr-dg-row[contains(.,'${username}')]//input/../label
Retry Element Click xpath=//*[@id='member-action'] Retry Element Click xpath=//*[@id='member-action']
Retry Wait Until Page Not Contains Element xpath=//button[@disabled='' and contains(.,'Admin')] Retry Wait Until Page Not Contains Element xpath=//button[@disabled='' and contains(.,'Admin')]
User Can Not Change Role User Can Not Change Role
[arguments] ${username} [arguments] ${username}
Retry Element Click xpath=//clr-dg-row[contains(.,'${username}')]//input/../label Retry Element Click xpath=//clr-dg-row[contains(.,'${username}')]//input/../label
Retry Element Click xpath=//*[@id='member-action'] Retry Element Click xpath=//*[@id='member-action']
Retry Wait Until Page Contains Element xpath=//button[@disabled='' and contains(.,'Admin')] Retry Wait Until Page Contains Element xpath=//button[@disabled='' and contains(.,'Admin')]
#this keyworkd seems will not use any more, will delete in the future #this keyworkd seems will not use any more, will delete in the future
Non-admin View Member Account Non-admin View Member Account
[arguments] ${times} [arguments] ${times}
Xpath Should Match X Times //clr-dg-row-maintainer ${times} Xpath Should Match X Times //clr-dg-row-maintainer ${times}
User Can Not Add Member User Can Not Add Member
Retry Wait Until Page Contains Element xpath=//button[@disabled='' and contains(.,'User')] Retry Wait Until Page Contains Element xpath=//button[@disabled='' and contains(.,'User')]
Add Guest Member To Project Add Guest Member To Project
[arguments] ${member} [arguments] ${member}
Retry Double Keywords When Error Retry Element Click xpath=${project_member_add_button_xpath} Retry Wait Until Page Contains Element xpath=${project_member_add_button_xpath} Retry Double Keywords When Error Retry Element Click xpath=${project_member_add_button_xpath} Retry Wait Until Page Contains Element xpath=${project_member_add_button_xpath}
Retry Text Input xpath=${project_member_add_username_xpath} ${member} Retry Text Input xpath=${project_member_add_username_xpath} ${member}
#select guest #select guest
Mouse Down xpath=${project_member_guest_radio_checkbox} Mouse Down xpath=${project_member_guest_radio_checkbox}
Mouse Up xpath=${project_member_guest_radio_checkbox} Mouse Up xpath=${project_member_guest_radio_checkbox}
Retry Double Keywords When Error Retry Element Click xpath=${project_member_add_confirmation_ok_xpath} Retry Wait Until Page Not Contains Element xpath=${project_member_add_confirmation_ok_xpath} Retry Double Keywords When Error Retry Element Click xpath=${project_member_add_confirmation_ok_xpath} Retry Wait Until Page Not Contains Element xpath=${project_member_add_confirmation_ok_xpath}
Delete Project Member Delete Project Member
[arguments] ${member} [arguments] ${member}
Retry Element Click xpath=//clr-dg-row[contains(.,'${member}')]//input/../label Retry Element Click xpath=//clr-dg-row[contains(.,'${member}')]//input/../label
Retry Double Keywords When Error Retry Element Click ${member_action_xpath} Retry Wait Until Page Contains Element ${delete_action_xpath} Retry Double Keywords When Error Retry Element Click ${member_action_xpath} Retry Wait Until Page Contains Element ${delete_action_xpath}
Retry Double Keywords When Error Retry Element Click ${delete_action_xpath} Retry Wait Until Page Contains Element ${repo_delete_on_card_view_btn} Retry Double Keywords When Error Retry Element Click ${delete_action_xpath} Retry Wait Until Page Contains Element ${repo_delete_on_card_view_btn}
Retry Double Keywords When Error Retry Element Click ${repo_delete_on_card_view_btn} Retry Wait Element xpath=${project_member_xpath} Retry Double Keywords When Error Retry Element Click ${repo_delete_on_card_view_btn} Retry Wait Element xpath=${project_member_xpath}
Sleep 1 Sleep 1
User Should Be Owner Of Project User Should Be Owner Of Project
[Arguments] ${user} ${pwd} ${project} [Arguments] ${user} ${pwd} ${project}
Sign In Harbor ${HARBOR_URL} ${user} ${pwd} Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
Go Into Project ${project} Go Into Project ${project}
Switch To Member Switch To Member
User Can Not Change Role ${user} User Can Not Change Role ${user}
Push image ${ip} ${user} ${pwd} ${project} hello-world Push image ${ip} ${user} ${pwd} ${project} hello-world
Logout Harbor Logout Harbor
User Should Not Be A Member Of Project User Should Not Be A Member Of Project
[Arguments] ${user} ${pwd} ${project} ${is_oidc_mode}=${false} [Arguments] ${user} ${pwd} ${project} ${is_oidc_mode}=${false}
Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${user} ${pwd} Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${user} ... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${user}
${pwd_oidc}= Run Keyword And Return If ${is_oidc_mode} == ${true} Get Secrete By API ${HARBOR_URL} ${pwd_oidc}= Run Keyword And Return If ${is_oidc_mode} == ${true} Get Secrete By API ${HARBOR_URL}
${password}= Set Variable If ${is_oidc_mode} == ${true} ${pwd_oidc} ${pwd} ${password}= Set Variable If ${is_oidc_mode} == ${true} ${pwd_oidc} ${pwd}
Project Should Not Display ${project} Project Should Not Display ${project}
Logout Harbor Logout Harbor
Cannot Pull Image ${ip} ${user} ${password} ${project} ${ip}/${project}/hello-world Cannot Pull Image ${ip} ${user} ${password} ${project} ${ip}/${project}/hello-world
Cannot Pull Image ${ip} ${user} ${password} ${project} hello-world Cannot Pull Image ${ip} ${user} ${password} ${project} hello-world
Manage Project Member Manage Project Member
[Arguments] ${admin} ${pwd} ${project} ${user} ${op} ${has_image}=${true} ${is_oidc_mode}=${false} [Arguments] ${admin} ${pwd} ${project} ${user} ${op} ${has_image}=${true} ${is_oidc_mode}=${false}
Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${admin} ${pwd} Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${admin} ${pwd}
... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${admin} ... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${admin}
Manage Project Member Without Sign In ${project} ${user} ${op} has_image=${has_image} Manage Project Member Without Sign In ${project} ${user} ${op} has_image=${has_image}
Logout Harbor Logout Harbor
Manage Project Member Without Sign In Manage Project Member Without Sign In
[Arguments] ${project} ${user} ${op} ${has_image}=${true} [Arguments] ${project} ${user} ${op} ${has_image}=${true}
Go Into Project ${project} ${has_image} Go Into Project ${project} ${has_image}
Switch To Member Switch To Member
Run Keyword If '${op}' == 'Add' Add Guest Member To Project ${user} Run Keyword If '${op}' == 'Add' Add Guest Member To Project ${user}
... ELSE IF '${op}' == 'Remove' Delete Project Member ${user} ... ELSE IF '${op}' == 'Remove' Delete Project Member ${user}
... ELSE Change Project Member Role ${project} ${user} ${role} ... ELSE Change Project Member Role ${project} ${user} ${role}
Change User Role In Project Change User Role In Project
[Arguments] ${admin} ${pwd} ${project} ${user} ${role} ${is_oidc_mode}=${false} [Arguments] ${admin} ${pwd} ${project} ${user} ${role} ${is_oidc_mode}=${false}
Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${admin} ${pwd} Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${admin} ${pwd}
... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${admin} ... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${admin}
Retry Wait Element Visible //clr-dg-cell//a[contains(.,'${project}')] Retry Wait Element Visible //clr-dg-cell//a[contains(.,'${project}')]
Change Project Member Role ${project} ${user} ${role} Change Project Member Role ${project} ${user} ${role}
Logout Harbor Logout Harbor
User Should Be Guest User Should Be Guest
[Arguments] ${user} ${pwd} ${project} ${is_oidc_mode}=${false} [Arguments] ${user} ${pwd} ${project} ${is_oidc_mode}=${false}
Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${user} ${pwd} Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${user} ... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${user}
${pwd_oidc}= Run Keyword And Return If ${is_oidc_mode} == ${true} Get Secrete By API ${HARBOR_URL} ${pwd_oidc}= Run Keyword And Return If ${is_oidc_mode} == ${true} Get Secrete By API ${HARBOR_URL}
${password}= Set Variable If ${is_oidc_mode} == ${true} ${pwd_oidc} ${pwd} ${password}= Set Variable If ${is_oidc_mode} == ${true} ${pwd_oidc} ${pwd}
Project Should Display ${project} Project Should Display ${project}
Go Into Project ${project} Go Into Project ${project}
Switch To Member Switch To Member
User Can Not Add Member User Can Not Add Member
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Guest')] Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Guest')]
Logout Harbor Logout Harbor
Pull image ${ip} ${user} ${password} ${project} hello-world Pull image ${ip} ${user} ${password} ${project} hello-world
Cannot Push image ${ip} ${user} ${password} ${project} hello-world Cannot Push image ${ip} ${user} ${password} ${project} hello-world
User Should Be Developer User Should Be Developer
[Arguments] ${user} ${pwd} ${project} ${is_oidc_mode}=${false} [Arguments] ${user} ${pwd} ${project} ${is_oidc_mode}=${false}
Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${user} ${pwd} Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${user} ... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${user}
${pwd_oidc}= Run Keyword And Return If ${is_oidc_mode} == ${true} Get Secrete By API ${HARBOR_URL} ${pwd_oidc}= Run Keyword And Return If ${is_oidc_mode} == ${true} Get Secrete By API ${HARBOR_URL}
${password}= Set Variable If ${is_oidc_mode} == ${true} ${pwd_oidc} ${pwd} ${password}= Set Variable If ${is_oidc_mode} == ${true} ${pwd_oidc} ${pwd}
Project Should Display ${project} Project Should Display ${project}
Go Into Project ${project} Go Into Project ${project}
Switch To Member Switch To Member
User Can Not Add Member User Can Not Add Member
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Developer')] Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Developer')]
Logout Harbor Logout Harbor
Push Image With Tag ${ip} ${user} ${password} ${project} hello-world v1 Push Image With Tag ${ip} ${user} ${password} ${project} hello-world v1
User Should Be Admin User Should Be Admin
[Arguments] ${user} ${pwd} ${project} ${guest} ${is_oidc_mode}=${false} [Arguments] ${user} ${pwd} ${project} ${guest} ${is_oidc_mode}=${false}
Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${user} ${pwd} Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${user} ... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${user}
${pwd_oidc}= Run Keyword And Return If ${is_oidc_mode} == ${true} Get Secrete By API ${HARBOR_URL} ${pwd_oidc}= Run Keyword And Return If ${is_oidc_mode} == ${true} Get Secrete By API ${HARBOR_URL}
${password}= Set Variable If ${is_oidc_mode} == ${true} ${pwd_oidc} ${pwd} ${password}= Set Variable If ${is_oidc_mode} == ${true} ${pwd_oidc} ${pwd}
Project Should Display ${project} Project Should Display ${project}
Go Into Project ${project} Go Into Project ${project}
Switch To Member Switch To Member
Add Guest Member To Project ${guest} Add Guest Member To Project ${guest}
User Can Change Role ${guest} User Can Change Role ${guest}
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Admin')] Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Admin')]
Logout Harbor Logout Harbor
Push Image With Tag ${ip} ${user} ${password} ${project} hello-world v2 Push Image With Tag ${ip} ${user} ${password} ${project} hello-world v2
User Should Be Maintainer User Should Be Maintainer
[Arguments] ${user} ${pwd} ${project} ${image} ${is_oidc_mode}=${false} [Arguments] ${user} ${pwd} ${project} ${image} ${is_oidc_mode}=${false}
Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${user} ${pwd} Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${user} ... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${user}
${pwd_oidc}= Run Keyword And Return If ${is_oidc_mode} == ${true} Get Secrete By API ${HARBOR_URL} ${pwd_oidc}= Run Keyword And Return If ${is_oidc_mode} == ${true} Get Secrete By API ${HARBOR_URL}
${password}= Set Variable If ${is_oidc_mode} == ${true} ${pwd_oidc} ${pwd} ${password}= Set Variable If ${is_oidc_mode} == ${true} ${pwd_oidc} ${pwd}
Project Should Display ${project} Project Should Display ${project}
Go Into Project ${project} Go Into Project ${project}
Delete Repo ${project} ${image} Delete Repo ${project} ${image}
Switch To Member Switch To Member
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Maintainer')] Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Maintainer')]
Logout Harbor Logout Harbor
Push Image With Tag ${ip} ${user} ${password} ${project} hello-world v3 Push Image With Tag ${ip} ${user} ${password} ${project} hello-world v3
Project Should Have Member Project Should Have Member
[Arguments] ${project} ${user} [Arguments] ${project} ${user}
Sign In Harbor ${HARBOR_URL} %{HARBOR_ADMIN} %{HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} %{HARBOR_ADMIN} %{HARBOR_PASSWORD}
Go Into Project ${project} Go Into Project ${project}
Switch To Member Switch To Member
Retry Wait Until Page Contains Element xpath=//clr-dg-cell[contains(., '${user}')] Retry Wait Until Page Contains Element xpath=//clr-dg-cell[contains(., '${user}')]
Logout Harbor Logout Harbor

View File

@ -1,30 +1,30 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
*** Variables *** *** Variables ***
${project_member_tag_xpath} //clr-main-container//project-detail/clr-tabs//a[contains(.,'Members')] ${project_member_tag_xpath} //clr-main-container//project-detail/clr-tabs//a[contains(.,'Members')]
${project_member_add_button_xpath} //project-detail//button[contains(.,'User')] ${project_member_add_button_xpath} //project-detail//button[contains(.,'User')]
${project_member_add_username_xpath} //*[@id='member_name'] ${project_member_add_username_xpath} //*[@id='member_name']
${project_member_add_admin_xpath} /html/body/harbor-app/harbor-shell/clr-main-container/div/div/project-detail/ng-component/div/div[1]/div/div[1]/add-member/clr-modal/div/div[1]/div/div[1]/div/div[2]/form/section/div[2]/div[1]/label ${project_member_add_admin_xpath} /html/body/harbor-app/harbor-shell/clr-main-container/div/div/project-detail/ng-component/div/div[1]/div/div[1]/add-member/clr-modal/div/div[1]/div/div[1]/div/div[2]/form/section/div[2]/div[1]/label
${project_member_add_save_button_xpath} /html/body/harbor-app/harbor-shell/clr-main-container/div/div/project-detail/ng-component/div/div[1]/div/div[1]/add-member/clr-modal/div/div[1]/div/div[1]/div/div[3]/button[2] ${project_member_add_save_button_xpath} /html/body/harbor-app/harbor-shell/clr-main-container/div/div/project-detail/ng-component/div/div[1]/div/div[1]/add-member/clr-modal/div/div[1]/div/div[1]/div/div[3]/button[2]
${project_member_search_button_xpath} //project-detail//hbr-filter/span/clr-icon ${project_member_search_button_xpath} //project-detail//hbr-filter/span/clr-icon
${project_member_search_text_xpath} //project-detail//hbr-filter/span/input ${project_member_search_text_xpath} //project-detail//hbr-filter/span/input
${project_member_add_confirmation_ok_xpath} //project-detail//add-member//button[2] ${project_member_add_confirmation_ok_xpath} //project-detail//add-member//button[2]
${project_member_search_button_xpath2} //button[contains(.,'New')] ${project_member_search_button_xpath2} //button[contains(.,'New')]
${project_member_add_button_xpath2} //project-detail//add-member//button[2] ${project_member_add_button_xpath2} //project-detail//add-member//button[2]
${project_member_guest_radio_checkbox} //project-detail//form//input[@id='checkrads_guest'] ${project_member_guest_radio_checkbox} //project-detail//form//input[@id='checkrads_guest']
${project_member_delete_button_xpath} //button[contains(.,'REMOVE')] ${project_member_delete_button_xpath} //button[contains(.,'REMOVE')]

View File

@ -1,33 +1,33 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
*** Keywords *** *** Keywords ***
View Repo Scan Details View Repo Scan Details
[Arguments] @{vulnerabilities_level} [Arguments] @{vulnerabilities_level}
Retry Element Click xpath=${first_repo_xpath} Retry Element Click xpath=${first_repo_xpath}
FOR ${item} IN @{vulnerabilities_level} FOR ${item} IN @{vulnerabilities_level}
Retry Wait Until Page Contains Element //hbr-artifact-vulnerabilities//clr-dg-row[contains(.,'${item}')] Retry Wait Until Page Contains Element //hbr-artifact-vulnerabilities//clr-dg-row[contains(.,'${item}')]
END END
Retry Element Click xpath=${build_history_btn} Retry Element Click xpath=${build_history_btn}
Retry Wait Until Page Contains Element xpath=${build_history_data} Retry Wait Until Page Contains Element xpath=${build_history_data}
View Scan Error Log View Scan Error Log
Retry Wait Until Page Contains View Log Retry Wait Until Page Contains View Log
Retry Element Click xpath=${view_log_xpath} Retry Element Click xpath=${view_log_xpath}

View File

@ -1,26 +1,26 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
*** Variables *** *** Variables ***
${first_repo_xpath} //clr-dg-row//clr-dg-cell[1]//a ${first_repo_xpath} //clr-dg-row//clr-dg-cell[1]//a
${first_cve_xpath} //clr-dg-row[1]//clr-dg-cell//a ${first_cve_xpath} //clr-dg-row[1]//clr-dg-cell//a
${view_log_xpath} //clr-dg-row//clr-dg-cell//a[contains(.,'View Log')] ${view_log_xpath} //clr-dg-row//clr-dg-cell//a[contains(.,'View Log')]
${build_history_btn} //button[contains(.,'Build History')] ${build_history_btn} //button[contains(.,'Build History')]
${build_history_data} //clr-dg-row ${build_history_data} //clr-dg-row
${push_image_command_btn} //hbr-push-image-button//button ${push_image_command_btn} //hbr-push-image-button//button

View File

@ -1,119 +1,119 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
*** Variables *** *** Variables ***
*** Keywords *** *** Keywords ***
Add A Tag Retention Rule Add A Tag Retention Rule
Retry Element Click xpath=${project_tag_retention_add_rule_xpath} Retry Element Click xpath=${project_tag_retention_add_rule_xpath}
Retry Element Click xpath=${project_tag_retention_template_xpath} Retry Element Click xpath=${project_tag_retention_template_xpath}
Retry Element Click xpath=${project_tag_retention_option_always_xpath} Retry Element Click xpath=${project_tag_retention_option_always_xpath}
Retry Element Click xpath=${project_tag_retention_save_add_button_xpath} Retry Element Click xpath=${project_tag_retention_save_add_button_xpath}
Retry Wait Until Page Contains Element xpath=${project_tag_retention_rule_name_xpath} Retry Wait Until Page Contains Element xpath=${project_tag_retention_rule_name_xpath}
Retry Add A Tag Immutability Rule Retry Add A Tag Immutability Rule
[Arguments] @{param} [Arguments] @{param}
Retry Keyword N Times When Error 5 Add A Tag Immutability Rule @{param} Retry Keyword N Times When Error 5 Add A Tag Immutability Rule @{param}
Add A Tag Immutability Rule Add A Tag Immutability Rule
[Arguments] ${scope} ${tag} [Arguments] ${scope} ${tag}
Reload Page Reload Page
Sleep 3 Sleep 3
Retry Double Keywords When Error Retry Element Click xpath=${project_tag_retention_add_rule_xpath} Retry Wait Until Page Contains Element xpath=${project_tag_immutability_save_add_button_xpath} Retry Double Keywords When Error Retry Element Click xpath=${project_tag_retention_add_rule_xpath} Retry Wait Until Page Contains Element xpath=${project_tag_immutability_save_add_button_xpath}
Retry Clear Element Text ${project_tag_immutability_scope_input_xpath} Retry Clear Element Text ${project_tag_immutability_scope_input_xpath}
Retry Text Input ${project_tag_immutability_scope_input_xpath} ${scope} Retry Text Input ${project_tag_immutability_scope_input_xpath} ${scope}
Retry Clear Element Text ${project_tag_immutability_tag_input_xpath} Retry Clear Element Text ${project_tag_immutability_tag_input_xpath}
Retry Text Input ${project_tag_immutability_tag_input_xpath} ${tag} Retry Text Input ${project_tag_immutability_tag_input_xpath} ${tag}
Retry Double Keywords When Error Retry Element Click xpath=${project_tag_immutability_save_add_button_xpath} Retry Wait Until Page Contains Element xpath=${project_tag_retention_rule_name_xpath} Retry Double Keywords When Error Retry Element Click xpath=${project_tag_immutability_save_add_button_xpath} Retry Wait Until Page Contains Element xpath=${project_tag_retention_rule_name_xpath}
Retry Wait Until Page Contains ${scope} Retry Wait Until Page Contains ${scope}
Retry Wait Until Page Contains ${tag} Retry Wait Until Page Contains ${tag}
Delete A Tag Retention Rule Delete A Tag Retention Rule
Retry Element Click xpath=${project_tag_retention_action_button_xpath} Retry Element Click xpath=${project_tag_retention_action_button_xpath}
Retry Element Click xpath=${project_tag_retention_delete_button_xpath} Retry Element Click xpath=${project_tag_retention_delete_button_xpath}
Retry Wait Until Page Not Contains Element xpath=${project_tag_retention_rule_name_xpath} Retry Wait Until Page Not Contains Element xpath=${project_tag_retention_rule_name_xpath}
Delete A Tag Immutability Rule Delete A Tag Immutability Rule
Retry Element Click xpath=${project_tag_retention_action_button_xpath} Retry Element Click xpath=${project_tag_retention_action_button_xpath}
Retry Element Click xpath=${project_tag_retention_delete_button_xpath} Retry Element Click xpath=${project_tag_retention_delete_button_xpath}
Retry Wait Until Page Not Contains Element xpath=${project_tag_retention_rule_name_xpath} Retry Wait Until Page Not Contains Element xpath=${project_tag_retention_rule_name_xpath}
Edit A Tag Retention Rule Edit A Tag Retention Rule
[Arguments] ${repos} ${tags} [Arguments] ${repos} ${tags}
Retry Element Click xpath=${project_tag_retention_action_button_xpath} Retry Element Click xpath=${project_tag_retention_action_button_xpath}
Retry Element Click xpath=${project_tag_retention_edit_button_xpath} Retry Element Click xpath=${project_tag_retention_edit_button_xpath}
Retry Wait Until Page Contains Element xpath=${project_tag_retention_modal_title_edit_xpath} Retry Wait Until Page Contains Element xpath=${project_tag_retention_modal_title_edit_xpath}
Input Text ${project_tag_retention_repo_input_xpath} ${repos} Input Text ${project_tag_retention_repo_input_xpath} ${repos}
Input Text ${project_tag_retention_tags_input_xpath} ${tags} Input Text ${project_tag_retention_tags_input_xpath} ${tags}
Retry Element Click xpath=${project_tag_retention_save_add_button_xpath} Retry Element Click xpath=${project_tag_retention_save_add_button_xpath}
Retry Wait Until Page Contains Element xpath=//span[contains(@class, 'rule-name')]//span[contains(.,'${tags}')] Retry Wait Until Page Contains Element xpath=//span[contains(@class, 'rule-name')]//span[contains(.,'${tags}')]
Edit A Tag Immutability Rule Edit A Tag Immutability Rule
[Arguments] ${scope} ${tag} [Arguments] ${scope} ${tag}
Retry Element Click xpath=${project_tag_retention_action_button_xpath} Retry Element Click xpath=${project_tag_retention_action_button_xpath}
Retry Element Click xpath=${project_tag_retention_edit_button_xpath} Retry Element Click xpath=${project_tag_retention_edit_button_xpath}
Retry Clear Element Text ${project_tag_immutability_scope_input_xpath} Retry Clear Element Text ${project_tag_immutability_scope_input_xpath}
Retry Text Input ${project_tag_immutability_scope_input_xpath} ${scope} Retry Text Input ${project_tag_immutability_scope_input_xpath} ${scope}
Retry Clear Element Text ${project_tag_immutability_tag_input_xpath} Retry Clear Element Text ${project_tag_immutability_tag_input_xpath}
Retry Text Input ${project_tag_immutability_tag_input_xpath} ${tag} Retry Text Input ${project_tag_immutability_tag_input_xpath} ${tag}
Retry Double Keywords When Error Retry Element Click xpath=${project_tag_immutability_save_add_button_xpath} Retry Wait Until Page Contains Element xpath=${project_tag_retention_rule_name_xpath} Retry Double Keywords When Error Retry Element Click xpath=${project_tag_immutability_save_add_button_xpath} Retry Wait Until Page Contains Element xpath=${project_tag_retention_rule_name_xpath}
Retry Wait Until Page Contains ${scope} Retry Wait Until Page Contains ${scope}
Retry Wait Until Page Contains ${tag} Retry Wait Until Page Contains ${tag}
Set Daily Schedule Set Daily Schedule
Retry Element Click xpath=${project_tag_retention_edit_schedule_xpath} Retry Element Click xpath=${project_tag_retention_edit_schedule_xpath}
Retry Element Click xpath=${project_tag_retention_select_policy_xpath} Retry Element Click xpath=${project_tag_retention_select_policy_xpath}
Retry Element Click xpath=${project_tag_retention_option_daily_xpath} Retry Element Click xpath=${project_tag_retention_option_daily_xpath}
Retry Element Click xpath=${project_tag_retention_config_save_xpath} Retry Element Click xpath=${project_tag_retention_config_save_xpath}
Retry Wait Until Page Contains Element xpath=${project_tag_retention_schedule_ok_xpath} Retry Wait Until Page Contains Element xpath=${project_tag_retention_schedule_ok_xpath}
Retry Element Click xpath=${project_tag_retention_schedule_ok_xpath} Retry Element Click xpath=${project_tag_retention_schedule_ok_xpath}
Retry Wait Until Page Contains Element xpath=${project_tag_retention_span_daily_xpath} Retry Wait Until Page Contains Element xpath=${project_tag_retention_span_daily_xpath}
Execute Result Should Be Execute Result Should Be
[Arguments] ${image} ${result} [Arguments] ${image} ${result}
FOR ${idx} IN RANGE 0 20 FOR ${idx} IN RANGE 0 20
${out} Run Keyword And Ignore Error Retry Wait Until Page Contains Element xpath=//div[contains(@role, 'grid')]//div[contains(@class, 'datagrid-row-master') and contains(@role, 'row')]//clr-datagrid//div[contains(@role, 'grid')]//div[contains(@class, 'datagrid-row-master') and contains(@role, 'row')]//div[contains(@class, 'datagrid-row-scrollable') and contains(., '${result}') and contains(., '${image}')] ${out} Run Keyword And Ignore Error Retry Wait Until Page Contains Element xpath=//div[contains(@role, 'grid')]//div[contains(@class, 'datagrid-row-master') and contains(@role, 'row')]//clr-datagrid//div[contains(@role, 'grid')]//div[contains(@class, 'datagrid-row-master') and contains(@role, 'row')]//div[contains(@class, 'datagrid-row-scrollable') and contains(., '${result}') and contains(., '${image}')]
Exit For Loop If '${out[0]}'=='PASS' Exit For Loop If '${out[0]}'=='PASS'
Sleep 1 Sleep 1
Retry Element Click ${project_tag_retention_refresh_xpath} Retry Element Click ${project_tag_retention_refresh_xpath}
Sleep 5 Sleep 5
Retry Wait Until Page Contains Element xpath=${project_tag_retention_record_yes_xpath} Retry Wait Until Page Contains Element xpath=${project_tag_retention_record_yes_xpath}
Retry Element Click ${project_tag_retention_list_expand_icon_xpath} Retry Element Click ${project_tag_retention_list_expand_icon_xpath}
END END
Should Be Equal As Strings '${out[0]}' 'PASS' Should Be Equal As Strings '${out[0]}' 'PASS'
Execute Dry Run Execute Dry Run
[Arguments] ${image} ${result} [Arguments] ${image} ${result}
Retry Element Click xpath=${project_tag_retention_dry_run_xpath} Retry Element Click xpath=${project_tag_retention_dry_run_xpath}
Retry Wait Until Page Contains Element xpath=${project_tag_retention_record_yes_xpath} Retry Wait Until Page Contains Element xpath=${project_tag_retention_record_yes_xpath}
Sleep 5 Sleep 5
Retry Element Click xpath=${project_tag_retention_record_yes_xpath} Retry Element Click xpath=${project_tag_retention_record_yes_xpath}
# memcached:123 should be deleted and hello-world:latest should be retained # memcached:123 should be deleted and hello-world:latest should be retained
Execute Result Should Be ${image} ${result} Execute Result Should Be ${image} ${result}
Execute Run Execute Run
[Arguments] ${image} ${result} [Arguments] ${image} ${result}
Retry Element Click xpath=${project_tag_retention_run_now_xpath} Retry Element Click xpath=${project_tag_retention_run_now_xpath}
Retry Element Click xpath=${project_tag_retention_execute_run_xpath} Retry Element Click xpath=${project_tag_retention_execute_run_xpath}
Retry Wait Until Page Contains Element xpath=${project_tag_retention_record_no_xpath} Retry Wait Until Page Contains Element xpath=${project_tag_retention_record_no_xpath}
Sleep 5 Sleep 5
Retry Element Click xpath=${project_tag_retention_record_no_xpath} Retry Element Click xpath=${project_tag_retention_record_no_xpath}
# memcached:123 should be deleted and hello-world:latest should be retained # memcached:123 should be deleted and hello-world:latest should be retained
Execute Result Should Be ${image} ${result} Execute Result Should Be ${image} ${result}

View File

@ -1,47 +1,47 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
*** Variables *** *** Variables ***
${project_tag_retention_add_rule_xpath} //*[@id='add-rule'] ${project_tag_retention_add_rule_xpath} //*[@id='add-rule']
${project_tag_retention_repo_input_xpath} //*[@id='repos'] ${project_tag_retention_repo_input_xpath} //*[@id='repos']
${project_tag_retention_param_input_xpath} //*[@id='param'] ${project_tag_retention_param_input_xpath} //*[@id='param']
${project_tag_retention_tags_input_xpath} //*[@id='tags'] ${project_tag_retention_tags_input_xpath} //*[@id='tags']
${project_tag_retention_save_add_button_xpath} //*[@id='save-add'] ${project_tag_retention_save_add_button_xpath} //*[@id='save-add']
${project_tag_retention_template_xpath} //*[@id='template'] ${project_tag_retention_template_xpath} //*[@id='template']
${project_tag_retention_option_always_xpath} //option[@value='always'] ${project_tag_retention_option_always_xpath} //option[@value='always']
${project_tag_retention_rule_name_xpath} //ul//span[@class='rule-name ml-5'] ${project_tag_retention_rule_name_xpath} //ul//span[@class='rule-name ml-5']
${project_tag_retention_edit_schedule_xpath} //*[@id='editSchedule'] ${project_tag_retention_edit_schedule_xpath} //*[@id='editSchedule']
${project_tag_retention_select_policy_xpath} //*[@id='selectPolicy'] ${project_tag_retention_select_policy_xpath} //*[@id='selectPolicy']
${project_tag_retention_option_daily_xpath} //option[@value='Daily'] ${project_tag_retention_option_daily_xpath} //option[@value='Daily']
${project_tag_retention_config_save_xpath} //*[@id='config-save'] ${project_tag_retention_config_save_xpath} //*[@id='config-save']
${project_tag_retention_schedule_ok_xpath} //*[@id='schedule-ok'] ${project_tag_retention_schedule_ok_xpath} //*[@id='schedule-ok']
${project_tag_retention_span_daily_xpath} //cron-selection//div//span[contains(.,'0 0 0 * * *')] ${project_tag_retention_span_daily_xpath} //cron-selection//div//span[contains(.,'0 0 0 * * *')]
${project_tag_retention_dry_run_xpath} //*[@id='dry-run'] ${project_tag_retention_dry_run_xpath} //*[@id='dry-run']
${project_tag_retention_refresh_xpath} //clr-dg-action-bar/button[4] ${project_tag_retention_refresh_xpath} //clr-dg-action-bar/button[4]
${project_tag_retention_record_yes_xpath} //clr-datagrid[contains(.,'Yes')] ${project_tag_retention_record_yes_xpath} //clr-datagrid[contains(.,'Yes')]
${project_tag_retention_list_expand_icon_xpath} //project-detail/app-tag-feature-integration/tag-retention//clr-datagrid//clr-dg-row//clr-dg-cell[1]/clr-icon[contains(@shape, 'angle')] ${project_tag_retention_list_expand_icon_xpath} //project-detail/app-tag-feature-integration/tag-retention//clr-datagrid//clr-dg-row//clr-dg-cell[1]/clr-icon[contains(@shape, 'angle')]
${project_tag_retention_run_now_xpath} //*[@id='run-now'] ${project_tag_retention_run_now_xpath} //*[@id='run-now']
${project_tag_retention_execute_run_xpath} //*[@id='execute-run'] ${project_tag_retention_execute_run_xpath} //*[@id='execute-run']
${project_tag_retention_record_no_xpath} //clr-datagrid[contains(.,'No')] ${project_tag_retention_record_no_xpath} //clr-datagrid[contains(.,'No')]
${project_tag_retention_action_button_xpath} //button[contains(.,'ACTION')] ${project_tag_retention_action_button_xpath} //button[contains(.,'ACTION')]
${project_tag_retention_delete_button_xpath} //div[contains(@class,'dropdown-menu')]//button[contains(.,'Delete')] ${project_tag_retention_delete_button_xpath} //div[contains(@class,'dropdown-menu')]//button[contains(.,'Delete')]
${project_tag_retention_edit_button_xpath} //div[contains(@class,'dropdown-menu')]//button[contains(.,'Edit')] ${project_tag_retention_edit_button_xpath} //div[contains(@class,'dropdown-menu')]//button[contains(.,'Edit')]
${project_tag_retention_modal_title_edit_xpath} //h3[contains(.,'Edit Tag Retention Rule')] ${project_tag_retention_modal_title_edit_xpath} //h3[contains(.,'Edit Tag Retention Rule')]
${project_tag_immutability_scope_input_xpath} //*[@id='scope-input'] ${project_tag_immutability_scope_input_xpath} //*[@id='scope-input']
${project_tag_immutability_tag_input_xpath} //*[@id='tag-input'] ${project_tag_immutability_tag_input_xpath} //*[@id='tag-input']
${project_tag_immutability_save_add_button_xpath} //*[@id='add-edit-btn'] ${project_tag_immutability_save_add_button_xpath} //*[@id='add-edit-btn']

View File

@ -1,63 +1,63 @@
*** Settings *** *** Settings ***
Documentation Harbor Webhooks Documentation Harbor Webhooks
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
*** Variables *** *** Variables ***
*** Keywords *** *** Keywords ***
Switch To Project Webhooks Switch To Project Webhooks
#Switch To Project Tab Overflow #Switch To Project Tab Overflow
Retry Element Click xpath=//project-detail//a[contains(.,'Webhooks')] Retry Element Click xpath=//project-detail//a[contains(.,'Webhooks')]
Sleep 1 Sleep 1
Create A New Webhook Create A New Webhook
[Arguments] ${webhook_name} ${webhook_endpoint_url} [Arguments] ${webhook_name} ${webhook_endpoint_url}
Retry Element Click ${new_webhook_button_xpath} Retry Element Click ${new_webhook_button_xpath}
Retry Text Input ${webhook_name_xpath} ${webhook_name} Retry Text Input ${webhook_name_xpath} ${webhook_name}
Retry Text Input ${webhook_endpoint_id_xpath} ${webhook_endpoint_url} Retry Text Input ${webhook_endpoint_id_xpath} ${webhook_endpoint_url}
Retry Double Keywords When Error Retry Element Click ${create_webhooks_continue_button_xpath} Retry Wait Until Page Not Contains Element ${create_webhooks_continue_button_xpath} Retry Double Keywords When Error Retry Element Click ${create_webhooks_continue_button_xpath} Retry Wait Until Page Not Contains Element ${create_webhooks_continue_button_xpath}
Retry Wait Until Page Contains ${webhook_name} Retry Wait Until Page Contains ${webhook_name}
Update A Webhook Update A Webhook
[Arguments] ${old_webhook_name} ${new_webhook_name} ${new_webhook_enpoint} [Arguments] ${old_webhook_name} ${new_webhook_name} ${new_webhook_enpoint}
# select one webhook # select one webhook
Retry Element Click xpath=//clr-dg-row[contains(.,'${old_webhook_name}')]//clr-checkbox-wrapper//label[contains(@class,'clr-control-label')] Retry Element Click xpath=//clr-dg-row[contains(.,'${old_webhook_name}')]//clr-checkbox-wrapper//label[contains(@class,'clr-control-label')]
Retry Element Click ${action_webhook_xpath} Retry Element Click ${action_webhook_xpath}
Retry Element Click ${action_webhook_edit_button} Retry Element Click ${action_webhook_edit_button}
#cancel1 #cancel1
Retry Double Keywords When Error Retry Element Click ${edit_webhooks_cancel_button_xpath} Retry Wait Until Page Not Contains Element ${edit_webhooks_cancel_button_xpath} Retry Double Keywords When Error Retry Element Click ${edit_webhooks_cancel_button_xpath} Retry Wait Until Page Not Contains Element ${edit_webhooks_cancel_button_xpath}
#confirm #confirm
Retry Element Click ${action_webhook_xpath} Retry Element Click ${action_webhook_xpath}
Retry Element Click ${action_webhook_edit_button} Retry Element Click ${action_webhook_edit_button}
Retry Text Input ${webhook_name_xpath} ${new_webhook_name} Retry Text Input ${webhook_name_xpath} ${new_webhook_name}
Retry Text Input ${webhook_endpoint_id_xpath} ${new_webhook_enpoint} Retry Text Input ${webhook_endpoint_id_xpath} ${new_webhook_enpoint}
Retry Double Keywords When Error Retry Element Click ${edit_webhooks_save_button_xpath} Retry Wait Until Page Not Contains Element ${edit_webhooks_save_button_xpath} Retry Double Keywords When Error Retry Element Click ${edit_webhooks_save_button_xpath} Retry Wait Until Page Not Contains Element ${edit_webhooks_save_button_xpath}
Retry Wait Until Page Contains ${new_webhook_name} Retry Wait Until Page Contains ${new_webhook_name}
Enable/Disable State of Same Webhook Enable/Disable State of Same Webhook
[Arguments] ${webhook_name} [Arguments] ${webhook_name}
Retry Element Click xpath=//clr-dg-row[contains(.,'${webhook_name}')]//clr-checkbox-wrapper//label[contains(@class,'clr-control-label')] Retry Element Click xpath=//clr-dg-row[contains(.,'${webhook_name}')]//clr-checkbox-wrapper//label[contains(@class,'clr-control-label')]
Retry Element Click ${action_webhook_xpath} Retry Element Click ${action_webhook_xpath}
Retry Element Click ${action_webhook_disable_or_enable_button} Retry Element Click ${action_webhook_disable_or_enable_button}
Retry Wait Until Page Contains Element ${dialog_disable_id_xpath} Retry Wait Until Page Contains Element ${dialog_disable_id_xpath}
Retry Element Click ${dialog_disable_id_xpath} Retry Element Click ${dialog_disable_id_xpath}
# contain disabled webhook # contain disabled webhook
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${webhook_name}')]//span[contains(.,'Disabled')] Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${webhook_name}')]//span[contains(.,'Disabled')]
Retry Element Click xpath=//clr-dg-row[contains(.,'${webhook_name}')]//clr-checkbox-wrapper//label[contains(@class,'clr-control-label')] Retry Element Click xpath=//clr-dg-row[contains(.,'${webhook_name}')]//clr-checkbox-wrapper//label[contains(@class,'clr-control-label')]
Retry Element Click ${action_webhook_xpath} Retry Element Click ${action_webhook_xpath}
Retry Element Click ${action_webhook_disable_or_enable_button} Retry Element Click ${action_webhook_disable_or_enable_button}
Retry Wait Until Page Contains Element ${dialog_enable_id_xpath} Retry Wait Until Page Contains Element ${dialog_enable_id_xpath}
Retry Element Click ${dialog_enable_id_xpath} Retry Element Click ${dialog_enable_id_xpath}
# not contain disabled webhook # not contain disabled webhook
Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'${webhook_name}')]//span[contains(.,'Disabled')] Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'${webhook_name}')]//span[contains(.,'Disabled')]
Delete A Webhook Delete A Webhook
[Arguments] ${webhook_name} [Arguments] ${webhook_name}
Retry Element Click xpath=//clr-dg-row[contains(.,'${webhook_name}')]//clr-checkbox-wrapper//label[contains(@class,'clr-control-label')] Retry Element Click xpath=//clr-dg-row[contains(.,'${webhook_name}')]//clr-checkbox-wrapper//label[contains(@class,'clr-control-label')]
Retry Element Click ${action_webhook_xpath} Retry Element Click ${action_webhook_xpath}
Retry Element Click ${action_webhook_delete_button} Retry Element Click ${action_webhook_delete_button}
Retry Wait Until Page Contains Element ${dialog_delete_button} Retry Wait Until Page Contains Element ${dialog_delete_button}
Retry Element Click ${dialog_delete_button} Retry Element Click ${dialog_delete_button}
Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'${webhook_name}')]//clr-checkbox-wrapper//label[contains(@class,'clr-control-label')] Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'${webhook_name}')]//clr-checkbox-wrapper//label[contains(@class,'clr-control-label')]

View File

@ -1,24 +1,24 @@
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
*** Variables *** *** Variables ***
${new_webhook_button_xpath} xpath=//*[@id='new-webhook'] ${new_webhook_button_xpath} xpath=//*[@id='new-webhook']
${webhook_name_xpath} xpath=//*[@id='name'] ${webhook_name_xpath} xpath=//*[@id='name']
${webhook_endpoint_id_xpath} xpath=//*[@id='edit_endpoint_url'] ${webhook_endpoint_id_xpath} xpath=//*[@id='edit_endpoint_url']
${webhook_auth_header_xpath} xpath=//*[@id='auth_header'] ${webhook_auth_header_xpath} xpath=//*[@id='auth_header']
${action_webhook_xpath} xpath=//*[@id='action-webhook'] ${action_webhook_xpath} xpath=//*[@id='action-webhook']
${action_webhook_edit_button} xpath=//*[@id='edit-webhook'] ${action_webhook_edit_button} xpath=//*[@id='edit-webhook']
${action_webhook_disable_or_enable_button} xpath=//*[@id='toggle-webhook'] ${action_webhook_disable_or_enable_button} xpath=//*[@id='toggle-webhook']
${action_webhook_delete_button} xpath=//*[@id='delete-webhook'] ${action_webhook_delete_button} xpath=//*[@id='delete-webhook']
${dialog_delete_button} xpath=//clr-modal//button[contains(.,'DELETE')] ${dialog_delete_button} xpath=//clr-modal//button[contains(.,'DELETE')]
${create_webhooks_continue_button_xpath} xpath=//*[@id='new-webhook-continue'] ${create_webhooks_continue_button_xpath} xpath=//*[@id='new-webhook-continue']
${edit_webhooks_cancel_button_xpath} xpath=//*[@id='edit-webhook-cancel'] ${edit_webhooks_cancel_button_xpath} xpath=//*[@id='edit-webhook-cancel']
${edit_webhooks_save_button_xpath} xpath=//*[@id='edit-webhook-save'] ${edit_webhooks_save_button_xpath} xpath=//*[@id='edit-webhook-save']
${edit_webhooks_verify_remote_cert_chkb_xpath} xpath=//input[@id='verify_remote_cert'] ${edit_webhooks_verify_remote_cert_chkb_xpath} xpath=//input[@id='verify_remote_cert']
${project_webhook_edit_id_xpath} xpath=//*[@id='edit-webhook'] ${project_webhook_edit_id_xpath} xpath=//*[@id='edit-webhook']
${project_webhook_enable_id_xpath} xpath=//*[@id='enable-webhook-action'] ${project_webhook_enable_id_xpath} xpath=//*[@id='enable-webhook-action']
${project_webhook_disable_id_xpath} xpath=//*[@id='disable-webhook-action'] ${project_webhook_disable_id_xpath} xpath=//*[@id='disable-webhook-action']
${dialog_disable_id_xpath} xpath=//*[@id='dialog-action-disable'] ${dialog_disable_id_xpath} xpath=//*[@id='dialog-action-disable']
${dialog_enable_id_xpath} xpath=//*[@id='dialog-action-enable'] ${dialog_enable_id_xpath} xpath=//*[@id='dialog-action-enable']

View File

@ -1,379 +1,379 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
*** Variables *** *** Variables ***
*** Keywords *** *** Keywords ***
Create An New Project And Go Into Project Create An New Project And Go Into Project
[Arguments] ${projectname} ${public}=false ${count_quota}=${null} ${storage_quota}=${null} ${storage_quota_unit}=${null} ${proxy_cache}=${false} ${registry}=${null} [Arguments] ${projectname} ${public}=false ${count_quota}=${null} ${storage_quota}=${null} ${storage_quota_unit}=${null} ${proxy_cache}=${false} ${registry}=${null}
Navigate To Projects Navigate To Projects
FOR ${n} IN RANGE 1 8 FOR ${n} IN RANGE 1 8
${out} Run Keyword And Ignore Error Retry Button Click xpath=${create_project_button_xpath} ${out} Run Keyword And Ignore Error Retry Button Click xpath=${create_project_button_xpath}
Log All Return value is ${out[0]} Log All Return value is ${out[0]}
Exit For Loop If '${out[0]}'=='PASS' Exit For Loop If '${out[0]}'=='PASS'
Sleep 1 Sleep 1
END END
Log To Console Project Name: ${projectname} Log To Console Project Name: ${projectname}
Retry Text Input xpath=${project_name_xpath} ${projectname} Retry Text Input xpath=${project_name_xpath} ${projectname}
${element_project_public}= Set Variable xpath=${project_public_xpath} ${element_project_public}= Set Variable xpath=${project_public_xpath}
Run Keyword If '${public}' == 'true' Run Keywords Wait Until Element Is Visible And Enabled ${element_project_public} AND Retry Element Click ${element_project_public} Run Keyword If '${public}' == 'true' Run Keywords Wait Until Element Is Visible And Enabled ${element_project_public} AND Retry Element Click ${element_project_public}
Run Keyword If '${count_quota}'!='${null}' Input Count Quota ${count_quota} Run Keyword If '${count_quota}'!='${null}' Input Count Quota ${count_quota}
Run Keyword If '${storage_quota}'!='${null}' Input Storage Quota ${storage_quota} ${storage_quota_unit} Run Keyword If '${storage_quota}'!='${null}' Input Storage Quota ${storage_quota} ${storage_quota_unit}
Run Keyword If '${proxy_cache}' == '${true}' Run Keywords Mouse Down ${project_proxy_cache_switcher_id} AND Mouse Up ${project_proxy_cache_switcher_id} AND Retry Element Click ${project_registry_select_id} AND Retry Element Click xpath=//select[@id='registry']//option[contains(.,'${registry}')] Run Keyword If '${proxy_cache}' == '${true}' Run Keywords Mouse Down ${project_proxy_cache_switcher_id} AND Mouse Up ${project_proxy_cache_switcher_id} AND Retry Element Click ${project_registry_select_id} AND Retry Element Click xpath=//select[@id='registry']//option[contains(.,'${registry}')]
Retry Double Keywords When Error Retry Element Click ${create_project_OK_button_xpath} Retry Wait Until Page Not Contains Element ${create_project_OK_button_xpath} Retry Double Keywords When Error Retry Element Click ${create_project_OK_button_xpath} Retry Wait Until Page Not Contains Element ${create_project_OK_button_xpath}
Sleep 2 Sleep 2
Go Into Project ${projectname} has_image=${false} Go Into Project ${projectname} has_image=${false}
Create An New Project With New User Create An New Project With New User
[Arguments] ${url} ${username} ${email} ${realname} ${newPassword} ${comment} ${projectname} ${public} [Arguments] ${url} ${username} ${email} ${realname} ${newPassword} ${comment} ${projectname} ${public}
Create An New User url=${url} username=${username} email=${email} realname=${realname} newPassword=${newPassword} comment=${comment} Create An New User url=${url} username=${username} email=${email} realname=${realname} newPassword=${newPassword} comment=${comment}
Logout Harbor Logout Harbor
Sign In Harbor ${url} ${username} ${newPassword} Sign In Harbor ${url} ${username} ${newPassword}
Create An New Project And Go Into Project ${projectname} ${public} Create An New Project And Go Into Project ${projectname} ${public}
Sleep 1 Sleep 1
Artifact Exist Artifact Exist
[Arguments] ${tag_name} [Arguments] ${tag_name}
Retry Wait Until Page Contains Element //artifact-list-tab//clr-datagrid//clr-dg-row[contains(.,'sha256') and contains(.,'${tag_name}')] Retry Wait Until Page Contains Element //artifact-list-tab//clr-datagrid//clr-dg-row[contains(.,'sha256') and contains(.,'${tag_name}')]
#It's the log of project. #It's the log of project.
Go To Project Log Go To Project Log
#Switch To Project Tab Overflow #Switch To Project Tab Overflow
Retry Element Click xpath=${project_log_xpath} Retry Element Click xpath=${project_log_xpath}
Sleep 2 Sleep 2
Switch To Member Switch To Member
Sleep 3 Sleep 3
Retry Element Click xpath=${project_member_xpath} Retry Element Click xpath=${project_member_xpath}
Sleep 1 Sleep 1
Switch To Log Switch To Log
Retry Element Click xpath=${log_xpath} Retry Element Click xpath=${log_xpath}
Sleep 1 Sleep 1
Switch To Replication Switch To Replication
Retry Element Click xpath=${project_replication_xpath} Retry Element Click xpath=${project_replication_xpath}
Sleep 1 Sleep 1
Switch To Project Configuration Switch To Project Configuration
Retry Element Click ${project_config_tabsheet} Retry Element Click ${project_config_tabsheet}
Sleep 1 Sleep 1
Switch To Tag Retention Switch To Tag Retention
#Switch To Project Tab Overflow #Switch To Project Tab Overflow
Retry Element Click xpath=${project_tag_strategy_xpath} Retry Element Click xpath=${project_tag_strategy_xpath}
Sleep 1 Sleep 1
Switch To Tag Immutability Switch To Tag Immutability
#Switch To Project Tab Overflow #Switch To Project Tab Overflow
Retry Double Keywords When Error Retry Element Click xpath=${project_tag_strategy_xpath} Retry Wait Until Page Contains Element ${project_tag_immutability_switch} Retry Double Keywords When Error Retry Element Click xpath=${project_tag_strategy_xpath} Retry Wait Until Page Contains Element ${project_tag_immutability_switch}
Retry Double Keywords When Error Retry Element Click xpath=${project_tag_immutability_switch} Retry Wait Until Page Contains Immutability rules Retry Double Keywords When Error Retry Element Click xpath=${project_tag_immutability_switch} Retry Wait Until Page Contains Immutability rules
Sleep 1 Sleep 1
Switch To Project Tab Overflow Switch To Project Tab Overflow
Retry Element Click xpath=${project_tab_overflow_btn} Retry Element Click xpath=${project_tab_overflow_btn}
Sleep 1 Sleep 1
Navigate To Projects Navigate To Projects
Reload Page Reload Page
Sleep 3 Sleep 3
Retry Element Click xpath=${projects_xpath} Retry Element Click xpath=${projects_xpath}
Sleep 1 Sleep 1
Project Should Display Project Should Display
[Arguments] ${projectname} [Arguments] ${projectname}
Retry Wait Element xpath=//projects//list-project//clr-dg-cell/a[contains(.,'${projectname}')] Retry Wait Element xpath=//projects//list-project//clr-dg-cell/a[contains(.,'${projectname}')]
Project Should Not Display Project Should Not Display
[Arguments] ${projectname} [Arguments] ${projectname}
Retry Wait Until Page Not Contains Element xpath=//projects//list-project//clr-dg-cell/a[contains(.,'${projectname}')] Retry Wait Until Page Not Contains Element xpath=//projects//list-project//clr-dg-cell/a[contains(.,'${projectname}')]
Search Private Projects Search Private Projects
Retry Element Click xpath=//select Retry Element Click xpath=//select
Retry Element Click xpath=//select/option[@value=1] Retry Element Click xpath=//select/option[@value=1]
Sleep 1 Sleep 1
Make Project Private Make Project Private
[Arguments] ${projectname} [Arguments] ${projectname}
Go Into Project ${project name} Go Into Project ${project name}
Switch To Project Configuration Switch To Project Configuration
Retry Checkbox Should Be Selected ${project_config_public_checkbox} Retry Checkbox Should Be Selected ${project_config_public_checkbox}
Retry Double Keywords When Error Retry Element Click ${project_config_public_checkbox_label} Retry Checkbox Should Not Be Selected ${project_config_public_checkbox} Retry Double Keywords When Error Retry Element Click ${project_config_public_checkbox_label} Retry Checkbox Should Not Be Selected ${project_config_public_checkbox}
Retry Element Click //button[contains(.,'SAVE')] Retry Element Click //button[contains(.,'SAVE')]
Go Into Project ${project name} Go Into Project ${project name}
Switch To Project Configuration Switch To Project Configuration
Retry Checkbox Should Not Be Selected ${project_config_public_checkbox} Retry Checkbox Should Not Be Selected ${project_config_public_checkbox}
Make Project Public Make Project Public
[Arguments] ${projectname} [Arguments] ${projectname}
Go Into Project ${project name} Go Into Project ${project name}
Switch To Project Configuration Switch To Project Configuration
Retry Checkbox Should Not Be Selected ${project_config_public_checkbox} Retry Checkbox Should Not Be Selected ${project_config_public_checkbox}
Retry Double Keywords When Error Retry Element Click ${project_config_public_checkbox_label} Retry Checkbox Should Be Selected ${project_config_public_checkbox} Retry Double Keywords When Error Retry Element Click ${project_config_public_checkbox_label} Retry Checkbox Should Be Selected ${project_config_public_checkbox}
Retry Element Click //button[contains(.,'SAVE')] Retry Element Click //button[contains(.,'SAVE')]
Go Into Project ${project name} Go Into Project ${project name}
Switch To Project Configuration Switch To Project Configuration
Retry Checkbox Should Be Selected ${project_config_public_checkbox} Retry Checkbox Should Be Selected ${project_config_public_checkbox}
Repo Exist Repo Exist
[Arguments] ${pro_name} ${repo_name} [Arguments] ${pro_name} ${repo_name}
Retry Wait Until Page Contains Element //clr-dg-row[contains(.,'${pro_name}/${repo_name}')] Retry Wait Until Page Contains Element //clr-dg-row[contains(.,'${pro_name}/${repo_name}')]
Repo Not Exist Repo Not Exist
[Arguments] ${pro_name} ${repo_name} [Arguments] ${pro_name} ${repo_name}
Retry Wait Until Page Not Contains Element //clr-dg-row[contains(.,'${pro_name}/${repo_name}')] Retry Wait Until Page Not Contains Element //clr-dg-row[contains(.,'${pro_name}/${repo_name}')]
Filter Repo Filter Repo
[Arguments] ${pro_name} ${repo_name} ${exsit}=${true} [Arguments] ${pro_name} ${repo_name} ${exsit}=${true}
Retry Double Keywords When Error Retry Element Click ${filter_dist_btn} Wait Until Element Is Visible And Enabled ${filter_dist_input} Retry Double Keywords When Error Retry Element Click ${filter_dist_btn} Wait Until Element Is Visible And Enabled ${filter_dist_input}
Retry Clear Element Text ${filter_dist_input} Retry Clear Element Text ${filter_dist_input}
Retry Text Input ${filter_dist_input} ${pro_name}/${repo_name} Retry Text Input ${filter_dist_input} ${pro_name}/${repo_name}
Run Keyword If ${exsit}==${true} Repo Exist ${pro_name} ${repo_name} Run Keyword If ${exsit}==${true} Repo Exist ${pro_name} ${repo_name}
... ELSE Repo Not Exist ${pro_name} ${repo_name} ... ELSE Repo Not Exist ${pro_name} ${repo_name}
Delete Repo Delete Repo
[Arguments] ${pro_name} ${repo_name} [Arguments] ${pro_name} ${repo_name}
${element_repo_checkbox}= Set Variable xpath=//clr-dg-row[contains(.,'${pro_name}/${repo_name}')]//clr-checkbox-wrapper//label ${element_repo_checkbox}= Set Variable xpath=//clr-dg-row[contains(.,'${pro_name}/${repo_name}')]//clr-checkbox-wrapper//label
Filter Repo ${pro_name} ${repo_name} Filter Repo ${pro_name} ${repo_name}
Retry Double Keywords When Error Retry Element Click ${element_repo_checkbox} Wait Until Element Is Visible And Enabled ${repo_delete_btn} Retry Double Keywords When Error Retry Element Click ${element_repo_checkbox} Wait Until Element Is Visible And Enabled ${repo_delete_btn}
Retry Double Keywords When Error Retry Element Click ${repo_delete_btn} Wait Until Element Is Visible And Enabled ${delete_confirm_btn} Retry Double Keywords When Error Retry Element Click ${repo_delete_btn} Wait Until Element Is Visible And Enabled ${delete_confirm_btn}
Retry Double Keywords When Error Retry Element Click ${delete_confirm_btn} Retry Wait Until Page Not Contains Element ${delete_confirm_btn} Retry Double Keywords When Error Retry Element Click ${delete_confirm_btn} Retry Wait Until Page Not Contains Element ${delete_confirm_btn}
Retry Wait Until Page Not Contains Element ${element_repo_checkbox} Retry Wait Until Page Not Contains Element ${element_repo_checkbox}
Filter Repo ${pro_name} ${repo_name} exsit=${false} Filter Repo ${pro_name} ${repo_name} exsit=${false}
Delete Repo on CardView Delete Repo on CardView
[Arguments] ${reponame} [Arguments] ${reponame}
Retry Element Click //hbr-gridview//span[contains(.,'${reponame}')]//clr-dropdown/button Retry Element Click //hbr-gridview//span[contains(.,'${reponame}')]//clr-dropdown/button
Retry Element Click //hbr-gridview//span[contains(.,'${reponame}')]//clr-dropdown/clr-dropdown-menu/button[contains(.,'Delete')] Retry Element Click //hbr-gridview//span[contains(.,'${reponame}')]//clr-dropdown/clr-dropdown-menu/button[contains(.,'Delete')]
Retry Element Click ${repo_delete_on_card_view_btn} Retry Element Click ${repo_delete_on_card_view_btn}
Sleep 2 Sleep 2
Delete Project Delete Project
[Arguments] ${projectname} [Arguments] ${projectname}
Navigate To Projects Navigate To Projects
Retry Element Click xpath=//clr-dg-row[contains(.,'${projectname}')]//clr-checkbox-wrapper//label Retry Element Click xpath=//clr-dg-row[contains(.,'${projectname}')]//clr-checkbox-wrapper//label
Retry Element Click xpath=//*[@id='delete-project'] Retry Element Click xpath=//*[@id='delete-project']
Retry Element Click //clr-modal//button[contains(.,'DELETE')] Retry Element Click //clr-modal//button[contains(.,'DELETE')]
Sleep 1 Sleep 1
Project Should Not Be Deleted Project Should Not Be Deleted
[Arguments] ${projname} [Arguments] ${projname}
Delete Project ${projname} Delete Project ${projname}
Retry Wait Until Page Contains Element //*[@id='contentAll']//div[contains(.,'${projname}')]/../div/clr-icon[@shape='error-standard'] Retry Wait Until Page Contains Element //*[@id='contentAll']//div[contains(.,'${projname}')]/../div/clr-icon[@shape='error-standard']
Project Should Be Deleted Project Should Be Deleted
[Arguments] ${projname} [Arguments] ${projname}
Delete Project ${projname} Delete Project ${projname}
Retry Wait Until Page Contains Element //*[@id='contentAll']//div[contains(.,'${projname}')]/../div/clr-icon[@shape='success-standard'] Retry Wait Until Page Contains Element //*[@id='contentAll']//div[contains(.,'${projname}')]/../div/clr-icon[@shape='success-standard']
Advanced Search Should Display Advanced Search Should Display
Retry Wait Until Page Contains Element xpath=//audit-log//div[@class='flex-xs-middle']/button Retry Wait Until Page Contains Element xpath=//audit-log//div[@class='flex-xs-middle']/button
# it's not a common keywords, only used into log case. # it's not a common keywords, only used into log case.
Do Log Advanced Search Do Log Advanced Search
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'artifact') and contains(.,'pull')] Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'artifact') and contains(.,'pull')]
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'artifact') and contains(.,'create')] Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'artifact') and contains(.,'create')]
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'artifact') and contains(.,'delete')] Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'artifact') and contains(.,'delete')]
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'project') and contains(.,'create')] Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'project') and contains(.,'create')]
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'repository') and contains(.,'delete')] Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'repository') and contains(.,'delete')]
Retry Element Click xpath=//audit-log//div[@class='flex-xs-middle']/button Retry Element Click xpath=//audit-log//div[@class='flex-xs-middle']/button
Retry Element Click xpath=//project-detail//audit-log//clr-dropdown/button Retry Element Click xpath=//project-detail//audit-log//clr-dropdown/button
#pull log #pull log
Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Pull')] Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Pull')]
Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'pull')] Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'pull')]
#push log #push log
Retry Element Click xpath=//audit-log//clr-dropdown/button Retry Element Click xpath=//audit-log//clr-dropdown/button
Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Push')] Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Push')]
Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'push')] Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'push')]
#create log #create log
Retry Element Click xpath=//audit-log//clr-dropdown/button Retry Element Click xpath=//audit-log//clr-dropdown/button
Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Create')] Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Create')]
Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'create')] Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'create')]
#delete log #delete log
Retry Element Click xpath=//audit-log//clr-dropdown/button Retry Element Click xpath=//audit-log//clr-dropdown/button
Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Delete')] Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Delete')]
Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'delete')] Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'delete')]
#others #others
Retry Element Click xpath=//audit-log//clr-dropdown/button Retry Element Click xpath=//audit-log//clr-dropdown/button
Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Others')] Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Others')]
Retry Element Click xpath=//audit-log//hbr-filter//clr-icon Retry Element Click xpath=//audit-log//hbr-filter//clr-icon
Retry Text Input xpath=//audit-log//hbr-filter//input harbor-jobservice Retry Text Input xpath=//audit-log//hbr-filter//input harbor-jobservice
Sleep 1 Sleep 1
${rc} = Get Element Count //audit-log//clr-dg-row ${rc} = Get Element Count //audit-log//clr-dg-row
Should Be Equal As Integers ${rc} 1 Should Be Equal As Integers ${rc} 1
Retry Click Repo Name Retry Click Repo Name
[Arguments] ${repo_name_element} [Arguments] ${repo_name_element}
FOR ${n} IN RANGE 1 2 FOR ${n} IN RANGE 1 2
${out} Run Keyword And Ignore Error Retry Double Keywords When Error Retry Element Click ${repo_name_element} Retry Wait Element ${tag_table_column_vulnerabilities} ${out} Run Keyword And Ignore Error Retry Double Keywords When Error Retry Element Click ${repo_name_element} Retry Wait Element ${tag_table_column_vulnerabilities}
Exit For Loop If '${out[0]}'=='PASS' Exit For Loop If '${out[0]}'=='PASS'
END END
Should Be Equal As Strings '${out[0]}' 'PASS' Should Be Equal As Strings '${out[0]}' 'PASS'
FOR ${n} IN RANGE 1 2 FOR ${n} IN RANGE 1 2
${out} Run Keyword And Ignore Error Retry Wait Until Page Not Contains Element ${repo_list_spinner} ${out} Run Keyword And Ignore Error Retry Wait Until Page Not Contains Element ${repo_list_spinner}
Exit For Loop If '${out[0]}'=='PASS' Exit For Loop If '${out[0]}'=='PASS'
END END
Should Be Equal As Strings '${out[0]}' 'PASS' Should Be Equal As Strings '${out[0]}' 'PASS'
Go Into Repo Go Into Repo
[Arguments] ${repoName} [Arguments] ${repoName}
Sleep 2 Sleep 2
Retry Wait Until Page Not Contains Element ${repo_list_spinner} Retry Wait Until Page Not Contains Element ${repo_list_spinner}
${repo_name_element}= Set Variable xpath=//clr-dg-cell[contains(.,'${repoName}')]/a ${repo_name_element}= Set Variable xpath=//clr-dg-cell[contains(.,'${repoName}')]/a
FOR ${n} IN RANGE 1 3 FOR ${n} IN RANGE 1 3
Retry Element Click ${repo_search_icon} Retry Element Click ${repo_search_icon}
Retry Clear Element Text ${repo_search_input} Retry Clear Element Text ${repo_search_input}
Retry Text Input ${repo_search_input} ${repoName} Retry Text Input ${repo_search_input} ${repoName}
${out} Run Keyword And Ignore Error Retry Wait Until Page Contains Element ${repo_name_element} ${out} Run Keyword And Ignore Error Retry Wait Until Page Contains Element ${repo_name_element}
Sleep 2 Sleep 2
Run Keyword If '${out[0]}'=='FAIL' Reload Page Run Keyword If '${out[0]}'=='FAIL' Reload Page
Continue For Loop If '${out[0]}'=='FAIL' Continue For Loop If '${out[0]}'=='FAIL'
Retry Click Repo Name ${repo_name_element} Retry Click Repo Name ${repo_name_element}
Sleep 2 Sleep 2
Exit For Loop Exit For Loop
END END
Should Be Equal As Strings '${out[0]}' 'PASS' Should Be Equal As Strings '${out[0]}' 'PASS'
Click Index Achieve Click Index Achieve
[Arguments] ${tag_name} [Arguments] ${tag_name}
Retry Element Click //artifact-list-tab//clr-datagrid//clr-dg-row[contains(.,'sha256') and contains(.,'${tag_name}')]//clr-dg-cell[1]//clr-tooltip//a Retry Element Click //artifact-list-tab//clr-datagrid//clr-dg-row[contains(.,'sha256') and contains(.,'${tag_name}')]//clr-dg-cell[1]//clr-tooltip//a
Go Into Index And Contain Artifacts Go Into Index And Contain Artifacts
[Arguments] ${tag_name} ${total_artifact_count}=3 ${archive_count}=0 [Arguments] ${tag_name} ${total_artifact_count}=3 ${archive_count}=0
Retry Double Keywords When Error Click Index Achieve ${tag_name} Page Should Contain Element ${tag_table_column_os_arch} Retry Double Keywords When Error Click Index Achieve ${tag_name} Page Should Contain Element ${tag_table_column_os_arch}
FOR ${n} IN RANGE 1 10 FOR ${n} IN RANGE 1 10
${out1} Run Keyword And Ignore Error Page Should Contain Element ${artifact_rows} limit=${total_artifact_count} ${out1} Run Keyword And Ignore Error Page Should Contain Element ${artifact_rows} limit=${total_artifact_count}
${out2} Run Keyword And Ignore Error Page Should Contain Element ${archive_rows} limit=${archive_count} ${out2} Run Keyword And Ignore Error Page Should Contain Element ${archive_rows} limit=${archive_count}
Exit For Loop If '${out1[0]}'=='PASS' and '${out2[0]}'=='PASS' Exit For Loop If '${out1[0]}'=='PASS' and '${out2[0]}'=='PASS'
Sleep 3 Sleep 3
END END
Run Keyword If '${out1[0]}'=='FAIL' or '${out2[0]}'=='FAIL' Capture Page Screenshot Run Keyword If '${out1[0]}'=='FAIL' or '${out2[0]}'=='FAIL' Capture Page Screenshot
Should Be Equal As Strings '${out1[0]}' 'PASS' Should Be Equal As Strings '${out1[0]}' 'PASS'
Should Be Equal As Strings '${out2[0]}' 'PASS' Should Be Equal As Strings '${out2[0]}' 'PASS'
Switch To CardView Switch To CardView
Retry Element Click xpath=//hbr-repository-gridview//span[@class='card-btn']/clr-icon Retry Element Click xpath=//hbr-repository-gridview//span[@class='card-btn']/clr-icon
Sleep 5 Sleep 5
Expand Repo Expand Repo
[Arguments] ${projectname} [Arguments] ${projectname}
Retry Element Click //repository//clr-dg-row[contains(.,'${projectname}')]//button/clr-icon Retry Element Click //repository//clr-dg-row[contains(.,'${projectname}')]//button/clr-icon
Sleep 1 Sleep 1
Edit Repo Info Edit Repo Info
Retry Element Click //*[@id='repo-info'] Retry Element Click //*[@id='repo-info']
Retry Wait Until Page Contains Element //*[@id='info']/form/div[2] Retry Wait Until Page Contains Element //*[@id='info']/form/div[2]
# Cancel input # Cancel input
Retry Element Click xpath=//*[@id='info-edit-button']/button Retry Element Click xpath=//*[@id='info-edit-button']/button
Input Text xpath=//*[@id='info-edit-textarea'] test_description_info Input Text xpath=//*[@id='info-edit-textarea'] test_description_info
Retry Element Click xpath=//*[@id='edit-cancel'] Retry Element Click xpath=//*[@id='edit-cancel']
Retry Element Click xpath=//clr-modal//button[contains(.,'CONFIRM')] Retry Element Click xpath=//clr-modal//button[contains(.,'CONFIRM')]
Retry Wait Until Page Contains Element //*[@id='no-editing'] Retry Wait Until Page Contains Element //*[@id='no-editing']
# Confirm input # Confirm input
Retry Element Click xpath=//*[@id='info-edit-button']/button Retry Element Click xpath=//*[@id='info-edit-button']/button
Input Text xpath=//*[@id='info-edit-textarea'] test_description_info Input Text xpath=//*[@id='info-edit-textarea'] test_description_info
Retry Element Click xpath=//*[@id='edit-save'] Retry Element Click xpath=//*[@id='edit-save']
Retry Wait Until Page Contains test_description_info Retry Wait Until Page Contains test_description_info
Switch To Project Label Switch To Project Label
Retry Element Click xpath=//project-detail//a[contains(.,'Labels')] Retry Element Click xpath=//project-detail//a[contains(.,'Labels')]
Sleep 1 Sleep 1
Switch To Project Repo Switch To Project Repo
Retry Element Click xpath=//project-detail//a[contains(.,'Repositories')] Retry Element Click xpath=//project-detail//a[contains(.,'Repositories')]
Sleep 1 Sleep 1
Add Labels To Tag Add Labels To Tag
[Arguments] ${tagName} ${labelName} [Arguments] ${tagName} ${labelName}
Retry Element Click xpath=//clr-dg-row[contains(.,'${tagName}')]//label Retry Element Click xpath=//clr-dg-row[contains(.,'${tagName}')]//label
Retry Element Click xpath=//clr-dg-action-bar//clr-dropdown//span Retry Element Click xpath=//clr-dg-action-bar//clr-dropdown//span
Retry Element Click xpath=//clr-dropdown-menu//clr-dropdown//button[contains(.,'Add Labels')] Retry Element Click xpath=//clr-dropdown-menu//clr-dropdown//button[contains(.,'Add Labels')]
Retry Element Click xpath=//clr-dropdown//div//label[contains(.,'${labelName}')] Retry Element Click xpath=//clr-dropdown//div//label[contains(.,'${labelName}')]
Retry Wait Until Page Contains Element xpath=//clr-dg-row//label[contains(.,'${labelName}')] Retry Wait Until Page Contains Element xpath=//clr-dg-row//label[contains(.,'${labelName}')]
Filter Labels In Tags Filter Labels In Tags
[Arguments] ${labelName1} ${labelName2} [Arguments] ${labelName1} ${labelName2}
Retry Element Click xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon Retry Element Click xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon
Retry Element Click xpath=//clr-main-container//artifact-list-tab//clr-select-container//select Retry Element Click xpath=//clr-main-container//artifact-list-tab//clr-select-container//select
Retry Element Click xpath=//clr-main-container//artifact-list-tab//clr-select-container//select/option[@value='labels'] Retry Element Click xpath=//clr-main-container//artifact-list-tab//clr-select-container//select/option[@value='labels']
Retry Wait Until Page Contains Element xpath=//*[@id='filterArea']//div//button[contains(.,'${labelName1}')] Retry Wait Until Page Contains Element xpath=//*[@id='filterArea']//div//button[contains(.,'${labelName1}')]
Retry Element Click xpath=//*[@id='filterArea']//div//button[contains(.,'${labelName1}')] Retry Element Click xpath=//*[@id='filterArea']//div//button[contains(.,'${labelName1}')]
Retry Element Click xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon Retry Element Click xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon
Retry Wait Until Page Contains Element xpath=//clr-datagrid//label[contains(.,'${labelName1}')] Retry Wait Until Page Contains Element xpath=//clr-datagrid//label[contains(.,'${labelName1}')]
Retry Element Click xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon Retry Element Click xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon
Retry Element Click xpath=//*[@id='filterArea']//div//button[contains(.,'${labelName2}')] Retry Element Click xpath=//*[@id='filterArea']//div//button[contains(.,'${labelName2}')]
Retry Element Click xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon Retry Element Click xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon
Sleep 2 Sleep 2
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${labelName2}')] Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${labelName2}')]
Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'${labelName1}')] Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'${labelName1}')]
Get Statics Get Statics
[Arguments] ${locator} [Arguments] ${locator}
Reload Page Reload Page
Sleep 5 Sleep 5
${privaterepo}= Get Text ${locator} ${privaterepo}= Get Text ${locator}
[Return] ${privaterepo} [Return] ${privaterepo}
Retry Get Statics Retry Get Statics
[Arguments] ${locator} [Arguments] ${locator}
@{param} Create List ${locator} @{param} Create List ${locator}
${ret}= Retry Keyword N Times When Error 5 Get Statics @{param} ${ret}= Retry Keyword N Times When Error 5 Get Statics @{param}
[Return] ${ret} [Return] ${ret}
Get Statics Private Repo Get Statics Private Repo
${privaterepo}= Retry Get Statics //projects/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[2]/div[2]/statistics/div/span[1] ${privaterepo}= Retry Get Statics //projects/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[2]/div[2]/statistics/div/span[1]
[Return] ${privaterepo} [Return] ${privaterepo}
Get Statics Private Project Get Statics Private Project
${privateproj}= Retry Get Statics //projects/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[2]/div[1]/statistics/div/span[1] ${privateproj}= Retry Get Statics //projects/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[2]/div[1]/statistics/div/span[1]
[Return] ${privateproj} [Return] ${privateproj}
Get Statics Public Repo Get Statics Public Repo
${publicrepo}= Retry Get Statics //projects/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[3]/div[2]/statistics/div/span[1] ${publicrepo}= Retry Get Statics //projects/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[3]/div[2]/statistics/div/span[1]
[Return] ${publicrepo} [Return] ${publicrepo}
Get Statics Public Project Get Statics Public Project
${publicproj}= Retry Get Statics //projects/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[3]/div[1]/statistics/div/span[1] ${publicproj}= Retry Get Statics //projects/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[3]/div[1]/statistics/div/span[1]
[Return] ${publicproj} [Return] ${publicproj}
Get Statics Total Repo Get Statics Total Repo
${totalrepo}= Retry Get Statics //projects/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[4]/div[2]/statistics/div/span[1] ${totalrepo}= Retry Get Statics //projects/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[4]/div[2]/statistics/div/span[1]
[Return] ${totalrepo} [Return] ${totalrepo}
Get Statics Total Project Get Statics Total Project
${totalproj}= Retry Get Statics //projects/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[4]/div[1]/statistics/div/span[1] ${totalproj}= Retry Get Statics //projects/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[4]/div[1]/statistics/div/span[1]
[Return] ${totalproj} [Return] ${totalproj}
Input Count Quota Input Count Quota
[Arguments] ${text} [Arguments] ${text}
${element_xpath}= Set Variable ${project_add_count_quota_input_text_id} ${element_xpath}= Set Variable ${project_add_count_quota_input_text_id}
Retry Clear Element Text ${element_xpath} Retry Clear Element Text ${element_xpath}
Retry Text Input ${element_xpath} ${text} Retry Text Input ${element_xpath} ${text}
Input Storage Quota Input Storage Quota
[Arguments] ${text} ${unit}=${null} [Arguments] ${text} ${unit}=${null}
${element_xpath}= Set Variable ${project_add_storage_quota_input_text_id} ${element_xpath}= Set Variable ${project_add_storage_quota_input_text_id}
Retry Clear Element Text ${element_xpath} Retry Clear Element Text ${element_xpath}
Retry Text Input ${element_xpath} ${text} Retry Text Input ${element_xpath} ${text}
Run Keyword If '${unit}'!='${null}' Select Storage Quota unit ${unit} Run Keyword If '${unit}'!='${null}' Select Storage Quota unit ${unit}
Select Storage Quota unit Select Storage Quota unit
[Arguments] ${unit} [Arguments] ${unit}
Select From List By Value ${project_add_storage_quota_unit_id} ${unit} Select From List By Value ${project_add_storage_quota_unit_id} ${unit}

View File

@ -1,81 +1,81 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
*** Variables *** *** Variables ***
${create_project_button_xpath} //clr-main-container//button[contains(., 'New Project')] ${create_project_button_xpath} //clr-main-container//button[contains(., 'New Project')]
${project_name_xpath} //*[@id='create_project_name'] ${project_name_xpath} //*[@id='create_project_name']
${project_public_xpath} //input[@name='public']/..//label ${project_public_xpath} //input[@name='public']/..//label
${project_save_css} html body.no-scrolling harbor-app harbor-shell clr-main-container.main-container div.content-container div.content-area.content-area-override project div.row div.col-lg-12.col-md-12.col-sm-12.col-xs-12 div.row.flex-items-xs-between div.option-left create-project clr-modal div.modal div.modal-dialog div.modal-content div.modal-footer button.btn.btn-primary ${project_save_css} html body.no-scrolling harbor-app harbor-shell clr-main-container.main-container div.content-container div.content-area.content-area-override project div.row div.col-lg-12.col-md-12.col-sm-12.col-xs-12 div.row.flex-items-xs-between div.option-left create-project clr-modal div.modal div.modal-dialog div.modal-content div.modal-footer button.btn.btn-primary
${log_xpath} //clr-main-container//clr-vertical-nav//a[contains(.,'Logs')] ${log_xpath} //clr-main-container//clr-vertical-nav//a[contains(.,'Logs')]
${projects_xpath} //clr-main-container//clr-vertical-nav//a[contains(.,'Projects')] ${projects_xpath} //clr-main-container//clr-vertical-nav//a[contains(.,'Projects')]
${project_replication_xpath} //project-detail//a[contains(.,'Replication')] ${project_replication_xpath} //project-detail//a[contains(.,'Replication')]
${project_log_xpath} //project-detail//a[contains(.,'Logs')] ${project_log_xpath} //project-detail//a[contains(.,'Logs')]
${project_member_xpath} //project-detail//a[contains(.,'Members')] ${project_member_xpath} //project-detail//a[contains(.,'Members')]
${project_config_tabsheet} xpath=//project-detail//a[contains(.,'Configuration')] ${project_config_tabsheet} xpath=//project-detail//a[contains(.,'Configuration')]
${project_tag_strategy_xpath} //clr-tabs//a[contains(.,'Policy')] ${project_tag_strategy_xpath} //clr-tabs//a[contains(.,'Policy')]
${project_tab_overflow_btn} //clr-tabs//li//button[contains(@class,"dropdown-toggle")] ${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/a[contains(.,'Tag Immutability')]
${create_project_CANCEL_button_xpath} xpath=//button[contains(.,'CANCEL')] ${create_project_CANCEL_button_xpath} xpath=//button[contains(.,'CANCEL')]
${create_project_OK_button_xpath} xpath=//button[contains(.,'OK')] ${create_project_OK_button_xpath} xpath=//button[contains(.,'OK')]
${delete_confirm_btn} xpath=//button[contains(.,'DELETE')] ${delete_confirm_btn} xpath=//button[contains(.,'DELETE')]
${project_statistics_private_repository_icon} xpath=//projects/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[2]/div[2]/statistics/div/span[1] ${project_statistics_private_repository_icon} xpath=//projects/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[2]/div[2]/statistics/div/span[1]
${project_statistics_total_projects_icon} xpath=//div[contains(@class, 'statistic-column-block') and contains(., 'TOTAL')]//div[1]/statistics//span[contains(@class, 'statistic-data')] ${project_statistics_total_projects_icon} xpath=//div[contains(@class, 'statistic-column-block') and contains(., 'TOTAL')]//div[1]/statistics//span[contains(@class, 'statistic-data')]
${repo_delete_confirm_btn} xpath=//clr-modal//button[2] ${repo_delete_confirm_btn} xpath=//clr-modal//button[2]
${repo_retag_confirm_dlg} css=${modal-dialog} ${repo_retag_confirm_dlg} css=${modal-dialog}
${repo_delete_on_card_view_btn} //clr-modal//button[contains(.,'DELETE')] ${repo_delete_on_card_view_btn} //clr-modal//button[contains(.,'DELETE')]
${delete_btn} //button[contains(.,'Delete')] ${delete_btn} //button[contains(.,'Delete')]
${repo_delete_btn} xpath=//hbr-repository-gridview//button[contains(.,'Delete')] ${repo_delete_btn} xpath=//hbr-repository-gridview//button[contains(.,'Delete')]
${project_delete_btn} xpath=//button[@id='delete-project'] ${project_delete_btn} xpath=//button[@id='delete-project']
${tag_delete_btn} xpath=//tag-repository//clr-datagrid//button[contains(.,'Delete')] ${tag_delete_btn} xpath=//tag-repository//clr-datagrid//button[contains(.,'Delete')]
${user_delete_btn} xpath=/clr-dropdown-menu//button[contains(.,'Delete')] ${user_delete_btn} xpath=/clr-dropdown-menu//button[contains(.,'Delete')]
${repo_search_icon} xpath=//hbr-filter//clr-icon ${repo_search_icon} xpath=//hbr-filter//clr-icon
${repo_search_input} xpath=//hbr-filter//input ${repo_search_input} xpath=//hbr-filter//input
${repo_list_spinner} xpath=//clr-datagrid//clr-spinner ${repo_list_spinner} xpath=//clr-datagrid//clr-spinner
#${repo_search_icon} xpath=//hbr-repository-gridview//clr-datagrid//clr-dg-column[contains(.,'Name')]//clr-dg-string-filter//button//clr-icon #${repo_search_icon} xpath=//hbr-repository-gridview//clr-datagrid//clr-dg-column[contains(.,'Name')]//clr-dg-string-filter//button//clr-icon
#${repo_search_input} xpath=//div[@class[contains(.,'datagrid-filter')]]//input #${repo_search_input} xpath=//div[@class[contains(.,'datagrid-filter')]]//input
${repo_tag_1st_checkbox} xpath=//clr-datagrid//clr-dg-row//clr-checkbox-wrapper ${repo_tag_1st_checkbox} xpath=//clr-datagrid//clr-dg-row//clr-checkbox-wrapper
${tag_table_column_pull_command} xpath=//clr-dg-column//span[contains(.,'Pull Command')] ${tag_table_column_pull_command} xpath=//clr-dg-column//span[contains(.,'Pull Command')]
${tag_table_column_vulnerabilities} xpath=//clr-dg-column//span[contains(.,'Vulnerabilities')] ${tag_table_column_vulnerabilities} xpath=//clr-dg-column//span[contains(.,'Vulnerabilities')]
${tag_table_column_os_arch} xpath=//clr-dg-column//span[contains(.,'OS/ARCH')] ${tag_table_column_os_arch} xpath=//clr-dg-column//span[contains(.,'OS/ARCH')]
${tag_table_column_tag} xpath=//clr-dg-column//span[contains(.,'Tag')] ${tag_table_column_tag} xpath=//clr-dg-column//span[contains(.,'Tag')]
${tag_table_column_size} xpath=//clr-dg-column//span[contains(.,'Size')] ${tag_table_column_size} xpath=//clr-dg-column//span[contains(.,'Size')]
${tag_table_column_vulnerability} xpath=//clr-dg-column//span[contains(.,'Vulnerability')] ${tag_table_column_vulnerability} xpath=//clr-dg-column//span[contains(.,'Vulnerability')]
${tag_images_btn} xpath=//hbr-repository//button[contains(.,'Images')] ${tag_images_btn} xpath=//hbr-repository//button[contains(.,'Images')]
${project_member_action_xpath} xpath=//*[@id='member-action'] ${project_member_action_xpath} xpath=//*[@id='member-action']
${project_member_set_role_xpath} xpath=//clr-dropdown-menu//label[contains(.,'Set Role')] ${project_member_set_role_xpath} xpath=//clr-dropdown-menu//label[contains(.,'Set Role')]
${project_config_public_checkbox} xpath=//input[@name='public'] ${project_config_public_checkbox} xpath=//input[@name='public']
${project_config_content_trust_checkbox} xpath=//input[@name='content-trust'] ${project_config_content_trust_checkbox} xpath=//input[@name='content-trust']
${project_config_scan_images_on_push_checkbox} xpath=//input[@name='scan-image-on-push'] ${project_config_scan_images_on_push_checkbox} xpath=//input[@name='scan-image-on-push']
${project_config_prevent_vulnerable_images_from_running_checkbox} xpath=//input[@name='prevent-vulenrability-image-input'] ${project_config_prevent_vulnerable_images_from_running_checkbox} xpath=//input[@name='prevent-vulenrability-image-input']
${project_config_severity_select} xpath=//select[@id='severity'] ${project_config_severity_select} xpath=//select[@id='severity']
${project_config_public_checkbox_label} xpath=//*[@id="clr-wrapper-public"]/div/clr-checkbox-wrapper/label ${project_config_public_checkbox_label} xpath=//*[@id="clr-wrapper-public"]/div/clr-checkbox-wrapper/label
${project_config_prevent_vulenrability_checkbox_label} xpath=//*[@id='prevent-vulenrability-image']//clr-checkbox-wrapper//label ${project_config_prevent_vulenrability_checkbox_label} xpath=//*[@id='prevent-vulenrability-image']//clr-checkbox-wrapper//label
${project_config_system_wl_radio_input} xpath=//clr-radio-wrapper//label[contains(.,'System allowlist')] ${project_config_system_wl_radio_input} xpath=//clr-radio-wrapper//label[contains(.,'System allowlist')]
${project_config_project_wl_radio_input} xpath=//clr-radio-wrapper//label[contains(.,'Project allowlist')] ${project_config_project_wl_radio_input} xpath=//clr-radio-wrapper//label[contains(.,'Project allowlist')]
${project_config_system_wl_radio_input_id} systemAllowlistOrProjectAllowlist ${project_config_system_wl_radio_input_id} systemAllowlistOrProjectAllowlist
${project_config_project_wl_radio_input_id} systemAllowlistOrProjectAllowlist ${project_config_project_wl_radio_input_id} systemAllowlistOrProjectAllowlist
${project_config_project_wl_add_btn} xpath=//*[@id='show-add-modal'] ${project_config_project_wl_add_btn} xpath=//*[@id='show-add-modal']
${project_config_project_wl_add_confirm_btn} xpath=//*[@id='add-to-allowlist'] ${project_config_project_wl_add_confirm_btn} xpath=//*[@id='add-to-allowlist']
${project_config_save_btn} xpath=//hbr-project-policy-config//button[contains(.,'SAVE')] ${project_config_save_btn} xpath=//hbr-project-policy-config//button[contains(.,'SAVE')]
${project_add_count_quota_input_text_id} xpath=//*[@id='create_project_count_limit'] ${project_add_count_quota_input_text_id} xpath=//*[@id='create_project_count_limit']
${project_add_storage_quota_input_text_id} xpath=//*[@id='create_project_storage_limit'] ${project_add_storage_quota_input_text_id} xpath=//*[@id='create_project_storage_limit']
${project_add_storage_quota_unit_id} xpath=//*[@id='create_project_storage_limit_unit'] ${project_add_storage_quota_unit_id} xpath=//*[@id='create_project_storage_limit_unit']
${project_proxy_cache_switcher_id} xpath=//*[@id='proxy-cache'] ${project_proxy_cache_switcher_id} xpath=//*[@id='proxy-cache']
${project_registry_select_id} xpath=//*[@id='registry'] ${project_registry_select_id} xpath=//*[@id='registry']

View File

@ -1,25 +1,25 @@
*** Settings *** *** Settings ***
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
*** Variables *** *** Variables ***
*** Keywords *** *** Keywords ***
Switch To Project Robot Account Switch To Project Robot Account
#Switch To Project Tab Overflow #Switch To Project Tab Overflow
Retry Element Click ${project_robot_account_tabpage} Retry Element Click ${project_robot_account_tabpage}
Retry Wait Until Page Contains Element ${project_robot_account_create_btn} Retry Wait Until Page Contains Element ${project_robot_account_create_btn}
Create A Robot Account And Return Token Create A Robot Account And Return Token
[Arguments] ${projectname} ${robot_account_name} ${project_has_image}=${false} [Arguments] ${projectname} ${robot_account_name} ${project_has_image}=${false}
Go Into Project ${projectname} has_image=${project_has_image} Go Into Project ${projectname} has_image=${project_has_image}
Switch To Project Robot Account Switch To Project Robot Account
Retry Element Click ${project_robot_account_create_btn} Retry Element Click ${project_robot_account_create_btn}
Retry Text Input ${project_robot_account_create_name_input} ${robot_account_name} Retry Text Input ${project_robot_account_create_name_input} ${robot_account_name}
Retry Element Click xpath=//select[@id='expiration-type'] Retry Element Click xpath=//select[@id='expiration-type']
Retry Element Click xpath=//select[@id='expiration-type']//option[@value='never'] Retry Element Click xpath=//select[@id='expiration-type']//option[@value='never']
Retry Double Keywords When Error Retry Element Click ${project_robot_account_create_save_btn} Retry Wait Until Page Not Contains Element ${project_robot_account_create_save_btn} Retry Double Keywords When Error Retry Element Click ${project_robot_account_create_save_btn} Retry Wait Until Page Not Contains Element ${project_robot_account_create_save_btn}
${token}= Get Value ${project_robot_account_token_input} ${token}= Get Value ${project_robot_account_token_input}
[Return] ${token} [Return] ${token}

View File

@ -1,9 +1,9 @@
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor robot-account feature Documentation This resource provides any keywords related to the Harbor robot-account feature
*** Variables *** *** Variables ***
${project_robot_account_tabpage} xpath=//project-detail//a[contains(.,'Robot Accounts')] ${project_robot_account_tabpage} xpath=//project-detail//a[contains(.,'Robot Accounts')]
${project_robot_account_create_btn} xpath=//project-detail/app-robot-account//button ${project_robot_account_create_btn} xpath=//project-detail/app-robot-account//button
${project_robot_account_token_input} xpath=//app-robot-account//hbr-copy-input//input ${project_robot_account_token_input} xpath=//app-robot-account//hbr-copy-input//input
${project_robot_account_create_name_input} //input[@id='name'] ${project_robot_account_create_name_input} //input[@id='name']
${project_robot_account_create_save_btn} //button[@id='system-robot-save'] ${project_robot_account_create_save_btn} //button[@id='system-robot-save']

View File

@ -1,24 +1,24 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to public Documentation This resource provides any keywords related to public
*** Variables *** *** Variables ***
${delete_btn} //clr-modal//button[contains(.,'DELETE')] ${delete_btn} //clr-modal//button[contains(.,'DELETE')]
${delete_btn_2} //button[contains(.,'Delete')] ${delete_btn_2} //button[contains(.,'Delete')]
${default_scanner_info_close_icon} /html/body/harbor-app/harbor-shell/clr-main-container/div[1]/div[3]/clr-icon ${default_scanner_info_close_icon} /html/body/harbor-app/harbor-shell/clr-main-container/div[1]/div[3]/clr-icon
${back_to_home_link} /html/body/harbor-app/harbor-shell/clr-main-container/div[2]/div/search-result/div/div[2]/a ${back_to_home_link} /html/body/harbor-app/harbor-shell/clr-main-container/div[2]/div/search-result/div/div[2]/a

View File

@ -1,256 +1,256 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
*** Variables *** *** Variables ***
*** Keywords *** *** Keywords ***
Filter Replication Rule Filter Replication Rule
[Arguments] ${ruleName} ${exist}=${true} [Arguments] ${ruleName} ${exist}=${true}
${rule_name_element}= Set Variable xpath=//clr-dg-cell[contains(.,'${ruleName}')] ${rule_name_element}= Set Variable xpath=//clr-dg-cell[contains(.,'${ruleName}')]
Retry Element Click ${filter_rules_btn} Retry Element Click ${filter_rules_btn}
Retry Clear Element Text ${filter_rules_input} Retry Clear Element Text ${filter_rules_input}
Retry Text Input ${filter_rules_input} ${ruleName} Retry Text Input ${filter_rules_input} ${ruleName}
Run Keyword If ${exist}==${true} Retry Wait Until Page Contains Element ${rule_name_element} Run Keyword If ${exist}==${true} Retry Wait Until Page Contains Element ${rule_name_element}
... ELSE Retry Wait Element xpath=//clr-dg-placeholder[contains(.,\"We couldn\'t find any replication rules!\")] ... ELSE Retry Wait Element xpath=//clr-dg-placeholder[contains(.,\"We couldn\'t find any replication rules!\")]
Filter Registry Filter Registry
[Arguments] ${registry_name} [Arguments] ${registry_name}
${registry_name_element}= Set Variable xpath=//clr-dg-cell[contains(.,'${registry_name}')] ${registry_name_element}= Set Variable xpath=//clr-dg-cell[contains(.,'${registry_name}')]
Switch To Replication Manage Switch To Replication Manage
Switch To Registries Switch To Registries
Retry Element Click ${filter_registry_btn} Retry Element Click ${filter_registry_btn}
Retry Text Input ${filter_registry_input} ${registry_name} Retry Text Input ${filter_registry_input} ${registry_name}
Retry Wait Until Page Contains Element ${registry_name_element} Retry Wait Until Page Contains Element ${registry_name_element}
Select Dest Registry Select Dest Registry
[Arguments] ${endpoint} [Arguments] ${endpoint}
Retry Element Click ${dest_registry_dropdown_list} Retry Element Click ${dest_registry_dropdown_list}
Retry Element Click ${dest_registry_dropdown_list}//option[contains(.,'${endpoint}')] Retry Element Click ${dest_registry_dropdown_list}//option[contains(.,'${endpoint}')]
Select Source Registry Select Source Registry
[Arguments] ${endpoint} [Arguments] ${endpoint}
Retry Element Click ${src_registry_dropdown_list} Retry Element Click ${src_registry_dropdown_list}
Retry Element Click ${src_registry_dropdown_list}//option[contains(.,'${endpoint}')] Retry Element Click ${src_registry_dropdown_list}//option[contains(.,'${endpoint}')]
Select Trigger Select Trigger
[Arguments] ${mode} [Arguments] ${mode}
Retry Element Click ${rule_trigger_select} Retry Element Click ${rule_trigger_select}
Retry Element Click ${rule_trigger_select}//option[contains(.,'${mode}')] Retry Element Click ${rule_trigger_select}//option[contains(.,'${mode}')]
Select Destination URL Select Destination URL
[Arguments] ${type} [Arguments] ${type}
Retry Element Click ${destination_url_xpath} Retry Element Click ${destination_url_xpath}
Retry Element Click //div[contains(@class, 'selectBox')]//li[contains(.,'${type}')] Retry Element Click //div[contains(@class, 'selectBox')]//li[contains(.,'${type}')]
Check New Rule UI Without Endpoint Check New Rule UI Without Endpoint
Retry Element Click ${new_replication-rule_button} Retry Element Click ${new_replication-rule_button}
Page Should Contain Please add an endpoint first Page Should Contain Please add an endpoint first
Retry Element Click ${link_to_registries} Retry Element Click ${link_to_registries}
Retry Wait Until Page Contains Endpoint URL Retry Wait Until Page Contains Endpoint URL
Retry Wait Element ${new_endpoint_button} Retry Wait Element ${new_endpoint_button}
Create A New Endpoint Create A New Endpoint
[Arguments] ${provider} ${name} ${url} ${username} ${pwd} ${save}=Y [Arguments] ${provider} ${name} ${url} ${username} ${pwd} ${save}=Y
#click new button #click new button
Retry Element Click xpath=${new_endpoint_button} Retry Element Click xpath=${new_endpoint_button}
#input necessary info #input necessary info
Select From List By Value ${provider_selector} ${provider} Select From List By Value ${provider_selector} ${provider}
Retry Text Input xpath=${destination_name_xpath} ${name} Retry Text Input xpath=${destination_name_xpath} ${name}
Run Keyword If '${provider}' == 'harbor' or '${provider}' == 'gitlab' Run keyword Retry Text Input xpath=${destination_url_xpath} ${url} Run Keyword If '${provider}' == 'harbor' or '${provider}' == 'gitlab' Run keyword Retry Text Input xpath=${destination_url_xpath} ${url}
Run Keyword If '${provider}' == 'aws-ecr' or '${provider}' == 'google-gcr' Run keyword Select Destination URL ${url} Run Keyword If '${provider}' == 'aws-ecr' or '${provider}' == 'google-gcr' Run keyword Select Destination URL ${url}
Run Keyword If '${provider}' != 'google-gcr' and '${username}' != '${null}' Retry Text Input xpath=${destination_username_xpath} ${username} Run Keyword If '${provider}' != 'google-gcr' and '${username}' != '${null}' Retry Text Input xpath=${destination_username_xpath} ${username}
Run Keyword If '${pwd}' != '${null}' Retry Text Input xpath=${destination_password_xpath} ${pwd} Run Keyword If '${pwd}' != '${null}' Retry Text Input xpath=${destination_password_xpath} ${pwd}
#cancel verify cert since we use a selfsigned cert #cancel verify cert since we use a selfsigned cert
Retry Element Click ${destination_insecure_xpath} Retry Element Click ${destination_insecure_xpath}
Run Keyword If '${save}' == 'Y' Run keyword Retry Double Keywords When Error Retry Element Click ${replication_save_xpath} Retry Wait Until Page Not Contains Element ${replication_save_xpath} Run Keyword If '${save}' == 'Y' Run keyword Retry Double Keywords When Error Retry Element Click ${replication_save_xpath} Retry Wait Until Page Not Contains Element ${replication_save_xpath}
Run Keyword If '${save}' == 'Y' Run keyword Filter Registry ${name} Run Keyword If '${save}' == 'Y' Run keyword Filter Registry ${name}
Run Keyword If '${save}' == 'N' No Operation Run Keyword If '${save}' == 'N' No Operation
Create A Rule With Existing Endpoint Create A Rule With Existing Endpoint
[Arguments] ${name} ${replication_mode} ${filter_project_name} ${resource_type} ${endpoint} ${dest_namespace} [Arguments] ${name} ${replication_mode} ${filter_project_name} ${resource_type} ${endpoint} ${dest_namespace}
... ${mode}=Manual ${cron}="* */59 * * * *" ${del_remote}=${false} ${filter_tag}=${false} ... ${mode}=Manual ${cron}="* */59 * * * *" ${del_remote}=${false} ${filter_tag}=${false}
#click new #click new
Retry Element Click ${new_name_xpath} Retry Element Click ${new_name_xpath}
#input name #input name
Retry Text Input ${rule_name} ${name} Retry Text Input ${rule_name} ${name}
Run Keyword If '${replication_mode}' == 'push' Run Keywords Retry Element Click ${replication_mode_radio_push} AND Select Dest Registry ${endpoint} Run Keyword If '${replication_mode}' == 'push' Run Keywords Retry Element Click ${replication_mode_radio_push} AND Select Dest Registry ${endpoint}
... ELSE Run Keywords Retry Element Click ${replication_mode_radio_pull} AND Select Source Registry ${endpoint} ... ELSE Run Keywords Retry Element Click ${replication_mode_radio_pull} AND Select Source Registry ${endpoint}
#set filter #set filter
Retry Text Input ${filter_name_id} ${filter_project_name} Retry Text Input ${filter_name_id} ${filter_project_name}
Run Keyword If '${filter_tag}' != '${false}' Retry Text Input ${filter_tag_id} ${filter_tag} Run Keyword If '${filter_tag}' != '${false}' Retry Text Input ${filter_tag_id} ${filter_tag}
Run Keyword And Ignore Error Select From List By Value ${rule_resource_selector} ${resource_type} Run Keyword And Ignore Error Select From List By Value ${rule_resource_selector} ${resource_type}
Retry Text Input ${dest_namespace_xpath} ${dest_namespace} Retry Text Input ${dest_namespace_xpath} ${dest_namespace}
#set trigger #set trigger
Select Trigger ${mode} Select Trigger ${mode}
Run Keyword If '${mode}' == 'Scheduled' Retry Text Input ${targetCron_id} ${cron} Run Keyword If '${mode}' == 'Scheduled' Retry Text Input ${targetCron_id} ${cron}
Run Keyword If '${mode}' == 'Event Based' and '${del_remote}' == '${true}' Retry Element Click ${del_remote_checkbox} Run Keyword If '${mode}' == 'Event Based' and '${del_remote}' == '${true}' Retry Element Click ${del_remote_checkbox}
#click save #click save
Retry Double Keywords When Error Retry Element Click ${rule_save_button} Retry Wait Until Page Not Contains Element ${rule_save_button} Retry Double Keywords When Error Retry Element Click ${rule_save_button} Retry Wait Until Page Not Contains Element ${rule_save_button}
Sleep 2 Sleep 2
Endpoint Is Unpingable Endpoint Is Unpingable
Retry Element Click ${ping_test_button} Retry Element Click ${ping_test_button}
Wait Until Page Contains Failed Wait Until Page Contains Failed
Endpoint Is Pingable Endpoint Is Pingable
Retry Element Click ${ping_test_button} Retry Element Click ${ping_test_button}
Wait Until Page Contains successfully Wait Until Page Contains successfully
Disable Certificate Verification Disable Certificate Verification
Checkbox Should Be Selected ${destination_insecure_checkbox} Checkbox Should Be Selected ${destination_insecure_checkbox}
Retry Element Click ${destination_insecure_xpath} Retry Element Click ${destination_insecure_xpath}
Sleep 1 Sleep 1
Enable Certificate Verification Enable Certificate Verification
Checkbox Should Not Be Selected ${destination_insecure_checkbox} Checkbox Should Not Be Selected ${destination_insecure_checkbox}
Retry Element Click ${destination_insecure_xpath} Retry Element Click ${destination_insecure_xpath}
Sleep 1 Sleep 1
Switch To Registries Switch To Registries
Retry Element Click ${nav_to_registries} Retry Element Click ${nav_to_registries}
Sleep 1 Sleep 1
Switch To Replication Manage Switch To Replication Manage
Retry Element Click ${nav_to_replications} Retry Element Click ${nav_to_replications}
Sleep 1 Sleep 1
Trigger Replication Manual Trigger Replication Manual
[Arguments] ${rule} [Arguments] ${rule}
Retry Element Click ${rule_filter_search} Retry Element Click ${rule_filter_search}
Retry Text Input ${rule_filter_input} ${rule} Retry Text Input ${rule_filter_input} ${rule}
Retry Element Click //clr-dg-row[contains(.,'${rule}')]//label Retry Element Click //clr-dg-row[contains(.,'${rule}')]//label
Retry Element Click ${action_bar_replicate} Retry Element Click ${action_bar_replicate}
Retry Wait Until Page Contains Element ${dialog_replicate} Retry Wait Until Page Contains Element ${dialog_replicate}
#change from click to mouse down and up #change from click to mouse down and up
Mouse Down ${dialog_replicate} Mouse Down ${dialog_replicate}
Mouse Up ${dialog_replicate} Mouse Up ${dialog_replicate}
Sleep 2 Sleep 2
Retry Wait Until Page Contains Element //*[@id='contentAll']//div[contains(.,'${rule}')]/../div/clr-icon[@shape='success-standard'] Retry Wait Until Page Contains Element //*[@id='contentAll']//div[contains(.,'${rule}')]/../div/clr-icon[@shape='success-standard']
Sleep 1 Sleep 1
Rename Rule Rename Rule
[Arguments] ${rule} ${newname} [Arguments] ${rule} ${newname}
Retry Element Click ${rule_filter_search} Retry Element Click ${rule_filter_search}
Retry Text Input ${rule_filter_input} ${rule} Retry Text Input ${rule_filter_input} ${rule}
Retry Element Click //clr-dg-row[contains(.,'${rule}')]//label Retry Element Click //clr-dg-row[contains(.,'${rule}')]//label
Retry Element Click ${replication_rule_action} Retry Element Click ${replication_rule_action}
Retry Element Click ${replication_rule_action_bar_edit} Retry Element Click ${replication_rule_action_bar_edit}
Retry Text Input ${rule_name} ${newname} Retry Text Input ${rule_name} ${newname}
Retry Element Click ${rule_save_button} Retry Element Click ${rule_save_button}
Select Rule Select Rule
[Arguments] ${rule} [Arguments] ${rule}
Retry Double Keywords When Error Retry Element Click //clr-dg-row[contains(.,'${rule}')]/div/div[1]/div Retry Wait Element ${replication_rule_exec_id} Retry Double Keywords When Error Retry Element Click //clr-dg-row[contains(.,'${rule}')]/div/div[1]/div Retry Wait Element ${replication_rule_exec_id}
Stop Jobs Stop Jobs
Retry Element Click ${stop_jobs_button} Retry Element Click ${stop_jobs_button}
View Job Log View Job Log
[arguments] ${job} [arguments] ${job}
Retry Element Click ${job_filter_search} Retry Element Click ${job_filter_search}
Retry Text Input ${job_filter_input} ${job} Retry Text Input ${job_filter_input} ${job}
Retry Link Click //clr-dg-row[contains(.,'${job}')]//a Retry Link Click //clr-dg-row[contains(.,'${job}')]//a
Find Registry And Click Edit Button Find Registry And Click Edit Button
[Arguments] ${name} [Arguments] ${name}
Filter Object ${name} Filter Object ${name}
Retry Select Object ${name} Retry Select Object ${name}
Retry Element Click ${registry_edit_btn} Retry Element Click ${registry_edit_btn}
Switch To Replication Manage Page Switch To Replication Manage Page
Switch To Registries Switch To Registries
Switch To Replication Manage Switch To Replication Manage
Click Edit Button Click Edit Button
Retry Element Click ${replication_rule_action} Retry Element Click ${replication_rule_action}
Retry Element Click ${replication_rule_action_bar_edit} Retry Element Click ${replication_rule_action_bar_edit}
Click Delete Button Click Delete Button
Retry Element Click ${replication_rule_action} Retry Element Click ${replication_rule_action}
Retry Element Click ${replication_rule_action_bar_delete} Retry Element Click ${replication_rule_action_bar_delete}
Edit Replication Rule Edit Replication Rule
[Arguments] ${name} [Arguments] ${name}
Switch To Replication Manage Page Switch To Replication Manage Page
Filter Replication Rule ${name} Filter Replication Rule ${name}
Select Rule ${name} Select Rule ${name}
Click Edit Button Click Edit Button
Retry Wait Until Page Contains Edit Replication Rule Retry Wait Until Page Contains Edit Replication Rule
Delete Replication Rule Delete Replication Rule
[Arguments] ${name} [Arguments] ${name}
Switch To Replication Manage Page Switch To Replication Manage Page
Filter Replication Rule ${name} Filter Replication Rule ${name}
Select Rule ${name} Select Rule ${name}
Click Delete Button Click Delete Button
Wait Until Page Contains Element ${dialog_delete} Wait Until Page Contains Element ${dialog_delete}
Retry Double Keywords When Error Retry Element Click ${dialog_delete} Retry Wait Until Page Not Contains Element ${dialog_delete} Retry Double Keywords When Error Retry Element Click ${dialog_delete} Retry Wait Until Page Not Contains Element ${dialog_delete}
Filter Replication Rule ${name} exist=${false} Filter Replication Rule ${name} exist=${false}
Rename Endpoint Rename Endpoint
[arguments] ${name} ${newname} [arguments] ${name} ${newname}
Find Registry And Click Edit Button ${name} Find Registry And Click Edit Button ${name}
Retry Wait Until Page Contains Element ${destination_name_xpath} Retry Wait Until Page Contains Element ${destination_name_xpath}
Retry Text Input ${destination_name_xpath} ${newname} Retry Text Input ${destination_name_xpath} ${newname}
Retry Element Click ${replication_save_xpath} Retry Element Click ${replication_save_xpath}
Delete Endpoint Delete Endpoint
[Arguments] ${name} [Arguments] ${name}
Retry Element Click ${endpoint_filter_search} Retry Element Click ${endpoint_filter_search}
Retry Text Input ${endpoint_filter_input} ${name} Retry Text Input ${endpoint_filter_input} ${name}
#click checkbox before target endpoint #click checkbox before target endpoint
Retry Double Keywords When Error Retry Element Click //clr-dg-row[contains(.,'${name}')]//clr-checkbox-wrapper Retry Wait Element ${registry_del_btn} Retry Double Keywords When Error Retry Element Click //clr-dg-row[contains(.,'${name}')]//clr-checkbox-wrapper Retry Wait Element ${registry_del_btn}
Retry Element Click ${registry_del_btn} Retry Element Click ${registry_del_btn}
Wait Until Page Contains Element ${dialog_delete} Wait Until Page Contains Element ${dialog_delete}
Retry Element Click ${dialog_delete} Retry Element Click ${dialog_delete}
Select Rule And Replicate Select Rule And Replicate
[Arguments] ${rule_name} [Arguments] ${rule_name}
Select Rule ${rule_name} Select Rule ${rule_name}
Retry Element Click ${replication_rule_exec_id} Retry Element Click ${replication_rule_exec_id}
Retry Double Keywords When Error Retry Element Click xpath=${dialog_replicate} Retry Wait Until Page Not Contains Element xpath=${dialog_replicate} Retry Double Keywords When Error Retry Element Click xpath=${dialog_replicate} Retry Wait Until Page Not Contains Element xpath=${dialog_replicate}
Image Should Be Replicated To Project Image Should Be Replicated To Project
[Arguments] ${project} ${image} ${period}=60 ${times}=20 ${tag}=${EMPTY} ${expected_image_size_in_regexp}=${null} ${total_artifact_count}=${null} ${archive_count}=${null} [Arguments] ${project} ${image} ${period}=60 ${times}=20 ${tag}=${EMPTY} ${expected_image_size_in_regexp}=${null} ${total_artifact_count}=${null} ${archive_count}=${null}
FOR ${n} IN RANGE 0 ${times} FOR ${n} IN RANGE 0 ${times}
Sleep ${period} Sleep ${period}
Go Into Project ${project} Go Into Project ${project}
Switch To Project Repo Switch To Project Repo
${out} Run Keyword And Ignore Error Retry Wait Until Page Contains ${project}/${image} ${out} Run Keyword And Ignore Error Retry Wait Until Page Contains ${project}/${image}
Log To Console Return value is ${out[0]} Log To Console Return value is ${out[0]}
Exit For Loop If '${out[0]}'=='PASS' Exit For Loop If '${out[0]}'=='PASS'
Sleep 5 Sleep 5
END END
Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot
Should Be Equal As Strings '${out[0]}' 'PASS' Should Be Equal As Strings '${out[0]}' 'PASS'
Go Into Repo ${project}/${image} Go Into Repo ${project}/${image}
${size}= Run Keyword If '${tag}'!='${EMPTY}' and '${expected_image_size_in_regexp}'!='${null}' Get Text //clr-dg-row[contains(., '${tag}')]//clr-dg-cell[4]/div ${size}= Run Keyword If '${tag}'!='${EMPTY}' and '${expected_image_size_in_regexp}'!='${null}' Get Text //clr-dg-row[contains(., '${tag}')]//clr-dg-cell[4]/div
Run Keyword If '${tag}'!='${EMPTY}' and '${expected_image_size_in_regexp}'!='${null}' Should Match Regexp '${size}' '${expected_image_size_in_regexp}' Run Keyword If '${tag}'!='${EMPTY}' and '${expected_image_size_in_regexp}'!='${null}' Should Match Regexp '${size}' '${expected_image_size_in_regexp}'
Run Keyword If '${total_artifact_count}'!='${null}' Run Keywords Run Keyword If '${total_artifact_count}'!='${null}' Run Keywords
... Should Not Be Empty ${tag} ... Should Not Be Empty ${tag}
... AND Go Into Index And Contain Artifacts ${tag} total_artifact_count=${total_artifact_count} archive_count=${archive_count} ... AND Go Into Index And Contain Artifacts ${tag} total_artifact_count=${total_artifact_count} archive_count=${archive_count}
Executions Result Count Should Be Executions Result Count Should Be
[Arguments] ${expected_status} ${expected_trigger_type} ${expected_result_count} [Arguments] ${expected_status} ${expected_trigger_type} ${expected_result_count}
Sleep 10 Sleep 10
${count}= Get Element Count xpath=//clr-dg-row[contains(.,'${expected_status}') and contains(.,'${expected_trigger_type}')] ${count}= Get Element Count xpath=//clr-dg-row[contains(.,'${expected_status}') and contains(.,'${expected_trigger_type}')]
Should Be Equal As Integers ${count} ${expected_result_count} Should Be Equal As Integers ${count} ${expected_result_count}

View File

@ -1,97 +1,97 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
*** Variables *** *** Variables ***
${new_name_xpath} //hbr-list-replication-rule//button[contains(.,'New')] ${new_name_xpath} //hbr-list-replication-rule//button[contains(.,'New')]
${policy_name_xpath} //*[@id='policy_name'] ${policy_name_xpath} //*[@id='policy_name']
${policy_description_xpath} //*[@id='policy_description'] ${policy_description_xpath} //*[@id='policy_description']
${policy_enable_checkbox} //input[@id='policy_enable']/../label ${policy_enable_checkbox} //input[@id='policy_enable']/../label
${policy_endpoint_checkbox} //input[@id='check_new']/../label ${policy_endpoint_checkbox} //input[@id='check_new']/../label
${destination_name_xpath} //*[@id='destination_name'] ${destination_name_xpath} //*[@id='destination_name']
${destination_url_xpath} //*[@id='destination_url'] ${destination_url_xpath} //*[@id='destination_url']
${destination_username_xpath} //*[@id='destination_access_key'] ${destination_username_xpath} //*[@id='destination_access_key']
${destination_password_xpath} //*[@id='destination_password'] ${destination_password_xpath} //*[@id='destination_password']
${replication_save_xpath} //button[contains(.,'OK')] ${replication_save_xpath} //button[contains(.,'OK')]
${replication_xpath} //clr-vertical-nav-group-children/a[contains(.,'Replication')] ${replication_xpath} //clr-vertical-nav-group-children/a[contains(.,'Replication')]
${destination_insecure_xpath} //label[@id='destination_insecure_checkbox'] ${destination_insecure_xpath} //label[@id='destination_insecure_checkbox']
${new_replication-rule_button} //button[contains(.,'New Replication Rule')] ${new_replication-rule_button} //button[contains(.,'New Replication Rule')]
${link_to_registries} //clr-modal//span[contains(.,'Endpoint')] ${link_to_registries} //clr-modal//span[contains(.,'Endpoint')]
${new_endpoint_button} //hbr-endpoint//button[contains(.,'New Endpoint')] ${new_endpoint_button} //hbr-endpoint//button[contains(.,'New Endpoint')]
${rule_name} //input[@id='ruleName'] ${rule_name} //input[@id='ruleName']
${source_image_filter_add} //hbr-create-edit-rule/clr-modal//clr-icon[@id='add-label-list'] ${source_image_filter_add} //hbr-create-edit-rule/clr-modal//clr-icon[@id='add-label-list']
${source_iamge_repo_filter} //hbr-create-edit-rule//section/div[4]/div/div[1]/div/label/input ${source_iamge_repo_filter} //hbr-create-edit-rule//section/div[4]/div/div[1]/div/label/input
${source_image_tag_filter} //hbr-create-edit-rule//section/div[4]/div/div[2]/div/label/input ${source_image_tag_filter} //hbr-create-edit-rule//section/div[4]/div/div[2]/div/label/input
${rule_target_select} //select[@id='ruleTarget'] ${rule_target_select} //select[@id='ruleTarget']
${rule_trigger_select} //select[@id='ruleTrigger'] ${rule_trigger_select} //select[@id='ruleTrigger']
${schedule_type_select} //select[@name='scheduleType'] ${schedule_type_select} //select[@name='scheduleType']
${schedule_day_select} //select[@name='scheduleDay'] ${schedule_day_select} //select[@name='scheduleDay']
${shcedule_time} //input[@type='time'] ${shcedule_time} //input[@type='time']
${destination_insecure_checkbox} //hbr-create-edit-endpoint/clr-modal//input[@id='destination_insecure'] ${destination_insecure_checkbox} //hbr-create-edit-endpoint/clr-modal//input[@id='destination_insecure']
#${destination_insecure_checkbox} //clr-checkbox-wrapper/label[contains(@for, 'destination_insecure')] #${destination_insecure_checkbox} //clr-checkbox-wrapper/label[contains(@for, 'destination_insecure')]
${ping_test_button} //button[contains(.,'Test')] ${ping_test_button} //button[contains(.,'Test')]
${nav_to_registries} //clr-vertical-nav//span[contains(.,'Registries')] ${nav_to_registries} //clr-vertical-nav//span[contains(.,'Registries')]
${nav_to_replications} //clr-vertical-nav//span[contains(.,'Replications')] ${nav_to_replications} //clr-vertical-nav//span[contains(.,'Replications')]
${rule_filter_search} //hbr-replication/div/div[1]//hbr-filter/span/clr-icon ${rule_filter_search} //hbr-replication/div/div[1]//hbr-filter/span/clr-icon
${rule_filter_input} //hbr-replication/div/div[1]//hbr-filter/span//input ${rule_filter_input} //hbr-replication/div/div[1]//hbr-filter/span//input
${job_filter_search} //hbr-replication/div/div[3]//hbr-filter/span/clr-icon ${job_filter_search} //hbr-replication/div/div[3]//hbr-filter/span/clr-icon
${job_filter_input} //hbr-replication/div/div[3]//hbr-filter/span//input ${job_filter_input} //hbr-replication/div/div[3]//hbr-filter/span//input
${endpoint_filter_search} //hbr-filter/span/clr-icon ${endpoint_filter_search} //hbr-filter/span/clr-icon
${endpoint_filter_input} //hbr-filter/span//input ${endpoint_filter_input} //hbr-filter/span//input
${stop_jobs_button} //button[contains(.,'Stop Jobs')] ${stop_jobs_button} //button[contains(.,'Stop Jobs')]
${dialog_close} //clr-modal//button[contains(.,'CLOSE')] ${dialog_close} //clr-modal//button[contains(.,'CLOSE')]
${dialog_delete} //clr-modal//button[contains(.,'DELETE')] ${dialog_delete} //clr-modal//button[contains(.,'DELETE')]
${dialog_replicate} //clr-modal//button[contains(.,'REPLICATE')] ${dialog_replicate} //clr-modal//button[contains(.,'REPLICATE')]
${action_bar_replicate} //button[contains(.,'Replicate')] ${action_bar_replicate} //button[contains(.,'Replicate')]
${rule_save_button} //button[contains(.,'SAVE')] ${rule_save_button} //button[contains(.,'SAVE')]
${provider_selector} //*[@id='adapter'] ${provider_selector} //*[@id='adapter']
${replication_mode_radio_push} //clr-main-container//hbr-create-edit-rule//label[contains(.,'Push-based')] ${replication_mode_radio_push} //clr-main-container//hbr-create-edit-rule//label[contains(.,'Push-based')]
${replication_mode_radio_pull} //clr-main-container//hbr-create-edit-rule//label[contains(.,'Pull-based')] ${replication_mode_radio_pull} //clr-main-container//hbr-create-edit-rule//label[contains(.,'Pull-based')]
${filter_name_id} //input[@id='filter_name'] ${filter_name_id} //input[@id='filter_name']
${filter_tag_id} //input[@id='filter_tag'] ${filter_tag_id} //input[@id='filter_tag']
${rule_resource_selector} //*[@id='select_resource'] ${rule_resource_selector} //*[@id='select_resource']
${trigger_mode_selector} //*[@id='ruleTrigger'] ${trigger_mode_selector} //*[@id='ruleTrigger']
${dest_namespace_xpath} //*[@id='dest_namespace'] ${dest_namespace_xpath} //*[@id='dest_namespace']
${new_replication_rule_id} //*[@id='new_replication_rule_id'] ${new_replication_rule_id} //*[@id='new_replication_rule_id']
${registry_edit_btn} //button[contains(.,'Edit')] ${registry_edit_btn} //button[contains(.,'Edit')]
${registry_del_btn} //button[contains(.,'Delete')] ${registry_del_btn} //button[contains(.,'Delete')]
${replication_rule_action} //*[@id='rule-action'] ${replication_rule_action} //*[@id='rule-action']
${replication_rule_action_bar_edit} //*[@id='edit_replication_rule_id'] ${replication_rule_action_bar_edit} //*[@id='edit_replication_rule_id']
${replication_rule_action_bar_delete} //*[@id='delete_replication_rule_id'] ${replication_rule_action_bar_delete} //*[@id='delete_replication_rule_id']
${replication_rule_exec_id} //*[@id='replication_exe_id'] ${replication_rule_exec_id} //*[@id='replication_exe_id']
${replication_task_line_1} //clr-datagrid//clr-dg-row/div/div[2]//clr-checkbox-wrapper/label[1] ${replication_task_line_1} //clr-datagrid//clr-dg-row/div/div[2]//clr-checkbox-wrapper/label[1]
${is_overide_xpath} //label[contains(.,'Replace the destination resources if name exists')] ${is_overide_xpath} //label[contains(.,'Replace the destination resources if name exists')]
${enable_rule_xpath} //label[contains(.,'Enable rule')] ${enable_rule_xpath} //label[contains(.,'Enable rule')]
${targetCron_id} //*[@id='targetCron'] ${targetCron_id} //*[@id='targetCron']
${rule_name_input} //*[@id='ruleName'] ${rule_name_input} //*[@id='ruleName']
${src_registry_dropdown_list} //select[@id='src_registry_id'] ${src_registry_dropdown_list} //select[@id='src_registry_id']
${dest_registry_dropdown_list} //select[@id='dest_registry'] ${dest_registry_dropdown_list} //select[@id='dest_registry']
${rule_confirm_btn} //*[@id='ruleBtnOk'] ${rule_confirm_btn} //*[@id='ruleBtnOk']
${rule_cancel_btn} //*[@id='ruleBtnCancel'] ${rule_cancel_btn} //*[@id='ruleBtnCancel']
${filter_rules_btn} //*[@id='filter-rules'] ${filter_rules_btn} //*[@id='filter-rules']
${filter_rules_input} //*[@id='filter-rules']//input ${filter_rules_input} //*[@id='filter-rules']//input
${del_remote_checkbox} //label[@for='ruleDeletion'] ${del_remote_checkbox} //label[@for='ruleDeletion']
${filter_registry_btn} //hbr-filter ${filter_registry_btn} //hbr-filter
${filter_registry_input} //input[contains(@class,'filter-input')] ${filter_registry_input} //input[contains(@class,'filter-input')]

View File

@ -1,116 +1,116 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
*** Variables *** *** Variables ***
*** Keywords *** *** Keywords ***
Delete Success Delete Success
[Arguments] @{obj} [Arguments] @{obj}
FOR ${obj} IN @{obj} FOR ${obj} IN @{obj}
Retry Wait Until Page Contains Element //*[@id='contentAll']//div[contains(.,'${obj}')]/../div/clr-icon[@shape='success-standard'] Retry Wait Until Page Contains Element //*[@id='contentAll']//div[contains(.,'${obj}')]/../div/clr-icon[@shape='success-standard']
END END
Sleep 1 Sleep 1
Delete Fail Delete Fail
[Arguments] @{obj} [Arguments] @{obj}
FOR ${obj} IN @{obj} FOR ${obj} IN @{obj}
Retry Wait Until Page Contains Element //*[@id='contentAll']//div[contains(.,'${obj}')]/../div/clr-icon[@shape='error-standard'] Retry Wait Until Page Contains Element //*[@id='contentAll']//div[contains(.,'${obj}')]/../div/clr-icon[@shape='error-standard']
END END
Sleep 1 Sleep 1
Filter Object Filter Object
#Filter project repo user tag. #Filter project repo user tag.
[Arguments] ${kw} [Arguments] ${kw}
Retry Element Click xpath=//hbr-filter//clr-icon Retry Element Click xpath=//hbr-filter//clr-icon
${element}= Set Variable xpath=//hbr-filter//input ${element}= Set Variable xpath=//hbr-filter//input
Wait Until Element Is Visible And Enabled ${element} Wait Until Element Is Visible And Enabled ${element}
Retry Clear Element Text ${element} Retry Clear Element Text ${element}
Retry Text Input ${element} ${kw} Retry Text Input ${element} ${kw}
Sleep 3 Sleep 3
Filter Project Filter Project
#Filter project repo user tag. #Filter project repo user tag.
[Arguments] ${kw} [Arguments] ${kw}
Retry Element Click ${log_xpath} Retry Element Click ${log_xpath}
Retry Element Click ${projects_xpath} Retry Element Click ${projects_xpath}
Filter Object ${kw} Filter Object ${kw}
Select Object Select Object
#select single element such as user project repo tag #select single element such as user project repo tag
[Arguments] ${obj} [Arguments] ${obj}
Retry Element Click xpath=//clr-dg-row[contains(.,'${obj}')]//label Retry Element Click xpath=//clr-dg-row[contains(.,'${obj}')]//label
Multi-delete Object Multi-delete Object
[Arguments] ${delete_btn} @{obj} [Arguments] ${delete_btn} @{obj}
FOR ${obj} IN @{obj} FOR ${obj} IN @{obj}
${element}= Set Variable xpath=//clr-dg-row[contains(.,'${obj}')]//label ${element}= Set Variable xpath=//clr-dg-row[contains(.,'${obj}')]//label
Retry Element Click ${element} Retry Element Click ${element}
END END
Sleep 1 Sleep 1
Retry Element Click ${delete_btn} Retry Element Click ${delete_btn}
Sleep 1 Sleep 1
Retry Element Click ${repo_delete_on_card_view_btn} Retry Element Click ${repo_delete_on_card_view_btn}
Sleep 1 Sleep 1
Sleep 1 Sleep 1
# This func cannot support as the delete user flow changed. # This func cannot support as the delete user flow changed.
Multi-delete Artifact Multi-delete Artifact
[Arguments] ${delete_btn} @{obj} [Arguments] ${delete_btn} @{obj}
FOR ${obj} IN @{obj} FOR ${obj} IN @{obj}
${element}= Set Variable xpath=//clr-dg-row[contains(.,'${obj}')]//label ${element}= Set Variable xpath=//clr-dg-row[contains(.,'${obj}')]//label
Retry Element Click ${element} Retry Element Click ${element}
END END
Sleep 1 Sleep 1
Retry Element Click ${artifact_action_xpath} Retry Element Click ${artifact_action_xpath}
Sleep 1 Sleep 1
Retry Element Click ${artifact_action_delete_xpath} Retry Element Click ${artifact_action_delete_xpath}
Sleep 1 Sleep 1
Retry Element Click ${repo_delete_on_card_view_btn} Retry Element Click ${repo_delete_on_card_view_btn}
Sleep 1 Sleep 1
Sleep 1 Sleep 1
Multi-delete User Multi-delete User
[Arguments] @{obj} [Arguments] @{obj}
FOR ${obj} IN @{obj} FOR ${obj} IN @{obj}
Retry Element Click //clr-dg-row[contains(.,'${obj}')]//label Retry Element Click //clr-dg-row[contains(.,'${obj}')]//label
END END
Retry Element Click ${member_action_xpath} Retry Element Click ${member_action_xpath}
Retry Element Click //*[@id='deleteUser'] Retry Element Click //*[@id='deleteUser']
Retry Double Keywords When Error Retry Element Click ${delete_btn} Retry Wait Until Page Not Contains Element ${delete_btn} Retry Double Keywords When Error Retry Element Click ${delete_btn} Retry Wait Until Page Not Contains Element ${delete_btn}
Multi-delete Member Multi-delete Member
[Arguments] @{obj} [Arguments] @{obj}
FOR ${obj} IN @{obj} FOR ${obj} IN @{obj}
Retry Element Click //clr-dg-row[contains(.,'${obj}')]//clr-checkbox-wrapper/label Retry Element Click //clr-dg-row[contains(.,'${obj}')]//clr-checkbox-wrapper/label
END END
Retry Double Keywords When Error Retry Element Click ${member_action_xpath} Retry Wait Until Page Contains Element ${delete_action_xpath} Retry Double Keywords When Error Retry Element Click ${member_action_xpath} Retry Wait Until Page Contains Element ${delete_action_xpath}
Retry Double Keywords When Error Retry Element Click ${delete_action_xpath} Retry Wait Until Page Contains Element ${delete_btn} Retry Double Keywords When Error Retry Element Click ${delete_action_xpath} Retry Wait Until Page Contains Element ${delete_btn}
Retry Double Keywords When Error Retry Element Click ${delete_btn} Retry Wait Until Page Not Contains Element ${delete_btn} Retry Double Keywords When Error Retry Element Click ${delete_btn} Retry Wait Until Page Not Contains Element ${delete_btn}
Multi-delete Object Without Confirmation Multi-delete Object Without Confirmation
[Arguments] @{obj} [Arguments] @{obj}
FOR ${obj} IN @{obj} FOR ${obj} IN @{obj}
Retry Element Click //clr-dg-row[contains(.,'${obj}')]//label Retry Element Click //clr-dg-row[contains(.,'${obj}')]//label
END END
Retry Double Keywords When Error Retry Element Click ${delete_btn_2} Retry Wait Until Page Not Contains Element ${delete_btn_2} Retry Double Keywords When Error Retry Element Click ${delete_btn_2} Retry Wait Until Page Not Contains Element ${delete_btn_2}
Select All On Current Page Object Select All On Current Page Object
Retry Element Click //div[@class='datagrid-head']//label Retry Element Click //div[@class='datagrid-head']//label

View File

@ -1,20 +1,20 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
*** Variables *** *** Variables ***
${member_action_xpath} //*[@id="member-action"] ${member_action_xpath} //*[@id="member-action"]
${delete_action_xpath} //clr-dropdown/clr-dropdown-menu/button[contains(.,'Remove')] ${delete_action_xpath} //clr-dropdown/clr-dropdown-menu/button[contains(.,'Remove')]

View File

@ -1,45 +1,45 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
*** Variables *** *** Variables ***
*** Keywords *** *** Keywords ***
Change Password Change Password
[Arguments] ${cur_pw} ${new_pw} [Arguments] ${cur_pw} ${new_pw}
Retry Element Click ${head_admin_xpath} Retry Element Click ${head_admin_xpath}
Retry Element Click ${change_password_xpath} Retry Element Click ${change_password_xpath}
Retry Text Input ${old_password_xpath} ${cur_pw} Retry Text Input ${old_password_xpath} ${cur_pw}
Retry Text Input ${new_password_xpath} ${new_pw} Retry Text Input ${new_password_xpath} ${new_pw}
Retry Text Input ${renew_password_xpath} ${new_pw} Retry Text Input ${renew_password_xpath} ${new_pw}
Retry Element Click ${change_password_confirm_btn_xpath} Retry Element Click ${change_password_confirm_btn_xpath}
Retry Element Click xpath=${log_xpath} Retry Element Click xpath=${log_xpath}
Sleep 1 Sleep 1
Update User Comment Update User Comment
[Arguments] ${new_comment} [Arguments] ${new_comment}
Retry Element Click ${head_admin_xpath} Retry Element Click ${head_admin_xpath}
Retry Element Click ${user_profile_xpath} Retry Element Click ${user_profile_xpath}
Retry Text Input ${account_settings_comments_xpath} ${new_comment} Retry Text Input ${account_settings_comments_xpath} ${new_comment}
Retry Element Click ${user_profile_confirm_btn_xpath} Retry Element Click ${user_profile_confirm_btn_xpath}
Sleep 2 Sleep 2
Logout Harbor Logout Harbor
Retry Element Click ${head_admin_xpath} Retry Element Click ${head_admin_xpath}
Retry Link Click Log Out Retry Link Click Log Out
Sleep 2 Sleep 2
Wait Until Keyword Succeeds 5x 1 Retry Wait Until Page Contains Element ${sign_in_title_xpath} Wait Until Keyword Succeeds 5x 1 Retry Wait Until Page Contains Element ${sign_in_title_xpath}

View File

@ -1,28 +1,28 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
*** Variables *** *** Variables ***
${head_admin_xpath} xpath=/html/body/harbor-app/harbor-shell/clr-main-container/navigator/clr-header/div[3]/clr-dropdown[2]/button/span ${head_admin_xpath} xpath=/html/body/harbor-app/harbor-shell/clr-main-container/navigator/clr-header/div[3]/clr-dropdown[2]/button/span
${change_password_xpath} xpath=//clr-main-container//clr-dropdown//a[2] ${change_password_xpath} xpath=//clr-main-container//clr-dropdown//a[2]
${user_profile_xpath} xpath=//clr-main-container//clr-dropdown//a[1] ${user_profile_xpath} xpath=//clr-main-container//clr-dropdown//a[1]
${old_password_xpath} xpath=//*[@id='oldPassword'] ${old_password_xpath} xpath=//*[@id='oldPassword']
${new_password_xpath} xpath=//*[@id='newPassword'] ${new_password_xpath} xpath=//*[@id='newPassword']
${renew_password_xpath} xpath=//*[@id='reNewPassword'] ${renew_password_xpath} xpath=//*[@id='reNewPassword']
${change_password_confirm_btn_xpath} xpath=//password-setting/clr-modal//button[2] ${change_password_confirm_btn_xpath} xpath=//password-setting/clr-modal//button[2]
${user_profile_confirm_btn_xpath} xpath=//account-settings-modal/clr-modal//button[2] ${user_profile_confirm_btn_xpath} xpath=//account-settings-modal/clr-modal//button[2]
${sign_in_title_xpath} xpath=//sign-in//form//*[@class='title'] ${sign_in_title_xpath} xpath=//sign-in//form//*[@class='title']
${account_settings_comments_xpath} xpath=//*[@id='account_settings_comments'] ${account_settings_comments_xpath} xpath=//*[@id='account_settings_comments']

File diff suppressed because it is too large Load Diff

View File

@ -1,109 +1,109 @@
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
*** Variables *** *** Variables ***
*** Keywords *** *** Keywords ***
Disable Scan Schedule Disable Scan Schedule
Retry Double Keywords When Error Retry Element Click ${vulnerability_edit_btn} Retry Wait Until Page Not Contains Element ${vulnerability_edit_btn} Retry Double Keywords When Error Retry Element Click ${vulnerability_edit_btn} Retry Wait Until Page Not Contains Element ${vulnerability_edit_btn}
Retry Element Click ${vulnerability_dropdown_list} Retry Element Click ${vulnerability_dropdown_list}
Retry Element Click ${vulnerability_dropdown_list_item_none} Retry Element Click ${vulnerability_dropdown_list_item_none}
Retry Double Keywords When Error Retry Element Click ${vulnerability_save_btn} Retry Wait Until Page Not Contains Element ${vulnerability_save_btn} Retry Double Keywords When Error Retry Element Click ${vulnerability_save_btn} Retry Wait Until Page Not Contains Element ${vulnerability_save_btn}
Set Scan Schedule Set Scan Schedule
[Arguments] ${type} ${value}=${null} [Arguments] ${type} ${value}=${null}
Retry Double Keywords When Error Retry Element Click ${vulnerability_edit_btn} Retry Wait Until Page Not Contains Element ${vulnerability_edit_btn} Retry Double Keywords When Error Retry Element Click ${vulnerability_edit_btn} Retry Wait Until Page Not Contains Element ${vulnerability_edit_btn}
Retry Element Click ${vulnerability_dropdown_list} Retry Element Click ${vulnerability_dropdown_list}
Run Keyword If '${type}'=='custom' Run Keywords Retry Element Click ${vulnerability_dropdown_list_item_custom} AND Retry Text Input ${targetCron_id} ${value} Run Keyword If '${type}'=='custom' Run Keywords Retry Element Click ${vulnerability_dropdown_list_item_custom} AND Retry Text Input ${targetCron_id} ${value}
Retry Double Keywords When Error Retry Element Click ${vulnerability_save_btn} Retry Wait Until Page Not Contains Element ${vulnerability_save_btn} Retry Double Keywords When Error Retry Element Click ${vulnerability_save_btn} Retry Wait Until Page Not Contains Element ${vulnerability_save_btn}
Trigger Scan Now And Wait Until The Result Appears Trigger Scan Now And Wait Until The Result Appears
Retry Element Click xpath=${scan_now_button} Retry Element Click xpath=${scan_now_button}
Sleep 60 Sleep 60
Retry Wait Until Page Contains Element ${scan_now_result} Retry Wait Until Page Contains Element ${scan_now_result}
Switch To Vulnerability Page Switch To Vulnerability Page
Retry Element Click xpath=//clr-main-container//clr-vertical-nav//a[contains(.,'Interrogation')] Retry Element Click xpath=//clr-main-container//clr-vertical-nav//a[contains(.,'Interrogation')]
Retry Element Click xpath=//app-interrogation-services//a[contains(.,'Vulnerability')] Retry Element Click xpath=//app-interrogation-services//a[contains(.,'Vulnerability')]
Retry Wait Element ${scan_now_button} Retry Wait Element ${scan_now_button}
Set Vulnerabilty Serverity Set Vulnerabilty Serverity
#0 is critical, 1 is high, 2 is medium, 3 is low, 4 is negligible. #0 is critical, 1 is high, 2 is medium, 3 is low, 4 is negligible.
[Arguments] ${level} [Arguments] ${level}
Goto Project Config Goto Project Config
#enable first #enable first
Retry Element Click ${project_config_prevent_vulenrability_checkbox_label} Retry Element Click ${project_config_prevent_vulenrability_checkbox_label}
Checkbox Should Be Selected //project-detail//clr-checkbox-wrapper//input[@name='prevent-vulenrability-image-input'] Checkbox Should Be Selected //project-detail//clr-checkbox-wrapper//input[@name='prevent-vulenrability-image-input']
Retry Element Click //project-detail//select Retry Element Click //project-detail//select
#wait for dropdown popup #wait for dropdown popup
Sleep 1 Sleep 1
Select From List By Index //project-detail//select ${level} Select From List By Index //project-detail//select ${level}
Retry Element Click ${project_config_save_btn} Retry Element Click ${project_config_save_btn}
Scan Is Disabled Scan Is Disabled
Retry Wait Until Page Contains Element //button[@id='scan-btn' and @disabled=''] Retry Wait Until Page Contains Element //button[@id='scan-btn' and @disabled='']
Move To Summary Chart Move To Summary Chart
Sleep 2 Sleep 2
Wait Until Element Is Visible //hbr-vulnerability-bar//hbr-result-tip-histogram Wait Until Element Is Visible //hbr-vulnerability-bar//hbr-result-tip-histogram
Mouse Over //hbr-result-tip-histogram Mouse Over //hbr-result-tip-histogram
Sleep 1 Sleep 1
Scan Repo Scan Repo
#use fail for image can not scan, otherwise use success #use fail for image can not scan, otherwise use success
[Arguments] ${tagname} ${status} [Arguments] ${tagname} ${status}
#select one tag #select one tag
Retry Element Click //clr-dg-row[contains(.,'${tagname}')]//label Retry Element Click //clr-dg-row[contains(.,'${tagname}')]//label
Retry Element Click //button[@id='scan-btn'] Retry Element Click //button[@id='scan-btn']
Run Keyword If '${status}' == 'Succeed' Wait Until Element Is Visible //hbr-vulnerability-bar//hbr-result-tip-histogram 300 Run Keyword If '${status}' == 'Succeed' Wait Until Element Is Visible //hbr-vulnerability-bar//hbr-result-tip-histogram 300
Run Keyword If '${status}' == 'Fail' Wait Until Element Is Visible //hbr-vulnerability-bar//a 300 Run Keyword If '${status}' == 'Fail' Wait Until Element Is Visible //hbr-vulnerability-bar//a 300
Scan Result Should Display In List Row Scan Result Should Display In List Row
[Arguments] ${tagname} ${is_no_vulerabilty}=${false} [Arguments] ${tagname} ${is_no_vulerabilty}=${false}
Run Keyword If ${is_no_vulerabilty}==${true} Retry Wait Until Page Contains Element //artifact-list-tab//clr-dg-row[contains(.,'No vulnerability') and contains(.,'${tagname}')]//clr-dg-cell//clr-tooltip Run Keyword If ${is_no_vulerabilty}==${true} Retry Wait Until Page Contains Element //artifact-list-tab//clr-dg-row[contains(.,'No vulnerability') and contains(.,'${tagname}')]//clr-dg-cell//clr-tooltip
... ELSE Retry Wait Until Page Contains Element //artifact-list-tab//clr-dg-row[contains(.,'Total') and contains(.,'Fixable') and contains(.,'${tagname}')]//clr-dg-cell//clr-tooltip ... ELSE Retry Wait Until Page Contains Element //artifact-list-tab//clr-dg-row[contains(.,'Total') and contains(.,'Fixable') and contains(.,'${tagname}')]//clr-dg-cell//clr-tooltip
Enable Scan On Push Enable Scan On Push
Checkbox Should Not Be Selected //clr-checkbox-wrapper[@id='scan-image-on-push-wrapper']//input Checkbox Should Not Be Selected //clr-checkbox-wrapper[@id='scan-image-on-push-wrapper']//input
Retry Element Click //clr-checkbox-wrapper[@id='scan-image-on-push-wrapper']//label Retry Element Click //clr-checkbox-wrapper[@id='scan-image-on-push-wrapper']//label
Checkbox Should Be Selected //clr-checkbox-wrapper[@id='scan-image-on-push-wrapper']//input Checkbox Should Be Selected //clr-checkbox-wrapper[@id='scan-image-on-push-wrapper']//input
Retry Element Click ${project_config_save_btn} Retry Element Click ${project_config_save_btn}
Sleep 10 Sleep 10
Vulnerability Not Ready Project Hint Vulnerability Not Ready Project Hint
Sleep 2 Sleep 2
${element}= Set Variable xpath=//span[contains(@class, 'db-status-warning')] ${element}= Set Variable xpath=//span[contains(@class, 'db-status-warning')]
Wait Until Element Is Visible And Enabled ${element} Wait Until Element Is Visible And Enabled ${element}
Switch To Scanners Page Switch To Scanners Page
Retry Element Click xpath=//clr-main-container//clr-vertical-nav//a[contains(.,'Interrogation')] Retry Element Click xpath=//clr-main-container//clr-vertical-nav//a[contains(.,'Interrogation')]
Retry Wait Until Page Contains Element ${set_default_scanner} Retry Wait Until Page Contains Element ${set_default_scanner}
Should Display The Default Trivy Scanner Should Display The Default Trivy Scanner
Retry Wait Until Page Contains Element //clr-datagrid//clr-dg-row//clr-dg-cell[contains(.,'Trivy')]//span[contains(.,'Default')] Retry Wait Until Page Contains Element //clr-datagrid//clr-dg-row//clr-dg-cell[contains(.,'Trivy')]//span[contains(.,'Default')]
Trivy Is Immutable Scanner Trivy Is Immutable Scanner
Retry Element Click //clr-dg-row[contains(.,'Trivy')]//clr-radio-wrapper/label Retry Element Click //clr-dg-row[contains(.,'Trivy')]//clr-radio-wrapper/label
Retry Double Keywords When Error Retry Element Click ${scanner_action_xpath} Retry Wait Until Page Contains Element ${delete_scanner_action_xpath} Retry Double Keywords When Error Retry Element Click ${scanner_action_xpath} Retry Wait Until Page Contains Element ${delete_scanner_action_xpath}
Retry Double Keywords When Error Retry Element Click ${delete_scanner_action_xpath} Retry Wait Until Page Contains Element ${delete_scanner_confirm_btn} Retry Double Keywords When Error Retry Element Click ${delete_scanner_action_xpath} Retry Wait Until Page Contains Element ${delete_scanner_confirm_btn}
Retry Double Keywords When Error Retry Element Click ${delete_scanner_confirm_btn} Retry Wait Until Page Contains Element ${immutable_trivy_msg_xpath} Retry Double Keywords When Error Retry Element Click ${delete_scanner_confirm_btn} Retry Wait Until Page Contains Element ${immutable_trivy_msg_xpath}
Set Default Scanner Set Default Scanner
[Arguments] ${scanner_name} [Arguments] ${scanner_name}
Retry Element Click //clr-dg-row[contains(.,'${scanner_name}')]//clr-radio-wrapper/label Retry Element Click //clr-dg-row[contains(.,'${scanner_name}')]//clr-radio-wrapper/label
Retry Double Keywords When Error Retry Element Click ${scanner_set_default} Retry Wait Until Page Contains Element ${scanner_set_default_success_xpath} Retry Double Keywords When Error Retry Element Click ${scanner_set_default} Retry Wait Until Page Contains Element ${scanner_set_default_success_xpath}
Check Listed In CVE Allowlist Check Listed In CVE Allowlist
[Arguments] ${project_name} ${image} ${tag} ${cve_id} ${is_in}=Yes [Arguments] ${project_name} ${image} ${tag} ${cve_id} ${is_in}=Yes
Go Into Project ${project_name} Go Into Project ${project_name}
Go Into Repo ${project_name}/${image} Go Into Repo ${project_name}/${image}
Go Into Artifact ${tag} Go Into Artifact ${tag}
Scroll Element Into View //clr-dg-row[contains(.,'${cve_id}')] Scroll Element Into View //clr-dg-row[contains(.,'${cve_id}')]
${text}= Get Text //clr-dg-row[contains(.,'${cve_id}')]//clr-dg-cell[7] ${text}= Get Text //clr-dg-row[contains(.,'${cve_id}')]//clr-dg-cell[7]
Capture Page Screenshot Capture Page Screenshot
Log All is_in_allow_list:${text} Log All is_in_allow_list:${text}
Should Be Equal As Strings '${text}' '${is_in}' Should Be Equal As Strings '${text}' '${is_in}'

View File

@ -1,36 +1,36 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
*** Variables *** *** Variables ***
${vulnerability_edit_btn} xpath=//vulnerability-config//cron-selection//button[contains(.,'EDIT')] ${vulnerability_edit_btn} xpath=//vulnerability-config//cron-selection//button[contains(.,'EDIT')]
${vulnerability_dropdown_list} xpath=//vulnerability-config//cron-selection//select[@id='selectPolicy'] ${vulnerability_dropdown_list} xpath=//vulnerability-config//cron-selection//select[@id='selectPolicy']
${vulnerability_dropdown_list_item_none} xpath=//select[@id='selectPolicy']//option[contains(.,'None')] ${vulnerability_dropdown_list_item_none} xpath=//select[@id='selectPolicy']//option[contains(.,'None')]
${vulnerability_dropdown_list_item_custom} xpath=//select[@id='selectPolicy']//option[contains(.,'Custom')] ${vulnerability_dropdown_list_item_custom} xpath=//select[@id='selectPolicy']//option[contains(.,'Custom')]
${vulnerability_save_btn} xpath=//cron-selection//button[contains(.,'SAVE')] ${vulnerability_save_btn} xpath=//cron-selection//button[contains(.,'SAVE')]
${scan_now_button} //vulnerability-config//button[contains(.,'NOW')] ${scan_now_button} //vulnerability-config//button[contains(.,'NOW')]
${vulnerability_page} //clr-vertical-nav-group-children/a[contains(.,'Vulnerability')] ${vulnerability_page} //clr-vertical-nav-group-children/a[contains(.,'Vulnerability')]
${set_default_scanner} //button[@id='set-default'] ${set_default_scanner} //button[@id='set-default']
${scanner_action_xpath} //span[@id='action-scanner'] ${scanner_action_xpath} //span[@id='action-scanner']
${delete_scanner_action_xpath} //span[@id='delete-scanner-action'] ${delete_scanner_action_xpath} //span[@id='delete-scanner-action']
${immutable_trivy_msg_xpath} //span[contains(.,'registration Trivy is not allowed to delete as it is immutable: scanner API: delete')] ${immutable_trivy_msg_xpath} //span[contains(.,'registration Trivy is not allowed to delete as it is immutable: scanner API: delete')]
${delete_scanner_confirm_btn} xpath=//clr-modal//button[contains(.,'DELETE')] ${delete_scanner_confirm_btn} xpath=//clr-modal//button[contains(.,'DELETE')]
${scan_now_result} xpath=//div[@id="scan-result-container"] ${scan_now_result} xpath=//div[@id="scan-result-container"]
${scanner_set_default} xpath=//button[@id="set-default"] ${scanner_set_default} xpath=//button[@id="set-default"]
${scanner_set_default_success_xpath} //span[contains(.,'Successfully updated')] ${scanner_set_default_success_xpath} //span[contains(.,'Successfully updated')]
${not_scanned_icon} xpath=//span[@class[contains(.,'not-scan')]] ${not_scanned_icon} xpath=//span[@class[contains(.,'not-scan')]]

View File

@ -1,183 +1,183 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
Library SeleniumLibrary Library SeleniumLibrary
Library OperatingSystem Library OperatingSystem
*** Variables *** *** Variables ***
*** Keywords *** *** Keywords ***
Install Harbor to Test Server Install Harbor to Test Server
Log To Console \nStart Docker Daemon Log To Console \nStart Docker Daemon
Start Docker Daemon Locally Start Docker Daemon Locally
Sleep 5s Sleep 5s
${rc} ${output}= Run And Return Rc And Output docker ps ${rc} ${output}= Run And Return Rc And Output docker ps
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Log To Console ${output} Log To Console ${output}
Log To Console \nconfig harbor cfg Log To Console \nconfig harbor cfg
Config Harbor cfg http_proxy=https Config Harbor cfg http_proxy=https
Prepare Cert Prepare Cert
Log To Console \ncomplile and up harbor now Log To Console \ncomplile and up harbor now
Compile and Up Harbor With Source Code Compile and Up Harbor With Source Code
${rc} ${output}= Run And Return Rc And Output docker ps ${rc} ${output}= Run And Return Rc And Output docker ps
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Log To Console ${output} Log To Console ${output}
Generate Certificate Authority For Chrome Generate Certificate Authority For Chrome
Up Harbor Up Harbor
[Arguments] ${with_notary}=true ${with_chartmuseum}=true [Arguments] ${with_notary}=true ${with_chartmuseum}=true
${rc} ${output}= Run And Return Rc And Output make start -e NOTARYFLAG=${with_notary} CHARTFLAG=${with_chartmuseum} ${rc} ${output}= Run And Return Rc And Output make start -e NOTARYFLAG=${with_notary} CHARTFLAG=${with_chartmuseum}
Log ${rc} Log ${rc}
Log ${output} Log ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Down Harbor Down Harbor
[Arguments] ${with_notary}=true ${with_chartmuseum}=true [Arguments] ${with_notary}=true ${with_chartmuseum}=true
${rc} ${output}= Run And Return Rc And Output echo "Y" | make down -e NOTARYFLAG=${with_notary} CHARTFLAG=${with_chartmuseum} ${rc} ${output}= Run And Return Rc And Output echo "Y" | make down -e NOTARYFLAG=${with_notary} CHARTFLAG=${with_chartmuseum}
Log ${rc} Log ${rc}
Log ${output} Log ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Package Harbor Offline Package Harbor Offline
[Arguments] ${with_notary}=true ${with_chartmuseum}=true ${with_trivy}=true [Arguments] ${with_notary}=true ${with_chartmuseum}=true ${with_trivy}=true
Log To Console \nStart Docker Daemon Log To Console \nStart Docker Daemon
Start Docker Daemon Locally Start Docker Daemon Locally
Log To Console 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} CHARTFLAG=${with_chartmuseum} TRIVYFLAG=${with_trivy} HTTPPROXY= Log To Console 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} 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} 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} CHARTFLAG=${with_chartmuseum} TRIVYFLAG=${with_trivy} HTTPPROXY=
Log To Console ${rc} Log To Console ${rc}
Log To Console ${output} Log To Console ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Package Harbor Online Package Harbor Online
[Arguments] ${with_notary}=true ${with_chartmuseum}=true ${with_trivy}=true [Arguments] ${with_notary}=true ${with_chartmuseum}=true ${with_trivy}=true
Log To Console \nStart Docker Daemon Log To Console \nStart Docker Daemon
Start Docker Daemon Locally Start Docker Daemon Locally
Log To Console \nmake package_online GOBUILDTAGS="include_oss include_gcs" VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} NOTARYFLAG=${with_notary} CHARTFLAG=${with_chartmuseum} TRIVYFLAG=${with_trivy} HTTPPROXY= Log To Console \nmake package_online GOBUILDTAGS="include_oss include_gcs" VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} NOTARYFLAG=${with_notary} 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} 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} CHARTFLAG=${with_chartmuseum} TRIVYFLAG=${with_trivy} HTTPPROXY=
Log ${rc} Log ${rc}
Log ${output} Log ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Switch To LDAP Switch To LDAP
Down Harbor Down Harbor
${rc} ${output}= Run And Return Rc And Output rm -rf /data ${rc} ${output}= Run And Return Rc And Output rm -rf /data
Log ${rc} Log ${rc}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Prepare Cert Prepare Cert
Config Harbor cfg auth=ldap_auth http_proxy=https Config Harbor cfg auth=ldap_auth http_proxy=https
Prepare Prepare
Up Harbor Up Harbor
Docker Pull osixia/openldap:1.1.7 Docker Pull osixia/openldap:1.1.7
${rc} ${output}= Run And Return Rc And Output cd tests && ./ldapprepare.sh ${rc} ${output}= Run And Return Rc And Output cd tests && ./ldapprepare.sh
Log ${rc} Log ${rc}
Log ${output} Log ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker ps ${rc} ${output}= Run And Return Rc And Output docker ps
Log ${output} Log ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Generate Certificate Authority For Chrome Generate Certificate Authority For Chrome
Get Harbor CA Get Harbor CA
[Arguments] ${ip} ${cert} [Arguments] ${ip} ${cert}
Log All Start to get harbor ca: ${ip} ${cert} Log All Start to get harbor ca: ${ip} ${cert}
Run Keyword If '${http_get_ca}' == 'false' Run Keywords Run Keyword If '${http_get_ca}' == 'false' Run Keywords
... Wait Unitl Command Success cp /ca/harbor_ca.crt ${cert} ... Wait Unitl Command Success cp /ca/harbor_ca.crt ${cert}
... AND Return From Keyword ... AND Return From Keyword
${rc} ${output}= Run And Return Rc And Output rm -rf ~/.docker/ ${rc} ${output}= Run And Return Rc And Output rm -rf ~/.docker/
Log All ${rc} Log All ${rc}
${rc} ${output}= Run And Return Rc and Output curl -o ${cert} -s -k -X GET -u 'admin:Harbor12345' 'https://${ip}/api/v2.0/systeminfo/getcert' ${rc} ${output}= Run And Return Rc and Output curl -o ${cert} -s -k -X GET -u 'admin:Harbor12345' 'https://${ip}/api/v2.0/systeminfo/getcert'
Log All ${output} Log All ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Enable Notary Client Enable Notary Client
${rc} ${output}= Run And Return Rc And Output rm -rf ~/.docker/ ${rc} ${output}= Run And Return Rc And Output rm -rf ~/.docker/
Log ${rc} Log ${rc}
${rc} ${output}= Run And Return Rc and Output curl -o /notary_ca.crt -s -k -X GET -u 'admin:Harbor12345' 'https://${ip}/api/v2.0/systeminfo/getcert' ${rc} ${output}= Run And Return Rc and Output curl -o /notary_ca.crt -s -k -X GET -u 'admin:Harbor12345' 'https://${ip}/api/v2.0/systeminfo/getcert'
Log ${output} Log ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Notary Remove Signature Notary Remove Signature
[Arguments] ${ip} ${project} ${image} ${tag} ${user} ${pwd} [Arguments] ${ip} ${project} ${image} ${tag} ${user} ${pwd}
${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/notary-util.sh remove ${ip} ${project} ${image} ${tag} ${notaryServerEndpoint} ${user} ${pwd} ${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/notary-util.sh remove ${ip} ${project} ${image} ${tag} ${notaryServerEndpoint} ${user} ${pwd}
Log To Console ${output} Log To Console ${output}
Log ${output} Log ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Notary Key Rotate Notary Key Rotate
[Arguments] ${ip} ${project} ${image} ${tag} ${user} ${pwd} [Arguments] ${ip} ${project} ${image} ${tag} ${user} ${pwd}
${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/notary-util.sh key_rotate ${ip} ${project} ${image} ${tag} ${notaryServerEndpoint} ${user} ${pwd} ${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/notary-util.sh key_rotate ${ip} ${project} ${image} ${tag} ${notaryServerEndpoint} ${user} ${pwd}
Log To Console ${output} Log To Console ${output}
Log ${output} Log ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Prepare Prepare
[Arguments] ${with_notary}=true ${with_chartmuseum}=true [Arguments] ${with_notary}=true ${with_chartmuseum}=true
${rc} ${output}= Run And Return Rc And Output make prepare -e NOTARYFLAG=${with_notary} CHARTFLAG=${with_chartmuseum} ${rc} ${output}= Run And Return Rc And Output make prepare -e NOTARYFLAG=${with_notary} CHARTFLAG=${with_chartmuseum}
Log ${rc} Log ${rc}
Log ${output} Log ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Config Harbor cfg Config Harbor cfg
# Will change the IP and Protocol in the harbor.cfg # Will change the IP and Protocol in the harbor.cfg
[Arguments] ${http_proxy}=http ${auth}=db_auth [Arguments] ${http_proxy}=http ${auth}=db_auth
${rc} ${output}= Run And Return Rc And Output ip addr s eth0 |grep "inet "|awk '{print $2}' |awk -F "/" '{print $1}' ${rc} ${output}= Run And Return Rc And Output ip addr s eth0 |grep "inet "|awk '{print $2}' |awk -F "/" '{print $1}'
${rc}= Run And Return Rc sed "s/^hostname = .*/hostname = ${output}/g" -i ./make/harbor.cfg ${rc}= Run And Return Rc sed "s/^hostname = .*/hostname = ${output}/g" -i ./make/harbor.cfg
Log ${rc} Log ${rc}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc sed "s/^ui_url_protocol = .*/ui_url_protocol = ${http_proxy}/g" -i ./make/harbor.cfg ${rc}= Run And Return Rc sed "s/^ui_url_protocol = .*/ui_url_protocol = ${http_proxy}/g" -i ./make/harbor.cfg
Log ${rc} Log ${rc}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc sed "s/^auth_mode = .*/auth_mode = ${auth}/g" -i ./make/harbor.cfg ${rc}= Run And Return Rc sed "s/^auth_mode = .*/auth_mode = ${auth}/g" -i ./make/harbor.cfg
Log ${rc} Log ${rc}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
${out}= Run cat ./make/harbor.cfg ${out}= Run cat ./make/harbor.cfg
Log ${out} Log ${out}
Prepare Cert Prepare Cert
# Will change the IP and Protocol in the harbor.cfg # Will change the IP and Protocol in the harbor.cfg
${rc} ${ip}= Run And Return Rc And Output ip addr s eth0 |grep "inet "|awk '{print $2}' |awk -F "/" '{print $1}' ${rc} ${ip}= Run And Return Rc And Output ip addr s eth0 |grep "inet "|awk '{print $2}' |awk -F "/" '{print $1}'
Log ${ip} Log ${ip}
${rc}= Run And Return Rc sed "s/^IP=.*/IP=${ip}/g" -i ./tests/generateCerts.sh ${rc}= Run And Return Rc sed "s/^IP=.*/IP=${ip}/g" -i ./tests/generateCerts.sh
Log ${rc} Log ${rc}
${out}= Run cat ./tests/generateCerts.sh ${out}= Run cat ./tests/generateCerts.sh
Log ${out} Log ${out}
${rc} ${output}= Run And Return Rc And Output ./tests/generateCerts.sh ${rc} ${output}= Run And Return Rc And Output ./tests/generateCerts.sh
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Compile and Up Harbor With Source Code Compile and Up Harbor With Source Code
[Arguments] ${with_notary}=true ${with_chartmuseum}=true [Arguments] ${with_notary}=true ${with_chartmuseum}=true
${rc} ${output}= Run And Return Rc And Output make install swagger_client NOTARYFLAG=${with_notary} CHARTFLAG=${with_chartmuseum} HTTPPROXY= ${rc} ${output}= Run And Return Rc And Output make install swagger_client NOTARYFLAG=${with_notary} CHARTFLAG=${with_chartmuseum} HTTPPROXY=
Log ${output} Log ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Sleep 20 Sleep 20
Wait for Harbor Ready Wait for Harbor Ready
[Arguments] ${protocol} ${HARBOR_IP} [Arguments] ${protocol} ${HARBOR_IP}
Log To Console Waiting for Harbor to Come Up... Log To Console Waiting for Harbor to Come Up...
FOR ${i} IN RANGE 20 FOR ${i} IN RANGE 20
${out}= Run curl -k ${protocol}://${HARBOR_IP} ${out}= Run curl -k ${protocol}://${HARBOR_IP}
Log ${out} Log ${out}
${status}= Run Keyword And Return Status Should Not Contain ${out} 502 Bad Gateway ${status}= Run Keyword And Return Status Should Not Contain ${out} 502 Bad Gateway
${status}= Run Keyword If ${status} Run Keyword And Return Status Should Not Contain ${out} Connection refused ${status}= Run Keyword If ${status} Run Keyword And Return Status Should Not Contain ${out} Connection refused
${status}= Run Keyword If ${status} Run Keyword And Return Status Should Contain ${out} <title>Harbor</title> ${status}= Run Keyword If ${status} Run Keyword And Return Status Should Contain ${out} <title>Harbor</title>
Return From Keyword If ${status} ${HARBOR_IP} Return From Keyword If ${status} ${HARBOR_IP}
Sleep 30s Sleep 30s
END END
Fail Harbor failed to come up properly! Fail Harbor failed to come up properly!
Get Harbor Version Get Harbor Version
${rc} ${output}= Run And Return Rc And Output curl -k -X GET --header 'Accept: application/json' 'https://${ip}/api/v2.0/systeminfo'|grep -i harbor_version ${rc} ${output}= Run And Return Rc And Output curl -k -X GET --header 'Accept: application/json' 'https://${ip}/api/v2.0/systeminfo'|grep -i harbor_version
Log To Console ${output} Log To Console ${output}

View File

@ -1,43 +1,43 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides helper functions for docker operations Documentation This resource provides helper functions for docker operations
Library OperatingSystem Library OperatingSystem
Library Process Library Process
*** Keywords *** *** Keywords ***
Prepare Helm Plugin Prepare Helm Plugin
Wait Unitl Command Success helm init --stable-repo-url https://charts.helm.sh/stable --client-only Wait Unitl Command Success helm init --stable-repo-url https://charts.helm.sh/stable --client-only
Wait Unitl Command Success helm plugin install https://github.com/chartmuseum/helm-push Wait Unitl Command Success helm plugin install https://github.com/chartmuseum/helm-push
Wait Unitl Command Success helm3 plugin install https://github.com/chartmuseum/helm-push Wait Unitl Command Success helm3 plugin install https://github.com/chartmuseum/helm-push
Helm Repo Add Helm Repo Add
[Arguments] ${harbor_url} ${user} ${pwd} ${project_name}=library ${helm_repo_name}=myrepo [Arguments] ${harbor_url} ${user} ${pwd} ${project_name}=library ${helm_repo_name}=myrepo
${rc} ${output}= Run And Return Rc And Output helm repo remove ${project_name} ${rc} ${output}= Run And Return Rc And Output helm repo remove ${project_name}
Log To Console ${output} Log To Console ${output}
Wait Unitl Command Success helm repo add --ca-file /ca/ca.crt --username=${user} --password=${pwd} ${helm_repo_name} ${harbor_url}/chartrepo/${project_name} Wait Unitl Command Success helm repo add --ca-file /ca/ca.crt --username=${user} --password=${pwd} ${helm_repo_name} ${harbor_url}/chartrepo/${project_name}
Helm Repo Push Helm Repo Push
[Arguments] ${user} ${pwd} ${chart_filename} ${helm_repo_name}=myrepo ${helm_cmd}=helm [Arguments] ${user} ${pwd} ${chart_filename} ${helm_repo_name}=myrepo ${helm_cmd}=helm
${current_dir}= Run pwd ${current_dir}= Run pwd
Run cd ${current_dir} Run cd ${current_dir}
Run wget ${harbor_chart_file_url} Run wget ${harbor_chart_file_url}
Wait Unitl Command Success ${helm_cmd} push --ca-file=/ca/ca.crt --username=${user} --password=${pwd} ${chart_filename} ${helm_repo_name} Wait Unitl Command Success ${helm_cmd} push --ca-file=/ca/ca.crt --username=${user} --password=${pwd} ${chart_filename} ${helm_repo_name}
Helm Chart Push Helm Chart Push
[Arguments] ${ip} ${user} ${pwd} ${chart_file} ${archive} ${project} ${repo_name} ${verion} [Arguments] ${ip} ${user} ${pwd} ${chart_file} ${archive} ${project} ${repo_name} ${verion}
${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/helm_push_chart.sh ${ip} ${user} ${pwd} ${chart_file} ${archive} ${project} ${repo_name} ${verion} ${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/helm_push_chart.sh ${ip} ${user} ${pwd} ${chart_file} ${archive} ${project} ${repo_name} ${verion}
Log ${output} Log ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0

View File

@ -1,89 +1,89 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource Util.robot Resource Util.robot
*** Variables *** *** Variables ***
${SSH_USER} root ${SSH_USER} root
*** Keywords *** *** Keywords ***
Prepare Test Tools Prepare Test Tools
Wait Unitl Command Success tar zxvf /usr/local/bin/tools.tar.gz -C /usr/local/bin/ Wait Unitl Command Success tar zxvf /usr/local/bin/tools.tar.gz -C /usr/local/bin/
Get And Setup Harbor CA Get And Setup Harbor CA
[Arguments] ${ip} ${HARBOR_PASSWORD} ${ca_setup_keyword} ${ip1}==${EMPTY} [Arguments] ${ip} ${HARBOR_PASSWORD} ${ca_setup_keyword} ${ip1}==${EMPTY}
Run Keyword If '${ip1}' != '${EMPTY}' Run Keywords Run Keyword If '${ip1}' != '${EMPTY}' Run Keywords
... Get Harbor CA ${ip1} /drone/harbor_ca1.crt ... Get Harbor CA ${ip1} /drone/harbor_ca1.crt
... AND Run Keyword ${ca_setup_keyword} ${ip1} ${HARBOR_PASSWORD} /drone/harbor_ca1.crt ... AND Run Keyword ${ca_setup_keyword} ${ip1} ${HARBOR_PASSWORD} /drone/harbor_ca1.crt
Get Harbor CA ${ip} /drone/harbor_ca.crt Get Harbor CA ${ip} /drone/harbor_ca.crt
Log To Console ${ca_setup_keyword} ... Log To Console ${ca_setup_keyword} ...
Run Keyword ${ca_setup_keyword} ${ip} ${HARBOR_PASSWORD} /drone/harbor_ca.crt Run Keyword ${ca_setup_keyword} ${ip} ${HARBOR_PASSWORD} /drone/harbor_ca.crt
Nightly Test Setup In Photon Nightly Test Setup In Photon
[Arguments] ${ip} ${HARBOR_PASSWORD} ${ip1}==${EMPTY} [Arguments] ${ip} ${HARBOR_PASSWORD} ${ip1}==${EMPTY}
Get And Setup Harbor CA ${ip} ${HARBOR_PASSWORD} CA Setup In Photon ip1=${ip1} Get And Setup Harbor CA ${ip} ${HARBOR_PASSWORD} CA Setup In Photon ip1=${ip1}
Prepare Test Tools Prepare Test Tools
Log To Console Start Docker Daemon Locally ... Log To Console Start Docker Daemon Locally ...
Start Docker Daemon Locally Start Docker Daemon Locally
Log To Console Start Containerd Daemon Locally ... Log To Console Start Containerd Daemon Locally ...
Start Containerd Daemon Locally Start Containerd Daemon Locally
Log To Console wget mariadb ... Log To Console wget mariadb ...
Run wget ${prometheus_chart_file_url} Run wget ${prometheus_chart_file_url}
Prepare Helm Plugin Prepare Helm Plugin
#Prepare docker image for push special image keyword in replication test #Prepare docker image for push special image keyword in replication test
Run Keyword If '${DOCKER_USER}' != '${EMPTY}' Docker Login "" ${DOCKER_USER} ${DOCKER_PWD} Run Keyword If '${DOCKER_USER}' != '${EMPTY}' Docker Login "" ${DOCKER_USER} ${DOCKER_PWD}
Nightly Test Setup In Ubuntu Nightly Test Setup In Ubuntu
[Arguments] ${ip} ${HARBOR_PASSWORD} ${ip1}==${EMPTY} [Arguments] ${ip} ${HARBOR_PASSWORD} ${ip1}==${EMPTY}
Get And Setup Harbor CA ${ip} ${HARBOR_PASSWORD} CA Setup In ubuntu ip1=${ip1} Get And Setup Harbor CA ${ip} ${HARBOR_PASSWORD} CA Setup In ubuntu ip1=${ip1}
Prepare Test Tools Prepare Test Tools
Log To Console Start Docker Daemon Locally ... Log To Console Start Docker Daemon Locally ...
Run Keyword Start Docker Daemon Locally Run Keyword Start Docker Daemon Locally
Log To Console Start Containerd Daemon Locally ... Log To Console Start Containerd Daemon Locally ...
Run Keyword Start Containerd Daemon Locally Run Keyword Start Containerd Daemon Locally
Prepare Helm Plugin Prepare Helm Plugin
Run Keyword If '${DOCKER_USER}' != '${EMPTY}' Docker Login "" ${DOCKER_USER} ${DOCKER_PWD} Run Keyword If '${DOCKER_USER}' != '${EMPTY}' Docker Login "" ${DOCKER_USER} ${DOCKER_PWD}
CA Setup In ubuntu CA Setup In ubuntu
[Arguments] ${ip} ${HARBOR_PASSWORD} ${cert} [Arguments] ${ip} ${HARBOR_PASSWORD} ${cert}
Prepare Docker Cert In Ubuntu ${ip} ${cert} Prepare Docker Cert In Ubuntu ${ip} ${cert}
#Generate Certificate Authority For Chrome ${HARBOR_PASSWORD} #Generate Certificate Authority For Chrome ${HARBOR_PASSWORD}
CA Setup In Photon CA Setup In Photon
[Arguments] ${ip} ${HARBOR_PASSWORD} ${cert} [Arguments] ${ip} ${HARBOR_PASSWORD} ${cert}
Prepare Docker Cert In Photon ${ip} ${cert} Prepare Docker Cert In Photon ${ip} ${cert}
Collect Nightly Logs Collect Nightly Logs
[Arguments] ${ip} ${SSH_PWD} ${ip1}==${EMPTY} [Arguments] ${ip} ${SSH_PWD} ${ip1}==${EMPTY}
Run Keyword Collect Logs ${ip} ${SSH_PWD} Run Keyword Collect Logs ${ip} ${SSH_PWD}
Run Keyword If '${ip1}' != '${EMPTY}' Collect Logs ${ip1} ${SSH_PWD} Run Keyword If '${ip1}' != '${EMPTY}' Collect Logs ${ip1} ${SSH_PWD}
Collect Logs Collect Logs
[Arguments] ${ip} ${SSH_PWD} [Arguments] ${ip} ${SSH_PWD}
Open Connection ${ip} Open Connection ${ip}
Login ${SSH_USER} ${SSH_PWD} Login ${SSH_USER} ${SSH_PWD}
SSHLibrary.Get File /var/log/harbor/ui.log SSHLibrary.Get File /var/log/harbor/ui.log
SSHLibrary.Get File /var/log/harbor/registry.log SSHLibrary.Get File /var/log/harbor/registry.log
SSHLibrary.Get File /var/log/harbor/proxy.log SSHLibrary.Get File /var/log/harbor/proxy.log
SSHLibrary.Get File /var/log/harbor/adminserver.log SSHLibrary.Get File /var/log/harbor/adminserver.log
SSHLibrary.Get File /var/log/harbor/jobservice.log SSHLibrary.Get File /var/log/harbor/jobservice.log
SSHLibrary.Get File /var/log/harbor/postgresql.log SSHLibrary.Get File /var/log/harbor/postgresql.log
SSHLibrary.Get File /var/log/harbor/notary-server.log SSHLibrary.Get File /var/log/harbor/notary-server.log
SSHLibrary.Get File /var/log/harbor/notary-signer.log SSHLibrary.Get File /var/log/harbor/notary-signer.log
SSHLibrary.Get File /var/log/harbor/chartmuseum.log SSHLibrary.Get File /var/log/harbor/chartmuseum.log
SSHLibrary.Get File /var/log/harbor/registryctl.log SSHLibrary.Get File /var/log/harbor/registryctl.log
Run rename 's/^/${ip}/' *.log Run rename 's/^/${ip}/' *.log
Close All Connections Close All Connections

View File

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

View File

@ -1,97 +1,97 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides any keywords related to Unified OVA Documentation This resource provides any keywords related to Unified OVA
*** Variables *** *** Variables ***
${ova_root_pwd} ova-test-root-pwd ${ova_root_pwd} ova-test-root-pwd
${ova_appliance_options} --prop:root_pwd=${ova_root_pwd} --prop:permit_root_login=true ${ova_appliance_options} --prop:root_pwd=${ova_root_pwd} --prop:permit_root_login=true
${ova_target_vm_name} harbor-unified-ova-integration-test ${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 ${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_ip0} 10.17.109.207
${ova_network_netmask0} 255.255.255.0 ${ova_network_netmask0} 255.255.255.0
${ova_network_gateway} 10.17.109.253 ${ova_network_gateway} 10.17.109.253
${ova_network_dns} 10.118.81.1 ${ova_network_dns} 10.118.81.1
${ova_network_searchpath} eng.vmware.com ${ova_network_searchpath} eng.vmware.com
${ova_network_domain} mrburns ${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_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_admin_password} harbor-admin-passwd
${ova_harbor_db_password} harbor-db-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_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} ${ovftool_options} ${ova_appliance_options} ${ova_service_options}
#${ova_options_with_network} ${ova_options} ${ova_network_options} #${ova_options_with_network} ${ova_options} ${ova_network_options}
${tls_not_disabled} False ${tls_not_disabled} False
*** Keywords *** *** Keywords ***
# Requires vc credential for govc # Requires vc credential for govc
Deploy Harbor-OVA To Test Server Deploy Harbor-OVA To Test Server
[Arguments] ${dhcp} ${protocol} ${build} ${user} ${password} ${ova_path} ${host} ${datastore} ${cluster} ${datacenter} [Arguments] ${dhcp} ${protocol} ${build} ${user} ${password} ${ova_path} ${host} ${datastore} ${cluster} ${datacenter}
Log To Console \nCleanup environment... 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 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} 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... 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}' 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}' ... 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}' ${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}' ... 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 Contain ${out} Received IP address:
Should Not Contain ${out} None 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}= Run GOVC_URL=${host} GOVC_USERNAME=${user} GOVC_PASSWORD=${password} GOVC_INSECURE=1 govc ls /ha-datacenter/host/cls/
${out}= Split To Lines ${out} ${out}= Split To Lines ${out}
${idx}= Set Variable 1 ${idx}= Set Variable 1
:FOR ${line} IN @{out} :FOR ${line} IN @{out}
\ Continue For Loop If '${line}' == '/ha-datacenter/host/cls/Resources' \ Continue For Loop If '${line}' == '/ha-datacenter/host/cls/Resources'
\ ${ip}= Fetch From Right ${line} / \ ${ip}= Fetch From Right ${line} /
\ Set Suite Variable ${esx${idx}-ip} ${ip} \ Set Suite Variable ${esx${idx}-ip} ${ip}
\ ${idx}= Evaluate ${idx}+1 \ ${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 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 ${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} Set Environment Variable HARBOR_IP ${ip}
Log To Console \nHarbor IP: %{HARBOR_IP} Log To Console \nHarbor IP: %{HARBOR_IP}
Wait for Harbor Ready ${protocol} %{HARBOR_IP} Wait for Harbor Ready ${protocol} %{HARBOR_IP}
[Return] %{HARBOR_IP} [Return] %{HARBOR_IP}
# Requires vc credential for govc # Requires vc credential for govc
Cleanup Harbor-OVA On Test Server Cleanup Harbor-OVA On Test Server
[Arguments] ${url}=%{GOVC_URL} ${username}=%{GOVC_USERNAME} ${password}=%{GOVC_PASSWORD} [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} ${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} Log ${output}
Should Be Equal As Integers ${rc} 0 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} 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 Log To Console \nUnified-OVA deployment is cleaned up on test server
Build Unified OVA Build Unified OVA
[Arguments] ${user}=%{TEST_USERNAME} ${password}=%{TEST_PASSWORD} ${host}=%{TEST_URL} [Arguments] ${user}=%{TEST_USERNAME} ${password}=%{TEST_PASSWORD} ${host}=%{TEST_URL}
Log To Console \nStarting to build Unified OVA... Log To Console \nStarting to build Unified OVA...
Log To Console \nRemove stale local OVA artifacts Log To Console \nRemove stale local OVA artifacts
Run Remove OVA Artifacts Locally Run Remove OVA Artifacts Locally
${out}= Run PACKER_ESX_HOST=${host} PACKER_USER=${user} PACKER_PASSWORD=${password} make ova-release ${out}= Run PACKER_ESX_HOST=${host} PACKER_USER=${user} PACKER_PASSWORD=${password} make ova-release
Log ${out} Log ${out}
@{out}= Split To Lines ${out} @{out}= Split To Lines ${out}
Should Not Contain @{out}[-1] Error Should Not Contain @{out}[-1] Error
Log To Console \nUnified OVA is built successfully Log To Console \nUnified OVA is built successfully

View File

@ -1,49 +1,49 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource provides helper functions for docker operations Documentation This resource provides helper functions for docker operations
Resource Util.robot Resource Util.robot
*** Keywords *** *** Keywords ***
Start Selenium Standalone Server Locally Start Selenium Standalone Server Locally
OperatingSystem.File Should Exist /go/selenium-server-standalone-3.4.0.jar OperatingSystem.File Should Exist /go/selenium-server-standalone-3.4.0.jar
${handle}= Start Process java -jar /go/selenium-server-standalone-3.4.0.jar >./selenium-local.log 2>&1 shell=True ${handle}= Start Process java -jar /go/selenium-server-standalone-3.4.0.jar >./selenium-local.log 2>&1 shell=True
Process Should Be Running ${handle} Process Should Be Running ${handle}
Sleep 10s Sleep 10s
[Return] ${handle} [Return] ${handle}
Init Chrome Driver Init Chrome Driver
Run pkill chromedriver Run pkill chromedriver
Run pkill chrome Run pkill chrome
${chrome options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys ${chrome options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys
${capabilities}= Evaluate sys.modules['selenium.webdriver'].DesiredCapabilities.CHROME sys ${capabilities}= Evaluate sys.modules['selenium.webdriver'].DesiredCapabilities.CHROME sys
Set To Dictionary ${capabilities} acceptInsecureCerts ${True} Set To Dictionary ${capabilities} acceptInsecureCerts ${True}
Call Method ${chrome options} add_argument --headless Call Method ${chrome options} add_argument --headless
Call Method ${chrome options} add_argument --disable-gpu Call Method ${chrome options} add_argument --disable-gpu
Call Method ${chrome options} add_argument --start-maximized Call Method ${chrome options} add_argument --start-maximized
Call Method ${chrome options} add_argument --no-sandbox Call Method ${chrome options} add_argument --no-sandbox
Call Method ${chrome options} add_argument --window-size\=1600,900 Call Method ${chrome options} add_argument --window-size\=1600,900
${chrome options.binary_location} Set Variable /usr/bin/google-chrome ${chrome options.binary_location} Set Variable /usr/bin/google-chrome
#Create Webdriver Chrome Chrome_headless chrome_options=${chrome options} desired_capabilities=${capabilities} #Create Webdriver Chrome Chrome_headless chrome_options=${chrome options} desired_capabilities=${capabilities}
FOR ${n} IN RANGE 1 6 FOR ${n} IN RANGE 1 6
Log To Console Trying Create Webdriver ${n} times ... Log To Console Trying Create Webdriver ${n} times ...
${out} Run Keyword And Ignore Error Create Webdriver Chrome Chrome_headless chrome_options=${chrome options} desired_capabilities=${capabilities} ${out} Run Keyword And Ignore Error Create Webdriver Chrome Chrome_headless chrome_options=${chrome options} desired_capabilities=${capabilities}
Log To Console Return value is ${out[0]} Log To Console Return value is ${out[0]}
Exit For Loop If '${out[0]}'=='PASS' Exit For Loop If '${out[0]}'=='PASS'
Sleep 2 Sleep 2
END END
Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot
Should Be Equal As Strings '${out[0]}' 'PASS' Should Be Equal As Strings '${out[0]}' 'PASS'
Sleep 5 Sleep 5

View File

@ -1,28 +1,28 @@
*** Settings *** *** Settings ***
Documentation Harbor BATs Documentation Harbor BATs
Resource ../Util.robot Resource ../Util.robot
*** Variables *** *** Variables ***
${HARBOR_URL} https://${ip} ${HARBOR_URL} https://${ip}
${HARBOR_ADMIN} admin ${HARBOR_ADMIN} admin
${HARBOR_PASSWORD} Harbor12345 ${HARBOR_PASSWORD} Harbor12345
*** Test Cases *** *** Test Cases ***
# For Windows # For Windows
Test Case - Example For Windows Test Case - Example For Windows
Open Browser https://localhost:4200 Chrome Open Browser https://localhost:4200 Chrome
Retry Element Click xpath=//clr-dropdown/button Retry Element Click xpath=//clr-dropdown/button
Retry Element Click xpath=//clr-dropdown/clr-dropdown-menu/a[contains(., 'English')] Retry Element Click xpath=//clr-dropdown/clr-dropdown-menu/a[contains(., 'English')]
# your case starts ===================================== # your case starts =====================================
# your case ends ====================================== # your case ends ======================================
Close Browser Close Browser
# For Linux # For Linux
Test Case - Example For Linux Test Case - Example For Linux
init chrome driver init chrome driver
# your case starts ===================================== # your case starts =====================================
# your case ends ====================================== # your case ends ======================================
Close Browser Close Browser

View File

@ -1,401 +1,401 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource wrap test case body Documentation This resource wrap test case body
*** Variables *** *** Variables ***
*** Keywords *** *** Keywords ***
Body Of Manage project publicity Body Of Manage project publicity
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} user007 Test1@34 Sign In Harbor ${HARBOR_URL} user007 Test1@34
Create An New Project And Go Into Project project${d} public=true Create An New Project And Go Into Project project${d} public=true
Push image ${ip} user007 Test1@34 project${d} hello-world:latest Push image ${ip} user007 Test1@34 project${d} hello-world:latest
Pull image ${ip} user008 Test1@34 project${d} hello-world:latest Pull image ${ip} user008 Test1@34 project${d} hello-world:latest
Logout Harbor Logout Harbor
Sign In Harbor ${HARBOR_URL} user008 Test1@34 Sign In Harbor ${HARBOR_URL} user008 Test1@34
Project Should Display project${d} Project Should Display project${d}
Search Private Projects Search Private Projects
Project Should Not Display project${d} Project Should Not Display project${d}
Logout Harbor Logout Harbor
Sign In Harbor ${HARBOR_URL} user007 Test1@34 Sign In Harbor ${HARBOR_URL} user007 Test1@34
Make Project Private project${d} Make Project Private project${d}
Logout Harbor Logout Harbor
Sign In Harbor ${HARBOR_URL} user008 Test1@34 Sign In Harbor ${HARBOR_URL} user008 Test1@34
Project Should Not Display project${d} Project Should Not Display project${d}
Cannot Pull Image ${ip} user008 Test1@34 project${d} hello-world:latest err_msg=unauthorized to access repository Cannot Pull Image ${ip} user008 Test1@34 project${d} hello-world:latest err_msg=unauthorized to access repository
Logout Harbor Logout Harbor
Sign In Harbor ${HARBOR_URL} user007 Test1@34 Sign In Harbor ${HARBOR_URL} user007 Test1@34
Make Project Public project${d} Make Project Public project${d}
Logout Harbor Logout Harbor
Sign In Harbor ${HARBOR_URL} user008 Test1@34 Sign In Harbor ${HARBOR_URL} user008 Test1@34
Project Should Display project${d} Project Should Display project${d}
Close Browser Close Browser
Body Of Scan A Tag In The Repo Body Of Scan A Tag In The Repo
[Arguments] ${image_argument} ${tag_argument} ${is_no_vulerabilty}=${false} [Arguments] ${image_argument} ${tag_argument} ${is_no_vulerabilty}=${false}
Init Chrome Driver Init Chrome Driver
${d}= get current date result_format=%m%s ${d}= get current date result_format=%m%s
Sign In Harbor ${HARBOR_URL} user023 Test1@34 Sign In Harbor ${HARBOR_URL} user023 Test1@34
Create An New Project And Go Into Project project${d} Create An New Project And Go Into Project project${d}
Push Image ${ip} user023 Test1@34 project${d} ${image_argument}:${tag_argument} Push Image ${ip} user023 Test1@34 project${d} ${image_argument}:${tag_argument}
Go Into Project project${d} Go Into Project project${d}
Go Into Repo project${d}/${image_argument} Go Into Repo project${d}/${image_argument}
Scan Repo ${tag_argument} Succeed Scan Repo ${tag_argument} Succeed
Scan Result Should Display In List Row ${tag_argument} is_no_vulerabilty=${is_no_vulerabilty} Scan Result Should Display In List Row ${tag_argument} is_no_vulerabilty=${is_no_vulerabilty}
Pull Image ${ip} user023 Test1@34 project${d} ${image_argument} ${tag_argument} Pull Image ${ip} user023 Test1@34 project${d} ${image_argument} ${tag_argument}
# Edit Repo Info # Edit Repo Info
Close Browser Close Browser
Body Of Scan Image With Empty Vul Body Of Scan Image With Empty Vul
[Arguments] ${image_argument} ${tag_argument} [Arguments] ${image_argument} ${tag_argument}
Init Chrome Driver Init Chrome Driver
${tag}= Set Variable ${tag_argument} ${tag}= Set Variable ${tag_argument}
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library ${image_argument}:${tag_argument} Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library ${image_argument}:${tag_argument}
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Go Into Project library Go Into Project library
Go Into Repo ${image_argument} Go Into Repo ${image_argument}
Scan Repo ${tag} Succeed Scan Repo ${tag} Succeed
Move To Summary Chart Move To Summary Chart
Scan Result Should Display In List Row ${tag} is_no_vulerabilty=${true} Scan Result Should Display In List Row ${tag} is_no_vulerabilty=${true}
Close Browser Close Browser
Body Of Manual Scan All Body Of Manual Scan All
[Arguments] @{vulnerability_levels} [Arguments] @{vulnerability_levels}
Init Chrome Driver Init Chrome Driver
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library redis Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library redis
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Vulnerability Page Switch To Vulnerability Page
Trigger Scan Now And Wait Until The Result Appears Trigger Scan Now And Wait Until The Result Appears
Navigate To Projects Navigate To Projects
Go Into Project library Go Into Project library
Go Into Repo redis Go Into Repo redis
Scan Result Should Display In List Row latest Scan Result Should Display In List Row latest
View Repo Scan Details @{vulnerability_levels} View Repo Scan Details @{vulnerability_levels}
Close Browser Close Browser
Body Of View Scan Results Body Of View Scan Results
[Arguments] @{vulnerability_levels} [Arguments] @{vulnerability_levels}
Init Chrome Driver Init Chrome Driver
${d}= get current date result_format=%m%s ${d}= get current date result_format=%m%s
Sign In Harbor ${HARBOR_URL} user025 Test1@34 Sign In Harbor ${HARBOR_URL} user025 Test1@34
Create An New Project And Go Into Project project${d} Create An New Project And Go Into Project project${d}
Push Image ${ip} user025 Test1@34 project${d} tomcat Push Image ${ip} user025 Test1@34 project${d} tomcat
Go Into Project project${d} Go Into Project project${d}
Go Into Repo project${d}/tomcat Go Into Repo project${d}/tomcat
Scan Repo latest Succeed Scan Repo latest Succeed
Scan Result Should Display In List Row latest Scan Result Should Display In List Row latest
View Repo Scan Details @{vulnerability_levels} View Repo Scan Details @{vulnerability_levels}
Close Browser Close Browser
Body Of Scan Image On Push Body Of Scan Image On Push
[Arguments] @{vulnerability_levels} [Arguments] @{vulnerability_levels}
Init Chrome Driver Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Go Into Project library Go Into Project library
Goto Project Config Goto Project Config
Enable Scan On Push Enable Scan On Push
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library memcached Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library memcached
Navigate To Projects Navigate To Projects
Go Into Project library Go Into Project library
Go Into Repo memcached Go Into Repo memcached
Scan Result Should Display In List Row latest Scan Result Should Display In List Row latest
View Repo Scan Details @{vulnerability_levels} View Repo Scan Details @{vulnerability_levels}
Close Browser Close Browser
Body Of List Helm Charts Body Of List Helm Charts
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} user027 Test1@34 Sign In Harbor ${HARBOR_URL} user027 Test1@34
Create An New Project And Go Into Project project${d} Create An New Project And Go Into Project project${d}
Switch To Project Charts Switch To Project Charts
Upload Chart files Upload Chart files
Go Into Chart Version ${prometheus_chart_name} Go Into Chart Version ${prometheus_chart_name}
Retry Wait Until Page Contains ${prometheus_chart_version} Retry Wait Until Page Contains ${prometheus_chart_version}
Go Into Chart Detail ${prometheus_chart_version} Go Into Chart Detail ${prometheus_chart_version}
# Summary tab # Summary tab
Retry Wait Until Page Contains Element ${summary_markdown} Retry Wait Until Page Contains Element ${summary_markdown}
Retry Wait Until Page Contains Element ${summary_container} Retry Wait Until Page Contains Element ${summary_container}
# Dependency tab # Dependency tab
Retry Double Keywords When Error Retry Element Click xpath=${detail_dependency} Retry Wait Until Page Contains Element ${dependency_content} Retry Double Keywords When Error Retry Element Click xpath=${detail_dependency} Retry Wait Until Page Contains Element ${dependency_content}
# Values tab # Values tab
Retry Double Keywords When Error Retry Element Click xpath=${detail_value} Retry Wait Until Page Contains Element ${value_content} Retry Double Keywords When Error Retry Element Click xpath=${detail_value} Retry Wait Until Page Contains Element ${value_content}
Go Into Project project${d} has_image=${false} Go Into Project project${d} has_image=${false}
Switch To Project Charts Switch To Project Charts
Multi-delete Chart Files ${prometheus_chart_name} ${harbor_chart_name} Multi-delete Chart Files ${prometheus_chart_name} ${harbor_chart_name}
Close Browser Close Browser
Body Of Push Signed Image Body Of Push Signed Image
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
${user}= Set Variable user010 ${user}= Set Variable user010
${pwd}= Set Variable Test1@34 ${pwd}= Set Variable Test1@34
Sign In Harbor ${HARBOR_URL} ${user} ${pwd} Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
Create An New Project And Go Into Project project${d} Create An New Project And Go Into Project project${d}
Body Of Admin Push Signed Image project${d} tomcat latest ${user} ${pwd} Body Of Admin Push Signed Image project${d} tomcat latest ${user} ${pwd}
Body Of Admin Push Signed Image project${d} alpine latest ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Body Of Admin Push Signed Image project${d} alpine latest ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Close Browser Close Browser
Body Of Admin Push Signed Image Body Of Admin Push Signed Image
[Arguments] ${project} ${image} ${tag} ${user} ${pwd} ${with_remove}=${false} [Arguments] ${project} ${image} ${tag} ${user} ${pwd} ${with_remove}=${false}
Enable Notary Client Enable Notary Client
Docker Pull ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image} Docker Pull ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image}
${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/notary-push-image.sh ${ip} ${project} ${image} ${tag} ${notaryServerEndpoint} ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image}:${tag} ${user} ${pwd} ${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/notary-push-image.sh ${ip} ${project} ${image} ${tag} ${notaryServerEndpoint} ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image}:${tag} ${user} ${pwd}
Clean All Local Images Clean All Local Images
Log ${output} Log ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output curl -u admin:Harbor12345 -s --insecure -H "Content-Type: application/json" -X GET "https://${ip}/api/v2.0/projects/${project}/repositories/${image}/artifacts/${tag}?with_signature=true" ${rc} ${output}= Run And Return Rc And Output curl -u admin:Harbor12345 -s --insecure -H "Content-Type: application/json" -X GET "https://${ip}/api/v2.0/projects/${project}/repositories/${image}/artifacts/${tag}?with_signature=true"
Log To Console ${output} Log To Console ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Should Contain ${output} "signed":true Should Contain ${output} "signed":true
Run Keyword If ${with_remove} == ${true} Notary Remove Signature ${ip} ${project} ${image} ${tag} ${user} ${pwd} Run Keyword If ${with_remove} == ${true} Notary Remove Signature ${ip} ${project} ${image} ${tag} ${user} ${pwd}
Delete A Project Without Sign In Harbor Delete A Project Without Sign In Harbor
[Arguments] ${harbor_ip}=${ip} ${username}=${HARBOR_ADMIN} ${password}=${HARBOR_PASSWORD} [Arguments] ${harbor_ip}=${ip} ${username}=${HARBOR_ADMIN} ${password}=${HARBOR_PASSWORD}
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
${project_name}= Set Variable 000${d} ${project_name}= Set Variable 000${d}
${image}= Set Variable hello-world ${image}= Set Variable hello-world
Create An New Project And Go Into Project ${project_name} Create An New Project And Go Into Project ${project_name}
Push Image ${harbor_ip} ${username} ${password} ${project_name} ${image} Push Image ${harbor_ip} ${username} ${password} ${project_name} ${image}
Project Should Not Be Deleted ${project_name} Project Should Not Be Deleted ${project_name}
Go Into Project ${project_name} Go Into Project ${project_name}
Delete Repo ${project_name} ${image} Delete Repo ${project_name} ${image}
Navigate To Projects Navigate To Projects
Project Should Be Deleted ${project_name} Project Should Be Deleted ${project_name}
Manage Project Member Without Sign In Harbor Manage Project Member Without Sign In Harbor
[Arguments] ${sign_in_user} ${sign_in_pwd} ${test_user1}=user005 ${test_user2}=user006 ${is_oidc_mode}=${false} [Arguments] ${sign_in_user} ${sign_in_pwd} ${test_user1}=user005 ${test_user2}=user006 ${is_oidc_mode}=${false}
${d}= Get current Date result_format=%m%s ${d}= Get current Date result_format=%m%s
${image}= Set Variable hello-world ${image}= Set Variable hello-world
Create An New Project And Go Into Project project${d} Create An New Project And Go Into Project project${d}
Push image ${ip} ${sign_in_user} ${sign_in_pwd} project${d} ${image} Push image ${ip} ${sign_in_user} ${sign_in_pwd} project${d} ${image}
Logout Harbor Logout Harbor
User Should Not Be A Member Of Project ${test_user1} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode} User Should Not Be A Member Of Project ${test_user1} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode}
Manage Project Member ${sign_in_user} ${sign_in_pwd} project${d} ${test_user1} Add is_oidc_mode=${is_oidc_mode} Manage Project Member ${sign_in_user} ${sign_in_pwd} project${d} ${test_user1} Add is_oidc_mode=${is_oidc_mode}
User Should Be Guest ${test_user1} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode} User Should Be Guest ${test_user1} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode}
Change User Role In Project ${sign_in_user} ${sign_in_pwd} project${d} ${test_user1} Developer is_oidc_mode=${is_oidc_mode} Change User Role In Project ${sign_in_user} ${sign_in_pwd} project${d} ${test_user1} Developer is_oidc_mode=${is_oidc_mode}
User Should Be Developer ${test_user1} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode} User Should Be Developer ${test_user1} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode}
Change User Role In Project ${sign_in_user} ${sign_in_pwd} project${d} ${test_user1} Admin is_oidc_mode=${is_oidc_mode} Change User Role In Project ${sign_in_user} ${sign_in_pwd} project${d} ${test_user1} Admin is_oidc_mode=${is_oidc_mode}
User Should Be Admin ${test_user1} ${sign_in_pwd} project${d} ${test_user2} is_oidc_mode=${is_oidc_mode} User Should Be Admin ${test_user1} ${sign_in_pwd} project${d} ${test_user2} is_oidc_mode=${is_oidc_mode}
Change User Role In Project ${sign_in_user} ${sign_in_pwd} project${d} ${test_user1} Maintainer is_oidc_mode=${is_oidc_mode} Change User Role In Project ${sign_in_user} ${sign_in_pwd} project${d} ${test_user1} Maintainer is_oidc_mode=${is_oidc_mode}
User Should Be Maintainer ${test_user1} ${sign_in_pwd} project${d} ${image} is_oidc_mode=${is_oidc_mode} User Should Be Maintainer ${test_user1} ${sign_in_pwd} project${d} ${image} is_oidc_mode=${is_oidc_mode}
Manage Project Member ${sign_in_user} ${sign_in_pwd} project${d} ${test_user1} Remove is_oidc_mode=${is_oidc_mode} Manage Project Member ${sign_in_user} ${sign_in_pwd} project${d} ${test_user1} Remove is_oidc_mode=${is_oidc_mode}
User Should Not Be A Member Of Project ${test_user1} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode} User Should Not Be A Member Of Project ${test_user1} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode}
Push image ${ip} ${sign_in_user} ${sign_in_pwd} project${d} hello-world Push image ${ip} ${sign_in_user} ${sign_in_pwd} project${d} hello-world
User Should Be Guest ${test_user2} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode} User Should Be Guest ${test_user2} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode}
Helm CLI Push Without Sign In Harbor Helm CLI Push Without Sign In Harbor
[Arguments] ${sign_in_user} ${sign_in_pwd} [Arguments] ${sign_in_user} ${sign_in_pwd}
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New Project And Go Into Project project${d} Create An New Project And Go Into Project project${d}
Helm Repo Add ${HARBOR_URL} ${sign_in_user} ${sign_in_pwd} project_name=project${d} Helm Repo Add ${HARBOR_URL} ${sign_in_user} ${sign_in_pwd} project_name=project${d}
Helm Repo Push ${sign_in_user} ${sign_in_pwd} ${harbor_chart_filename} Helm Repo Push ${sign_in_user} ${sign_in_pwd} ${harbor_chart_filename}
Switch To Project Charts Switch To Project Charts
Go Into Chart Version ${harbor_chart_name} Go Into Chart Version ${harbor_chart_name}
Retry Wait Until Page Contains ${harbor_chart_version} Retry Wait Until Page Contains ${harbor_chart_version}
Helm3 CLI Push Without Sign In Harbor Helm3 CLI Push Without Sign In Harbor
[Arguments] ${sign_in_user} ${sign_in_pwd} [Arguments] ${sign_in_user} ${sign_in_pwd}
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New Project And Go Into Project project${d} Create An New Project And Go Into Project project${d}
Helm Repo Push ${sign_in_user} ${sign_in_pwd} ${harbor_chart_filename} helm_repo_name=${HARBOR_URL}/chartrepo/project${d} helm_cmd=helm3 Helm Repo Push ${sign_in_user} ${sign_in_pwd} ${harbor_chart_filename} helm_repo_name=${HARBOR_URL}/chartrepo/project${d} helm_cmd=helm3
Switch To Project Charts Switch To Project Charts
Retry Double Keywords When Error Go Into Chart Version ${harbor_chart_name} Retry Wait Until Page Contains ${harbor_chart_version} Retry Double Keywords When Error Go Into Chart Version ${harbor_chart_name} Retry Wait Until Page Contains ${harbor_chart_version}
#Important Note: All CVE IDs in CVE Allowlist cases must unique! #Important Note: All CVE IDs in CVE Allowlist cases must unique!
Body Of Verfiy System Level CVE Allowlist Body Of Verfiy System Level CVE Allowlist
[Arguments] ${image_argument} ${sha256_argument} ${most_cve_list} ${single_cve} [Arguments] ${image_argument} ${sha256_argument} ${most_cve_list} ${single_cve}
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
${image}= Set Variable ${image_argument} ${image}= Set Variable ${image_argument}
# ${image}= Set Variable goharbor/harbor-portal # ${image}= Set Variable goharbor/harbor-portal
${sha256}= Set Variable ${sha256_argument} ${sha256}= Set Variable ${sha256_argument}
# ${sha256}= Set Variable 2cb6a1c24dd6b88f11fd44ccc6560cb7be969f8ac5f752802c99cae6bcd592bb # ${sha256}= Set Variable 2cb6a1c24dd6b88f11fd44ccc6560cb7be969f8ac5f752802c99cae6bcd592bb
${signin_user}= Set Variable user025 ${signin_user}= Set Variable user025
${signin_pwd}= Set Variable Test1@34 ${signin_pwd}= Set Variable Test1@34
Sign In Harbor ${HARBOR_URL} ${signin_user} ${signin_pwd} Sign In Harbor ${HARBOR_URL} ${signin_user} ${signin_pwd}
Create An New Project And Go Into Project project${d} Create An New Project And Go Into Project project${d}
Push Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} sha256=${sha256} Push Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} sha256=${sha256}
Go Into Project project${d} Go Into Project project${d}
Set Vulnerabilty Serverity 2 Set Vulnerabilty Serverity 2
Cannot Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256} err_msg=cannot be pulled due to configured policy Cannot Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256} err_msg=cannot be pulled due to configured policy
Go Into Project project${d} Go Into Project project${d}
Go Into Repo project${d}/${image} Go Into Repo project${d}/${image}
Scan Repo ${sha256} Succeed Scan Repo ${sha256} Succeed
Logout Harbor Logout Harbor
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Check Listed In CVE Allowlist project${d} ${image} ${sha256} ${single_cve} is_in=No Check Listed In CVE Allowlist project${d} ${image} ${sha256} ${single_cve} is_in=No
Switch To Configure Switch To Configure
Switch To Configuration System Setting Switch To Configuration System Setting
# Add Items To System CVE Allowlist CVE-2019-19317\nCVE-2019-19646 \nCVE-2019-5188 \nCVE-2019-20387 \nCVE-2019-17498 \nCVE-2019-20372 \nCVE-2019-19244 \nCVE-2019-19603 \nCVE-2019-19880 \nCVE-2019-19923 \nCVE-2019-19925 \nCVE-2019-19926 \nCVE-2019-19959 \nCVE-2019-20218 \nCVE-2019-19232 \nCVE-2019-19234 \nCVE-2019-19645 # Add Items To System CVE Allowlist CVE-2019-19317\nCVE-2019-19646 \nCVE-2019-5188 \nCVE-2019-20387 \nCVE-2019-17498 \nCVE-2019-20372 \nCVE-2019-19244 \nCVE-2019-19603 \nCVE-2019-19880 \nCVE-2019-19923 \nCVE-2019-19925 \nCVE-2019-19926 \nCVE-2019-19959 \nCVE-2019-20218 \nCVE-2019-19232 \nCVE-2019-19234 \nCVE-2019-19645
Add Items To System CVE Allowlist ${most_cve_list} Add Items To System CVE Allowlist ${most_cve_list}
Cannot Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256} err_msg=cannot be pulled due to configured policy Cannot Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256} err_msg=cannot be pulled due to configured policy
# Add Items To System CVE Allowlist CVE-2019-18276 # Add Items To System CVE Allowlist CVE-2019-18276
Add Items To System CVE Allowlist ${single_cve} Add Items To System CVE Allowlist ${single_cve}
Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256} Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Delete Top Item In System CVE Allowlist count=16 Delete Top Item In System CVE Allowlist count=16
Cannot Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256} err_msg=cannot be pulled due to configured policy Cannot Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256} err_msg=cannot be pulled due to configured policy
Check Listed In CVE Allowlist project${d} ${image} ${sha256} ${single_cve} Check Listed In CVE Allowlist project${d} ${image} ${sha256} ${single_cve}
Close Browser Close Browser
Body Of Verfiy Project Level CVE Allowlist Body Of Verfiy Project Level CVE Allowlist
[Arguments] ${image_argument} ${sha256_argument} ${most_cve_list} ${single_cve} [Arguments] ${image_argument} ${sha256_argument} ${most_cve_list} ${single_cve}
[Tags] run-once [Tags] run-once
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
${image}= Set Variable ${image_argument} ${image}= Set Variable ${image_argument}
${sha256}= Set Variable ${sha256_argument} ${sha256}= Set Variable ${sha256_argument}
${signin_user}= Set Variable user025 ${signin_user}= Set Variable user025
${signin_pwd}= Set Variable Test1@34 ${signin_pwd}= Set Variable Test1@34
Sign In Harbor ${HARBOR_URL} ${signin_user} ${signin_pwd} Sign In Harbor ${HARBOR_URL} ${signin_user} ${signin_pwd}
Create An New Project And Go Into Project project${d} Create An New Project And Go Into Project project${d}
Push Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} sha256=${sha256} Push Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} sha256=${sha256}
Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256} Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Go Into Project project${d} Go Into Project project${d}
Set Vulnerabilty Serverity 2 Set Vulnerabilty Serverity 2
Cannot Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256} Cannot Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Go Into Project project${d} Go Into Project project${d}
Go Into Repo project${d}/${image} Go Into Repo project${d}/${image}
Scan Repo ${sha256} Succeed Scan Repo ${sha256} Succeed
Go Into Project project${d} Go Into Project project${d}
Add Items to Project CVE Allowlist ${most_cve_list} Add Items to Project CVE Allowlist ${most_cve_list}
Cannot Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256} Cannot Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Add Items to Project CVE Allowlist ${single_cve} Add Items to Project CVE Allowlist ${single_cve}
Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256} Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Delete Top Item In Project CVE Allowlist Delete Top Item In Project CVE Allowlist
Cannot Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256} Cannot Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Close Browser Close Browser
Body Of Verfiy Project Level CVE Allowlist By Quick Way of Add System Body Of Verfiy Project Level CVE Allowlist By Quick Way of Add System
[Arguments] ${image_argument} ${sha256_argument} ${cve_list} [Arguments] ${image_argument} ${sha256_argument} ${cve_list}
[Tags] run-once [Tags] run-once
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
${image}= Set Variable ${image_argument} ${image}= Set Variable ${image_argument}
${sha256}= Set Variable ${sha256_argument} ${sha256}= Set Variable ${sha256_argument}
${signin_user}= Set Variable user025 ${signin_user}= Set Variable user025
${signin_pwd}= Set Variable Test1@34 ${signin_pwd}= Set Variable Test1@34
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Configure Switch To Configure
Switch To Configuration System Setting Switch To Configuration System Setting
Add Items To System CVE Allowlist ${cve_list} Add Items To System CVE Allowlist ${cve_list}
Logout Harbor Logout Harbor
Sign In Harbor ${HARBOR_URL} ${signin_user} ${signin_pwd} Sign In Harbor ${HARBOR_URL} ${signin_user} ${signin_pwd}
Create An New Project And Go Into Project project${d} Create An New Project And Go Into Project project${d}
Push Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} sha256=${sha256} Push Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} sha256=${sha256}
Go Into Project project${d} Go Into Project project${d}
Set Vulnerabilty Serverity 2 Set Vulnerabilty Serverity 2
Go Into Project project${d} Go Into Project project${d}
Go Into Repo project${d}/${image} Go Into Repo project${d}/${image}
Scan Repo ${sha256} Succeed Scan Repo ${sha256} Succeed
Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256} Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Go Into Project project${d} Go Into Project project${d}
Set Project To Project Level CVE Allowlist Set Project To Project Level CVE Allowlist
Cannot Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256} Cannot Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Add System CVE Allowlist to Project CVE Allowlist By Add System Button Click Add System CVE Allowlist to Project CVE Allowlist By Add System Button Click
Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256} Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Close Browser Close Browser
Body Of Replication Of Push Images to Registry Triggered By Event Body Of Replication Of Push Images to Registry Triggered By Event
[Arguments] ${provider} ${endpoint} ${username} ${pwd} ${dest_namespace} ${image_size}=12 [Arguments] ${provider} ${endpoint} ${username} ${pwd} ${dest_namespace} ${image_size}=12
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
${sha256}= Set Variable 0e67625224c1da47cb3270e7a861a83e332f708d3d89dde0cbed432c94824d9a ${sha256}= Set Variable 0e67625224c1da47cb3270e7a861a83e332f708d3d89dde0cbed432c94824d9a
${image}= Set Variable test_push_repli ${image}= Set Variable test_push_repli
${tag1}= Set Variable v1.1.0 ${tag1}= Set Variable v1.1.0
@{tags} Create List ${tag1} @{tags} Create List ${tag1}
#login source #login source
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project${d} Create An New Project And Go Into Project project${d}
Switch To Registries Switch To Registries
Create A New Endpoint ${provider} e${d} ${endpoint} ${username} ${pwd} Y Create A New Endpoint ${provider} e${d} ${endpoint} ${username} ${pwd} Y
Switch To Replication Manage Switch To Replication Manage
Create A Rule With Existing Endpoint rule${d} push project${d}/* image e${d} ${dest_namespace} mode=Event Based del_remote=${true} Create A Rule With Existing Endpoint rule${d} push project${d}/* image e${d} ${dest_namespace} mode=Event Based del_remote=${true}
Push Special Image To Project project${d} ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} ${image} tags=@{tags} size=${image_size} Push Special Image To Project project${d} ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} ${image} tags=@{tags} size=${image_size}
Filter Replication Rule rule${d} Filter Replication Rule rule${d}
Select Rule rule${d} Select Rule rule${d}
${endpoint_body}= Fetch From Right ${endpoint} // ${endpoint_body}= Fetch From Right ${endpoint} //
${dest_namespace}= Set Variable If '${provider}'=='gitlab' ${endpoint_body}/${dest_namespace} ${dest_namespace} ${dest_namespace}= Set Variable If '${provider}'=='gitlab' ${endpoint_body}/${dest_namespace} ${dest_namespace}
Run Keyword If '${provider}'=='docker-hub' or '${provider}'=='gitlab' Docker Image Can Be Pulled ${dest_namespace}/${image}:${tag1} times=3 Run Keyword If '${provider}'=='docker-hub' or '${provider}'=='gitlab' Docker Image Can Be Pulled ${dest_namespace}/${image}:${tag1} times=3
Executions Result Count Should Be Succeeded event_based 1 Executions Result Count Should Be Succeeded event_based 1
Go Into Project project${d} Go Into Project project${d}
Delete Repo project${d} ${image} Delete Repo project${d} ${image}
Run Keyword If '${provider}'=='docker-hub' or '${provider}'=='gitlab' Docker Image Can Not Be Pulled ${dest_namespace}/${image}:${tag1} Run Keyword If '${provider}'=='docker-hub' or '${provider}'=='gitlab' Docker Image Can Not Be Pulled ${dest_namespace}/${image}:${tag1}
Switch To Replication Manage Switch To Replication Manage
Filter Replication Rule rule${d} Filter Replication Rule rule${d}
Select Rule rule${d} Select Rule rule${d}
Executions Result Count Should Be Succeeded event_based 2 Executions Result Count Should Be Succeeded event_based 2
Body Of Replication Of Pull Images from Registry To Self Body Of Replication Of Pull Images from Registry To Self
[Arguments] ${provider} ${endpoint} ${username} ${pwd} ${src_project_name} ${des_project_name} ${verify_verbose} @{target_images} [Arguments] ${provider} ${endpoint} ${username} ${pwd} ${src_project_name} ${des_project_name} ${verify_verbose} @{target_images}
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
${_des_pro_name}= Set Variable If '${des_project_name}'=='${null}' project${d} ${des_project_name} ${_des_pro_name}= Set Variable If '${des_project_name}'=='${null}' project${d} ${des_project_name}
#login source #login source
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Run Keyword If '${des_project_name}'=='${null}' Create An New Project And Go Into Project ${_des_pro_name} Run Keyword If '${des_project_name}'=='${null}' Create An New Project And Go Into Project ${_des_pro_name}
Switch To Registries Switch To Registries
Create A New Endpoint ${provider} e${d} ${endpoint} ${username} ${pwd} Y Create A New Endpoint ${provider} e${d} ${endpoint} ${username} ${pwd} Y
Switch To Replication Manage Switch To Replication Manage
Create A Rule With Existing Endpoint rule${d} pull ${src_project_name} all e${d} ${_des_pro_name} Create A Rule With Existing Endpoint rule${d} pull ${src_project_name} all e${d} ${_des_pro_name}
Select Rule And Replicate rule${d} Select Rule And Replicate rule${d}
Run Keyword If '${verify_verbose}'=='Y' Verify Artifact Display Verbose ${_des_pro_name} @{target_images} Run Keyword If '${verify_verbose}'=='Y' Verify Artifact Display Verbose ${_des_pro_name} @{target_images}
... ELSE Verify Artifact Display ${_des_pro_name} @{target_images} ... ELSE Verify Artifact Display ${_des_pro_name} @{target_images}
Close Browser Close Browser
Verify Artifact Display Verbose Verify Artifact Display Verbose
[Arguments] ${pro_name} @{target_images} [Arguments] ${pro_name} @{target_images}
FOR ${item} IN @{target_images} FOR ${item} IN @{target_images}
${item}= Get Substring ${item} 1 -1 ${item}= Get Substring ${item} 1 -1
${item}= Evaluate ${item} ${item}= Evaluate ${item}
${image}= Get From Dictionary ${item} image ${image}= Get From Dictionary ${item} image
${tag}= Get From Dictionary ${item} tag ${tag}= Get From Dictionary ${item} tag
${total_artifact_count}= Get From Dictionary ${item} total_artifact_count ${total_artifact_count}= Get From Dictionary ${item} total_artifact_count
${archive_count}= Get From Dictionary ${item} archive_count ${archive_count}= Get From Dictionary ${item} archive_count
Log To Console Check image ${image}:${tag} replication to Project ${pro_name} Log To Console Check image ${image}:${tag} replication to Project ${pro_name}
Image Should Be Replicated To Project ${pro_name} ${image} tag=${tag} total_artifact_count=${total_artifact_count} archive_count=${archive_count} times=2 Image Should Be Replicated To Project ${pro_name} ${image} tag=${tag} total_artifact_count=${total_artifact_count} archive_count=${archive_count} times=2
END END
Verify Artifact Display Verify Artifact Display
[Arguments] ${pro_name} @{target_images} [Arguments] ${pro_name} @{target_images}
FOR ${item} IN @{target_images} FOR ${item} IN @{target_images}
${item}= Get Substring ${item} 1 -1 ${item}= Get Substring ${item} 1 -1
${item}= Evaluate ${item} ${item}= Evaluate ${item}
${image}= Get From Dictionary ${item} image ${image}= Get From Dictionary ${item} image
Image Should Be Replicated To Project ${pro_name} ${image} times=2 Image Should Be Replicated To Project ${pro_name} ${image} times=2
END END

View File

@ -1,294 +1,294 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Library OperatingSystem Library OperatingSystem
Library String Library String
Library Collections Library Collections
Library requests Library requests
Library Process Library Process
Library SSHLibrary 1 minute Library SSHLibrary 1 minute
Library DateTime Library DateTime
Library SeleniumLibrary 60 10 Library SeleniumLibrary 60 10
Library JSONLibrary Library JSONLibrary
Resource Nimbus-Util.robot Resource Nimbus-Util.robot
Resource Vsphere-Util.robot Resource Vsphere-Util.robot
Resource VCH-Util.robot Resource VCH-Util.robot
Resource Drone-Util.robot Resource Drone-Util.robot
Resource Github-Util.robot Resource Github-Util.robot
Resource Harbor-Util.robot Resource Harbor-Util.robot
Resource Harbor-Pages/Public_Elements.robot Resource Harbor-Pages/Public_Elements.robot
Resource Harbor-Pages/HomePage.robot Resource Harbor-Pages/HomePage.robot
Resource Harbor-Pages/HomePage_Elements.robot Resource Harbor-Pages/HomePage_Elements.robot
Resource Harbor-Pages/Project.robot Resource Harbor-Pages/Project.robot
Resource Harbor-Pages/Project_Elements.robot Resource Harbor-Pages/Project_Elements.robot
Resource Harbor-Pages/Project-Members.robot Resource Harbor-Pages/Project-Members.robot
Resource Harbor-Pages/Project-Members_Elements.robot Resource Harbor-Pages/Project-Members_Elements.robot
Resource Harbor-Pages/Project-P2P-Preheat.robot Resource Harbor-Pages/Project-P2P-Preheat.robot
Resource Harbor-Pages/Project-P2P-Preheat-Elements.robot Resource Harbor-Pages/Project-P2P-Preheat-Elements.robot
Resource Harbor-Pages/Project-Webhooks.robot Resource Harbor-Pages/Project-Webhooks.robot
Resource Harbor-Pages/Project-Webhooks_Elements.robot Resource Harbor-Pages/Project-Webhooks_Elements.robot
Resource Harbor-Pages/Project-Repository.robot Resource Harbor-Pages/Project-Repository.robot
Resource Harbor-Pages/Project-Repository_Elements.robot Resource Harbor-Pages/Project-Repository_Elements.robot
Resource Harbor-Pages/Project-Artifact.robot Resource Harbor-Pages/Project-Artifact.robot
Resource Harbor-Pages/Project-Artifact-Elements.robot Resource Harbor-Pages/Project-Artifact-Elements.robot
Resource Harbor-Pages/Project-Config.robot Resource Harbor-Pages/Project-Config.robot
Resource Harbor-Pages/Project-Config-Elements.robot Resource Harbor-Pages/Project-Config-Elements.robot
Resource Harbor-Pages/Project-Helmcharts.robot Resource Harbor-Pages/Project-Helmcharts.robot
Resource Harbor-Pages/Project-Helmcharts_Elements.robot Resource Harbor-Pages/Project-Helmcharts_Elements.robot
Resource Harbor-Pages/Project-Copy.robot Resource Harbor-Pages/Project-Copy.robot
Resource Harbor-Pages/Project-Copy-Elements.robot Resource Harbor-Pages/Project-Copy-Elements.robot
Resource Harbor-Pages/Project-Tag-Retention.robot Resource Harbor-Pages/Project-Tag-Retention.robot
Resource Harbor-Pages/Project-Tag-Retention_Elements.robot Resource Harbor-Pages/Project-Tag-Retention_Elements.robot
Resource Harbor-Pages/Project_Robot_Account.robot Resource Harbor-Pages/Project_Robot_Account.robot
Resource Harbor-Pages/Project_Robot_Account_Elements.robot Resource Harbor-Pages/Project_Robot_Account_Elements.robot
Resource Harbor-Pages/Replication.robot Resource Harbor-Pages/Replication.robot
Resource Harbor-Pages/Replication_Elements.robot Resource Harbor-Pages/Replication_Elements.robot
Resource Harbor-Pages/UserProfile.robot Resource Harbor-Pages/UserProfile.robot
Resource Harbor-Pages/UserProfile_Elements.robot Resource Harbor-Pages/UserProfile_Elements.robot
Resource Harbor-Pages/Administration-Users.robot Resource Harbor-Pages/Administration-Users.robot
Resource Harbor-Pages/Administration-Users_Elements.robot Resource Harbor-Pages/Administration-Users_Elements.robot
Resource Harbor-Pages/GC.robot Resource Harbor-Pages/GC.robot
Resource Harbor-Pages/Configuration.robot Resource Harbor-Pages/Configuration.robot
Resource Harbor-Pages/Configuration_Elements.robot Resource Harbor-Pages/Configuration_Elements.robot
Resource Harbor-Pages/ToolKit.robot Resource Harbor-Pages/ToolKit.robot
Resource Harbor-Pages/ToolKit_Elements.robot Resource Harbor-Pages/ToolKit_Elements.robot
Resource Harbor-Pages/Vulnerability.robot Resource Harbor-Pages/Vulnerability.robot
Resource Harbor-Pages/Vulnerability_Elements.robot Resource Harbor-Pages/Vulnerability_Elements.robot
Resource Harbor-Pages/LDAP-Mode.robot Resource Harbor-Pages/LDAP-Mode.robot
Resource Harbor-Pages/OIDC_Auth.robot Resource Harbor-Pages/OIDC_Auth.robot
Resource Harbor-Pages/OIDC_Auth_Elements.robot Resource Harbor-Pages/OIDC_Auth_Elements.robot
Resource Harbor-Pages/Robot_Account.robot Resource Harbor-Pages/Robot_Account.robot
Resource Harbor-Pages/Robot_Account_Elements.robot Resource Harbor-Pages/Robot_Account_Elements.robot
Resource Harbor-Pages/Verify.robot Resource Harbor-Pages/Verify.robot
Resource Docker-Util.robot Resource Docker-Util.robot
Resource CNAB_Util.robot Resource CNAB_Util.robot
Resource Helm-Util.robot Resource Helm-Util.robot
Resource OVA-Util.robot Resource OVA-Util.robot
Resource Cert-Util.robot Resource Cert-Util.robot
Resource SeleniumUtil.robot Resource SeleniumUtil.robot
Resource Nightly-Util.robot Resource Nightly-Util.robot
Resource APITest-Util.robot Resource APITest-Util.robot
Resource TestCaseBody.robot Resource TestCaseBody.robot
*** Keywords *** *** Keywords ***
Wait Until Element Is Visible And Enabled Wait Until Element Is Visible And Enabled
[Arguments] ${element} [Arguments] ${element}
Wait Until Element Is Visible ${element} Wait Until Element Is Visible ${element}
Wait Until Element Is Enabled ${element} Wait Until Element Is Enabled ${element}
Retry Action Keyword Retry Action Keyword
[Arguments] ${keyword} @{param} [Arguments] ${keyword} @{param}
Retry Keyword N Times When Error 4 ${keyword} @{param} Retry Keyword N Times When Error 4 ${keyword} @{param}
Retry Wait Element Retry Wait Element
[Arguments] ${element_xpath} [Arguments] ${element_xpath}
@{param} Create List ${element_xpath} @{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Element Is Visible And Enabled @{param} Retry Action Keyword Wait Until Element Is Visible And Enabled @{param}
Retry Wait Element Visible Retry Wait Element Visible
[Arguments] ${element_xpath} [Arguments] ${element_xpath}
@{param} Create List ${element_xpath} @{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Element Is Visible @{param} Retry Action Keyword Wait Until Element Is Visible @{param}
Retry Wait Element Not Visible Retry Wait Element Not Visible
[Arguments] ${element_xpath} [Arguments] ${element_xpath}
@{param} Create List ${element_xpath} @{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Element Is Not Visible @{param} Retry Action Keyword Wait Until Element Is Not Visible @{param}
Retry Wait Element Should Be Disabled Retry Wait Element Should Be Disabled
[Arguments] ${element_xpath} [Arguments] ${element_xpath}
@{param} Create List ${element_xpath} @{param} Create List ${element_xpath}
Retry Action Keyword Element Should Be Disabled @{param} Retry Action Keyword Element Should Be Disabled @{param}
Retry Element Click Retry Element Click
[Arguments] ${element_xpath} [Arguments] ${element_xpath}
@{param} Create List ${element_xpath} @{param} Create List ${element_xpath}
Retry Action Keyword Element Click @{param} Retry Action Keyword Element Click @{param}
Retry Button Click Retry Button Click
[Arguments] ${element_xpath} [Arguments] ${element_xpath}
@{param} Create List ${element_xpath} @{param} Create List ${element_xpath}
Retry Action Keyword Button Click @{param} Retry Action Keyword Button Click @{param}
Retry Text Input Retry Text Input
[Arguments] ${element_xpath} ${text} [Arguments] ${element_xpath} ${text}
@{param} Create List ${element_xpath} ${text} @{param} Create List ${element_xpath} ${text}
Retry Action Keyword Text Input @{param} Retry Action Keyword Text Input @{param}
Retry Clear Element Text Retry Clear Element Text
[Arguments] ${element_xpath} [Arguments] ${element_xpath}
@{param} Create List ${element_xpath} @{param} Create List ${element_xpath}
Retry Action Keyword Clear Element Text @{param} Retry Action Keyword Clear Element Text @{param}
Retry Link Click Retry Link Click
[Arguments] ${element_xpath} [Arguments] ${element_xpath}
@{param} Create List ${element_xpath} @{param} Create List ${element_xpath}
Retry Action Keyword Link Click @{param} Retry Action Keyword Link Click @{param}
Retry Checkbox Should Be Selected Retry Checkbox Should Be Selected
[Arguments] ${element_xpath} [Arguments] ${element_xpath}
@{param} Create List ${element_xpath} @{param} Create List ${element_xpath}
Retry Action Keyword Checkbox Should Be Selected @{param} Retry Action Keyword Checkbox Should Be Selected @{param}
Retry Checkbox Should Not Be Selected Retry Checkbox Should Not Be Selected
[Arguments] ${element_xpath} [Arguments] ${element_xpath}
@{param} Create List ${element_xpath} @{param} Create List ${element_xpath}
Retry Action Keyword Checkbox Should Not Be Selected @{param} Retry Action Keyword Checkbox Should Not Be Selected @{param}
Retry Wait Until Page Contains Retry Wait Until Page Contains
[Arguments] ${element_xpath} [Arguments] ${element_xpath}
@{param} Create List ${element_xpath} @{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Page Contains @{param} Retry Action Keyword Wait Until Page Contains @{param}
Retry Wait Until Page Does Not Contains Retry Wait Until Page Does Not Contains
[Arguments] ${element_xpath} [Arguments] ${element_xpath}
@{param} Create List ${element_xpath} @{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Page Does Not Contain @{param} Retry Action Keyword Wait Until Page Does Not Contain @{param}
Retry Wait Until Page Contains Element Retry Wait Until Page Contains Element
[Arguments] ${element_xpath} [Arguments] ${element_xpath}
@{param} Create List ${element_xpath} @{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Page Contains Element @{param} Retry Action Keyword Wait Until Page Contains Element @{param}
Retry Wait Until Page Not Contains Element Retry Wait Until Page Not Contains Element
[Arguments] ${element_xpath} [Arguments] ${element_xpath}
@{param} Create List ${element_xpath} @{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Page Does Not Contain Element @{param} Retry Action Keyword Wait Until Page Does Not Contain Element @{param}
Retry Select Object Retry Select Object
[Arguments] ${obj_name} [Arguments] ${obj_name}
@{param} Create List ${obj_name} @{param} Create List ${obj_name}
Retry Action Keyword Select Object @{param} Retry Action Keyword Select Object @{param}
Retry Textfield Value Should Be Retry Textfield Value Should Be
[Arguments] ${element} ${text} [Arguments] ${element} ${text}
@{param} Create List ${element} ${text} @{param} Create List ${element} ${text}
Retry Action Keyword Wait And Textfield Value Should Be @{param} Retry Action Keyword Wait And Textfield Value Should Be @{param}
Retry List Selection Should Be Retry List Selection Should Be
[Arguments] ${element} ${text} [Arguments] ${element} ${text}
@{param} Create List ${element} ${text} @{param} Create List ${element} ${text}
Retry Action Keyword Wait And List Selection Should Be @{param} Retry Action Keyword Wait And List Selection Should Be @{param}
Link Click Link Click
[Arguments] ${element_xpath} [Arguments] ${element_xpath}
Click Link ${element_xpath} Click Link ${element_xpath}
Wait And List Selection Should Be Wait And List Selection Should Be
[Arguments] ${element} ${text} [Arguments] ${element} ${text}
Wait Until Element Is Visible And Enabled ${element} Wait Until Element Is Visible And Enabled ${element}
List Selection Should Be ${element} ${text} List Selection Should Be ${element} ${text}
Wait And Textfield Value Should Be Wait And Textfield Value Should Be
[Arguments] ${element} ${text} [Arguments] ${element} ${text}
Wait Until Element Is Visible And Enabled ${element} Wait Until Element Is Visible And Enabled ${element}
Textfield Value Should Be ${element} ${text} Textfield Value Should Be ${element} ${text}
Element Click Element Click
[Arguments] ${element_xpath} [Arguments] ${element_xpath}
Wait Until Element Is Visible And Enabled ${element_xpath} Wait Until Element Is Visible And Enabled ${element_xpath}
Click Element ${element_xpath} Click Element ${element_xpath}
Sleep 1 Sleep 1
Button Click Button Click
[Arguments] ${element_xpath} [Arguments] ${element_xpath}
Wait Until Element Is Visible And Enabled ${element_xpath} Wait Until Element Is Visible And Enabled ${element_xpath}
Click button ${element_xpath} Click button ${element_xpath}
Text Input Text Input
[Arguments] ${element_xpath} ${text} [Arguments] ${element_xpath} ${text}
Wait Until Element Is Visible And Enabled ${element_xpath} Wait Until Element Is Visible And Enabled ${element_xpath}
Input Text ${element_xpath} ${text} Input Text ${element_xpath} ${text}
Clear Field Of Characters Clear Field Of Characters
[Arguments] ${field} ${character count} [Arguments] ${field} ${character count}
[Documentation] This keyword pushes the delete key (ascii: \8) a specified number of times in a specified field. [Documentation] This keyword pushes the delete key (ascii: \8) a specified number of times in a specified field.
FOR ${index} IN RANGE ${character count} FOR ${index} IN RANGE ${character count}
Press Keys ${field} \\8 Press Keys ${field} \\8
END END
Wait Unitl Command Success Wait Unitl Command Success
[Arguments] ${cmd} ${times}=5 [Arguments] ${cmd} ${times}=5
FOR ${n} IN RANGE 1 ${times} FOR ${n} IN RANGE 1 ${times}
Log Trying ${cmd}: ${n} ... console=True Log Trying ${cmd}: ${n} ... console=True
${rc} ${output}= Run And Return Rc And Output ${cmd} ${rc} ${output}= Run And Return Rc And Output ${cmd}
Exit For Loop If '${rc}'=='0' Exit For Loop If '${rc}'=='0'
Sleep 2 Sleep 2
END END
Log Command Result is ${output} Log Command Result is ${output}
Should Be Equal As Strings '${rc}' '0' Should Be Equal As Strings '${rc}' '0'
[Return] ${output} [Return] ${output}
Command Should be Failed Command Should be Failed
[Arguments] ${cmd} [Arguments] ${cmd}
${rc} ${output}= Run And Return Rc And Output ${cmd} ${rc} ${output}= Run And Return Rc And Output ${cmd}
Should Not Be Equal As Strings '${rc}' '0' Should Not Be Equal As Strings '${rc}' '0'
Log ${output} Log ${output}
[Return] ${output} [Return] ${output}
Retry Keyword N Times When Error Retry Keyword N Times When Error
[Arguments] ${times} ${keyword} @{elements} [Arguments] ${times} ${keyword} @{elements}
FOR ${n} IN RANGE 1 ${times} FOR ${n} IN RANGE 1 ${times}
Log To Console Trying ${keyword} elements @{elements} ${n} times ... Log To Console Trying ${keyword} elements @{elements} ${n} times ...
${out} Run Keyword And Ignore Error ${keyword} @{elements} ${out} Run Keyword And Ignore Error ${keyword} @{elements}
Log To Console Return value is ${out} and ${out[0]} Log To Console Return value is ${out} and ${out[0]}
Run Keyword If '${keyword}'=='Make Swagger Client' Exit For Loop If '${out[0]}'=='PASS' and '${out[1]}'=='0' Run Keyword If '${keyword}'=='Make Swagger Client' Exit For Loop If '${out[0]}'=='PASS' and '${out[1]}'=='0'
... ELSE Exit For Loop If '${out[0]}'=='PASS' ... ELSE Exit For Loop If '${out[0]}'=='PASS'
Sleep 10 Sleep 10
END END
Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot
Should Be Equal As Strings '${out[0]}' 'PASS' Should Be Equal As Strings '${out[0]}' 'PASS'
[Return] ${out[1]} [Return] ${out[1]}
Retry Keyword When Return Value Mismatch Retry Keyword When Return Value Mismatch
[Arguments] ${keyword} ${expected_value} ${count} @{elements} [Arguments] ${keyword} ${expected_value} ${count} @{elements}
FOR ${n} IN RANGE 1 ${count} FOR ${n} IN RANGE 1 ${count}
Log To Console Trying ${keyword} ${n} times ... Log To Console Trying ${keyword} ${n} times ...
${out} Run Keyword And Ignore Error ${keyword} @{elements} ${out} Run Keyword And Ignore Error ${keyword} @{elements}
Log To Console Return value is ${out[1]} Log To Console Return value is ${out[1]}
${status}= Set Variable If '${out[1]}'=='${expected_value}' 'PASS' 'FAIL' ${status}= Set Variable If '${out[1]}'=='${expected_value}' 'PASS' 'FAIL'
Exit For Loop If '${out[1]}'=='${expected_value}' Exit For Loop If '${out[1]}'=='${expected_value}'
Sleep 2 Sleep 2
END END
Run Keyword If ${status}=='FAIL' Capture Page Screenshot Run Keyword If ${status}=='FAIL' Capture Page Screenshot
Should Be Equal As Strings ${status} 'PASS' Should Be Equal As Strings ${status} 'PASS'
Retry Double Keywords When Error Retry Double Keywords When Error
[Arguments] ${keyword1} ${element1} ${keyword2} ${element2} ${DoAssert}=${true} ${times}=3 [Arguments] ${keyword1} ${element1} ${keyword2} ${element2} ${DoAssert}=${true} ${times}=3
FOR ${n} IN RANGE 1 ${times} FOR ${n} IN RANGE 1 ${times}
Log To Console Trying ${keyword1} and ${keyword2} ${n} times ... Log To Console Trying ${keyword1} and ${keyword2} ${n} times ...
${out1} Run Keyword And Ignore Error ${keyword1} ${element1} ${out1} Run Keyword And Ignore Error ${keyword1} ${element1}
Sleep 1 Sleep 1
${out2} Run Keyword And Ignore Error ${keyword2} ${element2} ${out2} Run Keyword And Ignore Error ${keyword2} ${element2}
Log To Console Return value is ${out1[0]} ${out2[0]} Log To Console Return value is ${out1[0]} ${out2[0]}
Exit For Loop If '${out2[0]}'=='PASS' Exit For Loop If '${out2[0]}'=='PASS'
Sleep 1 Sleep 1
END END
Capture Page Screenshot Capture Page Screenshot
Return From Keyword If ${DoAssert} == ${false} '${out2[0]}' Return From Keyword If ${DoAssert} == ${false} '${out2[0]}'
Should Be Equal As Strings '${out2[0]}' 'PASS' Should Be Equal As Strings '${out2[0]}' 'PASS'
Run Curl And Return Json Run Curl And Return Json
[Arguments] ${curl_cmd} [Arguments] ${curl_cmd}
${json_data_file}= Set Variable ${CURDIR}${/}cur_user_info.json ${json_data_file}= Set Variable ${CURDIR}${/}cur_user_info.json
${rc} ${output}= Run And Return Rc And Output ${curl_cmd} ${rc} ${output}= Run And Return Rc And Output ${curl_cmd}
Should Be Equal As Integers 0 ${rc} Should Be Equal As Integers 0 ${rc}
Create File ${json_data_file} ${output} Create File ${json_data_file} ${output}
${json}= Load Json From File ${json_data_file} ${json}= Load Json From File ${json_data_file}
[Return] ${json} [Return] ${json}
Log All Log All
[Arguments] ${text} [Arguments] ${text}
Log To Console ${text} Log To Console ${text}
Log ${text} Log ${text}

View File

@ -1,404 +1,404 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource contains all keywords related to creating, deleting, maintaining VCHs Documentation This resource contains all keywords related to creating, deleting, maintaining VCHs
*** Keywords *** *** Keywords ***
Set Test Environment Variables Set Test Environment Variables
# Finish setting up environment variables # Finish setting up environment variables
${status} ${message}= Run Keyword And Ignore Error Environment Variable Should Be Set DRONE_BUILD_NUMBER ${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 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 ${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 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 ${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' 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 ${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} Run Keyword If '${status}' == 'FAIL' Set Environment Variable TEST_DATACENTER ${SPACE}
@{URLs}= Split String %{TEST_URL_ARRAY} @{URLs}= Split String %{TEST_URL_ARRAY}
${len}= Get Length ${URLs} ${len}= Get Length ${URLs}
${IDX}= Evaluate %{DRONE_BUILD_NUMBER} \% ${len} ${IDX}= Evaluate %{DRONE_BUILD_NUMBER} \% ${len}
Set Environment Variable TEST_URL @{URLs}[${IDX}] Set Environment Variable TEST_URL @{URLs}[${IDX}]
Set Environment Variable GOVC_URL %{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL} 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 # 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 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 ${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 Should Be Equal As Integers ${rc} 0
Set Environment Variable TEST_THUMBPRINT ${thumbprint} Set Environment Variable TEST_THUMBPRINT ${thumbprint}
Log To Console \nTEST_URL=%{TEST_URL} Log To Console \nTEST_URL=%{TEST_URL}
${host}= Run govc ls host ${host}= Run govc ls host
${status} ${message}= Run Keyword And Ignore Error Environment Variable Should Be Set TEST_RESOURCE ${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 Run Keyword If '${status}' == 'FAIL' Set Environment Variable TEST_RESOURCE ${host}/Resources
Set Environment Variable GOVC_RESOURCE_POOL %{TEST_RESOURCE} Set Environment Variable GOVC_RESOURCE_POOL %{TEST_RESOURCE}
${noQuotes}= Strip String %{TEST_DATASTORE} characters=" ${noQuotes}= Strip String %{TEST_DATASTORE} characters="
Set Environment Variable GOVC_DATASTORE ${noQuotes} Set Environment Variable GOVC_DATASTORE ${noQuotes}
${about}= Run govc about ${about}= Run govc about
${status}= Run Keyword And Return Status Should Contain ${about} VMware ESXi ${status}= Run Keyword And Return Status Should Contain ${about} VMware ESXi
Run Keyword If ${status} Set Environment Variable HOST_TYPE ESXi Run Keyword If ${status} Set Environment Variable HOST_TYPE ESXi
Run Keyword Unless ${status} Set Environment Variable HOST_TYPE VC Run Keyword Unless ${status} Set Environment Variable HOST_TYPE VC
${about}= Run govc datastore.info %{TEST_DATASTORE} | grep 'Type' ${about}= Run govc datastore.info %{TEST_DATASTORE} | grep 'Type'
${status}= Run Keyword And Return Status Should Contain ${about} vsan ${status}= Run Keyword And Return Status Should Contain ${about} vsan
Run Keyword If ${status} Set Environment Variable DATASTORE_TYPE VSAN Run Keyword If ${status} Set Environment Variable DATASTORE_TYPE VSAN
Run Keyword Unless ${status} Set Environment Variable DATASTORE_TYPE Non_VSAN Run Keyword Unless ${status} Set Environment Variable DATASTORE_TYPE Non_VSAN
# set the TLS config options suitable for vic-machine in this env # set the TLS config options suitable for vic-machine in this env
${domain}= Get Environment Variable DOMAIN '' ${domain}= Get Environment Variable DOMAIN ''
Run Keyword If $domain == '' Set Suite Variable ${vicmachinetls} --no-tlsverify Run Keyword If $domain == '' Set Suite Variable ${vicmachinetls} --no-tlsverify
Run Keyword If $domain != '' Set Suite Variable ${vicmachinetls} --tls-cname=*.${domain} Run Keyword If $domain != '' Set Suite Variable ${vicmachinetls} --tls-cname=*.${domain}
Set Test VCH Name Set Test VCH Name
# Set a unique bridge network for each VCH that has a random VLAN ID # 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 ${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 ${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 Run Keyword If '%{HOST_TYPE}' == 'ESXi' Set Environment Variable BRIDGE_NETWORK %{VCH-NAME}-bridge
Set Test VCH Name Set Test VCH Name
${name}= Evaluate 'VCH-%{DRONE_BUILD_NUMBER}-' + str(random.randint(1000,9999)) modules=random ${name}= Evaluate 'VCH-%{DRONE_BUILD_NUMBER}-' + str(random.randint(1000,9999)) modules=random
Set Environment Variable VCH-NAME ${name} Set Environment Variable VCH-NAME ${name}
Set List Of Env Variables Set List Of Env Variables
[Arguments] ${vars} [Arguments] ${vars}
@{vars}= Split String ${vars} @{vars}= Split String ${vars}
:FOR ${var} IN @{vars} :FOR ${var} IN @{vars}
\ ${varname} ${varval}= Split String ${var} = \ ${varname} ${varval}= Split String ${var} =
\ Set Environment Variable ${varname} ${varval} \ Set Environment Variable ${varname} ${varval}
Parse Environment Variables Parse Environment Variables
[Arguments] ${line} [Arguments] ${line}
# If using the old logging format # If using the old logging format
${status}= Run Keyword And Return Status Should Contain ${line} mINFO ${status}= Run Keyword And Return Status Should Contain ${line} mINFO
${logdeco} ${vars}= Run Keyword If ${status} Split String ${line} ${SPACE} 1 ${logdeco} ${vars}= Run Keyword If ${status} Split String ${line} ${SPACE} 1
Run Keyword If ${status} Set List Of Env Variables ${vars} Run Keyword If ${status} Set List Of Env Variables ${vars}
Return From Keyword If ${status} Return From Keyword If ${status}
# Split the log log into pieces, discarding the initial log decoration, and assign to env vars # 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 ${logmon} ${logday} ${logyear} ${logtime} ${loglevel} ${vars}= Split String ${line} max_split=5
Set List Of Env Variables ${vars} Set List Of Env Variables ${vars}
Get Docker Params Get Docker Params
# Get VCH docker params e.g. "-H 192.168.218.181:2376 --tls" # Get VCH docker params e.g. "-H 192.168.218.181:2376 --tls"
[Arguments] ${output} ${certs} [Arguments] ${output} ${certs}
@{output}= Split To Lines ${output} @{output}= Split To Lines ${output}
:FOR ${item} IN @{output} :FOR ${item} IN @{output}
\ ${status} ${message}= Run Keyword And Ignore Error Should Contain ${item} DOCKER_HOST= \ ${status} ${message}= Run Keyword And Ignore Error Should Contain ${item} DOCKER_HOST=
\ Run Keyword If '${status}' == 'PASS' Set Suite Variable ${line} ${item} \ Run Keyword If '${status}' == 'PASS' Set Suite Variable ${line} ${item}
# Ensure we start from a clean slate with docker env vars # 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 Remove Environment Variable DOCKER_HOST DOCKER_TLS_VERIFY DOCKER_CERT_PATH CURL_CA_BUNDLE COMPOSE_PARAMS COMPOSE_TLS_VERSION
Parse Environment Variables ${line} Parse Environment Variables ${line}
${dockerHost}= Get Environment Variable DOCKER_HOST ${dockerHost}= Get Environment Variable DOCKER_HOST
@{hostParts}= Split String ${dockerHost} : @{hostParts}= Split String ${dockerHost} :
${ip}= Strip String @{hostParts}[0] ${ip}= Strip String @{hostParts}[0]
${port}= Strip String @{hostParts}[1] ${port}= Strip String @{hostParts}[1]
Set Environment Variable VCH-IP ${ip} Set Environment Variable VCH-IP ${ip}
Set Environment Variable VCH-PORT ${port} Set Environment Variable VCH-PORT ${port}
:FOR ${index} ${item} IN ENUMERATE @{output} :FOR ${index} ${item} IN ENUMERATE @{output}
\ ${status} ${message}= Run Keyword And Ignore Error Should Contain ${item} http \ ${status} ${message}= Run Keyword And Ignore Error Should Contain ${item} http
\ Run Keyword If '${status}' == 'PASS' Set Suite Variable ${line} ${item} \ 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 \ ${status} ${message}= Run Keyword And Ignore Error Should Contain ${item} Published ports can be reached at
\ ${idx} = Evaluate ${index} + 1 \ ${idx} = Evaluate ${index} + 1
\ Run Keyword If '${status}' == 'PASS' Set Suite Variable ${ext-ip} @{output}[${idx}] \ Run Keyword If '${status}' == 'PASS' Set Suite Variable ${ext-ip} @{output}[${idx}]
${rest} ${ext-ip} = Split String From Right ${ext-ip} ${SPACE} 1 ${rest} ${ext-ip} = Split String From Right ${ext-ip} ${SPACE} 1
${ext-ip} = Strip String ${ext-ip} ${ext-ip} = Strip String ${ext-ip}
Set Environment Variable EXT-IP ${ext-ip} Set Environment Variable EXT-IP ${ext-ip}
${rest} ${vic-admin}= Split String From Right ${line} ${SPACE} 1 ${rest} ${vic-admin}= Split String From Right ${line} ${SPACE} 1
Set Environment Variable VIC-ADMIN ${vic-admin} Set Environment Variable VIC-ADMIN ${vic-admin}
Run Keyword If ${port} == 2376 Set Environment Variable VCH-PARAMS -H ${dockerHost} --tls 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} Run Keyword If ${port} == 2375 Set Environment Variable VCH-PARAMS -H ${dockerHost}
### Add environment variables for Compose and TLS ### 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 # 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} ${tls_enabled}= Get Environment Variable DOCKER_TLS_VERIFY ${false}
### Compose case for no-tlsverify ### Compose case for no-tlsverify
# Set environment variables if certs not used to create the VCH. This is NOT the recommended # 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 # 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 # 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 # --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. # 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} 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 # 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 Run Keyword If ${tls_enabled} == ${false} Set Environment Variable COMPOSE-PARAMS -H ${dockerHost} --tls
### Compose case for tlsverify (assumes DOCKER_TLS_VERIFY also set) ### 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_TLS_VERSION TLSv1_2
Run Keyword If ${tls_enabled} == ${true} Set Environment Variable COMPOSE-PARAMS -H ${dockerHost} Run Keyword If ${tls_enabled} == ${true} Set Environment Variable COMPOSE-PARAMS -H ${dockerHost}
Install VIC Appliance To Test Server 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} [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 Set Test Environment Variables
# disable firewall # disable firewall
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.esxcli network firewall set -e false Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.esxcli network firewall set -e false
# Attempt to cleanup old/canceled tests # 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 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 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 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 vSwitches On Test Server
Run Keyword If ${cleanup} Run Keyword And Ignore Error Cleanup Dangling Containers On Test Server Run Keyword If ${cleanup} Run Keyword And Ignore Error Cleanup Dangling Containers On Test Server
# Install the VCH now # Install the VCH now
Log To Console \nInstalling VCH to test server... Log To Console \nInstalling VCH to test server...
${output}= Run VIC Machine Command ${vic-machine} ${appliance-iso} ${bootstrap-iso} ${certs} ${vol} ${output}= Run VIC Machine Command ${vic-machine} ${appliance-iso} ${bootstrap-iso} ${certs} ${vol}
Log ${output} Log ${output}
Should Contain ${output} Installer completed successfully Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${certs} Get Docker Params ${output} ${certs}
Log To Console Installer completed successfully: %{VCH-NAME}... Log To Console Installer completed successfully: %{VCH-NAME}...
Run VIC Machine Command Run VIC Machine Command
[Tags] secret [Tags] secret
[Arguments] ${vic-machine} ${appliance-iso} ${bootstrap-iso} ${certs} ${vol} [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} ${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 Run Keyword If ${certs} Should Contain ${output} Installer completed successfully
Return From Keyword If ${certs} ${output} 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 ${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 Run Keyword Unless ${certs} Should Contain ${output} Installer completed successfully
[Return] ${output} [Return] ${output}
Run Secret VIC Machine Delete Command Run Secret VIC Machine Delete Command
[Tags] secret [Tags] secret
[Arguments] ${vch-name} [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} ${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} [Return] ${rc} ${output}
Run Secret VIC Machine Inspect Command Run Secret VIC Machine Inspect Command
[Tags] secret [Tags] secret
[Arguments] ${name} [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} ${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} [Return] ${rc} ${output}
Run VIC Machine Delete Command Run VIC Machine Delete Command
${rc} ${output}= Run Secret VIC Machine Delete Command %{VCH-NAME} ${rc} ${output}= Run Secret VIC Machine Delete Command %{VCH-NAME}
Wait Until Keyword Succeeds 6x 5s Check Delete Success %{VCH-NAME} Wait Until Keyword Succeeds 6x 5s Check Delete Success %{VCH-NAME}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Should Contain ${output} Completed successfully Should Contain ${output} Completed successfully
${output}= Run rm -rf %{VCH-NAME} ${output}= Run rm -rf %{VCH-NAME}
[Return] ${output} [Return] ${output}
Run VIC Machine Inspect Command Run VIC Machine Inspect Command
${rc} ${output}= Run Secret VIC Machine Inspect Command %{VCH-NAME} ${rc} ${output}= Run Secret VIC Machine Inspect Command %{VCH-NAME}
Get Docker Params ${output} ${true} Get Docker Params ${output} ${true}
Gather Logs From Test Server Gather Logs From Test Server
[Tags] secret [Tags] secret
Run Keyword And Continue On Failure Run zip %{VCH-NAME}-certs -r %{VCH-NAME} 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 ${out}= Run curl -k -D vic-admin-cookies -Fusername=%{TEST_USERNAME} -Fpassword=%{TEST_PASSWORD} %{VIC-ADMIN}/authentication
Log ${out} Log ${out}
${out}= Run curl -k -b vic-admin-cookies %{VIC-ADMIN}/container-logs.zip -o ${SUITE NAME}-%{VCH-NAME}-container-logs.zip ${out}= Run curl -k -b vic-admin-cookies %{VIC-ADMIN}/container-logs.zip -o ${SUITE NAME}-%{VCH-NAME}-container-logs.zip
Log ${out} Log ${out}
Remove File vic-admin-cookies Remove File vic-admin-cookies
${out}= Run govc datastore.download %{VCH-NAME}/vmware.log %{VCH-NAME}-vmware.log ${out}= Run govc datastore.download %{VCH-NAME}/vmware.log %{VCH-NAME}-vmware.log
Should Contain ${out} OK Should Contain ${out} OK
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc logs -log=vmkernel -n=10000 > vmkernel.log Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc logs -log=vmkernel -n=10000 > vmkernel.log
Check For The Proper Log Files Check For The Proper Log Files
[Arguments] ${container} [Arguments] ${container}
# Ensure container logs are correctly being gathered for debugging purposes # 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} ${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 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 - ${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 Should Be Equal As Integers ${rc} 0
Log ${output} Log ${output}
Should Contain ${output} ${container}/output.log Should Contain ${output} ${container}/output.log
Should Contain ${output} ${container}/vmware.log Should Contain ${output} ${container}/vmware.log
Should Contain ${output} ${container}/tether.debug Should Contain ${output} ${container}/tether.debug
Scrape Logs For the Password Scrape Logs For the Password
[Tags] secret [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} ${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 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}" ${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 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}" ${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 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}" ${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 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}" ${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 Should Be Equal As Integers ${rc} 1
Remove File /tmp/cookies-%{VCH-NAME} Remove File /tmp/cookies-%{VCH-NAME}
Cleanup VIC Appliance On Test Server Cleanup VIC Appliance On Test Server
Log To Console Gathering logs from the test server %{VCH-NAME} Log To Console Gathering logs from the test server %{VCH-NAME}
Gather Logs From Test Server Gather Logs From Test Server
Log To Console Deleting the VCH appliance %{VCH-NAME} Log To Console Deleting the VCH appliance %{VCH-NAME}
${output}= Run VIC Machine Delete Command ${output}= Run VIC Machine Delete Command
Run Keyword And Ignore Error Cleanup VCH Bridge Network %{VCH-NAME} Run Keyword And Ignore Error Cleanup VCH Bridge Network %{VCH-NAME}
[Return] ${output} [Return] ${output}
Cleanup VCH Bridge Network Cleanup VCH Bridge Network
[Arguments] ${name} [Arguments] ${name}
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.remove ${name}-bridge 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 ${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.info
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Should Not Contain ${out} ${name}-bridge Run Keyword If '%{HOST_TYPE}' == 'ESXi' Should Not Contain ${out} ${name}-bridge
Cleanup Datastore On Test Server Cleanup Datastore On Test Server
${out}= Run govc datastore.ls ${out}= Run govc datastore.ls
${items}= Split To Lines ${out} ${items}= Split To Lines ${out}
:FOR ${item} IN @{items} :FOR ${item} IN @{items}
\ ${build}= Split String ${item} - \ ${build}= Split String ${item} -
\ # Skip any item that is not associated with integration tests \ # Skip any item that is not associated with integration tests
\ Continue For Loop If '@{build}[0]' != 'VCH' \ Continue For Loop If '@{build}[0]' != 'VCH'
\ # Skip any item that is still running \ # Skip any item that is still running
\ ${state}= Get State Of Drone Build @{build}[1] \ ${state}= Get State Of Drone Build @{build}[1]
\ Continue For Loop If '${state}' == 'running' \ Continue For Loop If '${state}' == 'running'
\ Log To Console Removing the following item from datastore: ${item} \ Log To Console Removing the following item from datastore: ${item}
\ ${out}= Run govc datastore.rm ${item} \ ${out}= Run govc datastore.rm ${item}
\ Wait Until Keyword Succeeds 6x 5s Check Delete Success ${item} \ Wait Until Keyword Succeeds 6x 5s Check Delete Success ${item}
Cleanup Dangling VMs On Test Server Cleanup Dangling VMs On Test Server
${out}= Run govc ls vm ${out}= Run govc ls vm
${vms}= Split To Lines ${out} ${vms}= Split To Lines ${out}
:FOR ${vm} IN @{vms} :FOR ${vm} IN @{vms}
\ ${vm}= Fetch From Right ${vm} / \ ${vm}= Fetch From Right ${vm} /
\ ${build}= Split String ${vm} - \ ${build}= Split String ${vm} -
\ # Skip any VM that is not associated with integration tests \ # Skip any VM that is not associated with integration tests
\ Continue For Loop If '@{build}[0]' != 'VCH' \ Continue For Loop If '@{build}[0]' != 'VCH'
\ # Skip any VM that is still running \ # Skip any VM that is still running
\ ${state}= Get State Of Drone Build @{build}[1] \ ${state}= Get State Of Drone Build @{build}[1]
\ Continue For Loop If '${state}' == 'running' \ Continue For Loop If '${state}' == 'running'
\ ${uuid}= Run govc vm.info -json\=true ${vm} | jq -r '.VirtualMachines[0].Config.Uuid' \ ${uuid}= Run govc vm.info -json\=true ${vm} | jq -r '.VirtualMachines[0].Config.Uuid'
\ Log To Console Destroying dangling VCH: ${vm} \ Log To Console Destroying dangling VCH: ${vm}
\ ${rc} ${output}= Run Secret VIC Machine Delete Command ${vm} \ ${rc} ${output}= Run Secret VIC Machine Delete Command ${vm}
\ Wait Until Keyword Succeeds 6x 5s Check Delete Success ${vm} \ Wait Until Keyword Succeeds 6x 5s Check Delete Success ${vm}
Cleanup Dangling Networks On Test Server Cleanup Dangling Networks On Test Server
${out}= Run govc ls network ${out}= Run govc ls network
${nets}= Split To Lines ${out} ${nets}= Split To Lines ${out}
:FOR ${net} IN @{nets} :FOR ${net} IN @{nets}
\ ${net}= Fetch From Right ${net} / \ ${net}= Fetch From Right ${net} /
\ ${build}= Split String ${net} - \ ${build}= Split String ${net} -
\ # Skip any Network that is not associated with integration tests \ # Skip any Network that is not associated with integration tests
\ Continue For Loop If '@{build}[0]' != 'VCH' \ Continue For Loop If '@{build}[0]' != 'VCH'
\ # Skip any Network that is still running \ # Skip any Network that is still running
\ ${state}= Get State Of Drone Build @{build}[1] \ ${state}= Get State Of Drone Build @{build}[1]
\ Continue For Loop If '${state}' == 'running' \ Continue For Loop If '${state}' == 'running'
\ ${uuid}= Run govc host.portgroup.remove ${net} \ ${uuid}= Run govc host.portgroup.remove ${net}
Cleanup Dangling vSwitches On Test Server Cleanup Dangling vSwitches On Test Server
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.vswitch.info | grep VCH ${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.vswitch.info | grep VCH
${nets}= Split To Lines ${out} ${nets}= Split To Lines ${out}
:FOR ${net} IN @{nets} :FOR ${net} IN @{nets}
\ ${net}= Fetch From Right ${net} ${SPACE} \ ${net}= Fetch From Right ${net} ${SPACE}
\ ${build}= Split String ${net} - \ ${build}= Split String ${net} -
\ # Skip any vSwitch that is not associated with integration tests \ # Skip any vSwitch that is not associated with integration tests
\ Continue For Loop If '@{build}[0]' != 'VCH' \ Continue For Loop If '@{build}[0]' != 'VCH'
\ # Skip any vSwitch that is still running \ # Skip any vSwitch that is still running
\ ${state}= Get State Of Drone Build @{build}[1] \ ${state}= Get State Of Drone Build @{build}[1]
\ Continue For Loop If '${state}' == 'running' \ Continue For Loop If '${state}' == 'running'
\ ${uuid}= Run govc host.vswitch.remove ${net} \ ${uuid}= Run govc host.vswitch.remove ${net}
Get Scratch Disk From VM Info Get Scratch Disk From VM Info
[Arguments] ${vm} [Arguments] ${vm}
${disks}= Run govc vm.info -json ${vm} | jq -r '.VirtualMachines[].Layout.Disk[].DiskFile[]' ${disks}= Run govc vm.info -json ${vm} | jq -r '.VirtualMachines[].Layout.Disk[].DiskFile[]'
${disks}= Split To Lines ${disks} ${disks}= Split To Lines ${disks}
:FOR ${disk} IN @{disks} :FOR ${disk} IN @{disks}
\ ${disk}= Fetch From Right ${disk} ${SPACE} \ ${disk}= Fetch From Right ${disk} ${SPACE}
\ ${status}= Run Keyword And Return Status Should Contain ${disk} scratch.vmdk \ ${status}= Run Keyword And Return Status Should Contain ${disk} scratch.vmdk
\ Return From Keyword If ${status} ${disk} \ Return From Keyword If ${status} ${disk}
Cleanup Dangling Containers On Test Server Cleanup Dangling Containers On Test Server
${vms}= Run govc ls vm ${vms}= Run govc ls vm
${vms}= Split To Lines ${vms} ${vms}= Split To Lines ${vms}
:FOR ${vm} IN @{vms} :FOR ${vm} IN @{vms}
\ # Ignore VCH's, we only care about containers at this point \ # Ignore VCH's, we only care about containers at this point
\ ${status}= Run Keyword And Return Status Should Contain ${vm} VCH \ ${status}= Run Keyword And Return Status Should Contain ${vm} VCH
\ Continue For Loop If ${status} \ Continue For Loop If ${status}
\ ${disk}= Get Scratch Disk From VM Info ${vm} \ ${disk}= Get Scratch Disk From VM Info ${vm}
\ ${vch}= Fetch From Left ${disk} / \ ${vch}= Fetch From Left ${disk} /
\ ${vch}= Split String ${vch} - \ ${vch}= Split String ${vch} -
\ # Skip any VM that is not associated with integration tests \ # Skip any VM that is not associated with integration tests
\ Continue For Loop If '@{vch}[0]' != 'VCH' \ Continue For Loop If '@{vch}[0]' != 'VCH'
\ ${state}= Get State Of Drone Build @{vch}[1] \ ${state}= Get State Of Drone Build @{vch}[1]
\ # Skip any VM that is still running \ # Skip any VM that is still running
\ Continue For Loop If '${state}' == 'running' \ Continue For Loop If '${state}' == 'running'
\ # Destroy the VM and remove it from datastore because it is a dangling container \ # Destroy the VM and remove it from datastore because it is a dangling container
\ Log To Console Cleaning up dangling container: ${vm} \ Log To Console Cleaning up dangling container: ${vm}
\ ${out}= Run govc vm.destroy ${vm} \ ${out}= Run govc vm.destroy ${vm}
\ ${name}= Fetch From Right ${vm} / \ ${name}= Fetch From Right ${vm} /
\ ${out}= Run govc datastore.rm ${name} \ ${out}= Run govc datastore.rm ${name}
\ Wait Until Keyword Succeeds 6x 5s Check Delete Success ${name} \ Wait Until Keyword Succeeds 6x 5s Check Delete Success ${name}
# VCH upgrade helpers # VCH upgrade helpers
Install VIC with version to Test Server Install VIC with version to Test Server
[Arguments] ${version}=7315 ${insecureregistry}= [Arguments] ${version}=7315 ${insecureregistry}=
Log To Console \nDownloading vic ${version} from bintray... 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 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 ${rc} ${output}= Run And Return Rc And Output tar zxvf vic.tar.gz
Set Environment Variable TEST_TIMEOUT 20m0s 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} 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 VIC-ADMIN %{VCH-IP}:2378
Set Environment Variable INITIAL-VERSION ${version} Set Environment Variable INITIAL-VERSION ${version}
Clean up VIC Appliance And Local Binary Clean up VIC Appliance And Local Binary
Cleanup VIC Appliance On Test Server Cleanup VIC Appliance On Test Server
Run rm -rf vic.tar.gz vic Run rm -rf vic.tar.gz vic
Upgrade Upgrade
Log To Console \nUpgrading VCH... 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} ${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 Contain ${output} Completed successfully
Should Not Contain ${output} Rolling back upgrade Should Not Contain ${output} Rolling back upgrade
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Check Upgraded Version Check Upgraded Version
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux version ${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux version
@{vers}= Split String ${output} @{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} ${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} Completed successfully
Should Contain ${output} @{vers}[2] Should Contain ${output} @{vers}[2]
Should Not Contain ${output} %{INITIAL-VERSION} Should Not Contain ${output} %{INITIAL-VERSION}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Log ${output} Log ${output}
Get Docker Params ${output} ${true} Get Docker Params ${output} ${true}
Check Original Version Check Original Version
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux version ${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux version
@{vers}= Split String ${output} @{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} ${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} Completed successfully
Should Contain ${output} @{vers}[2] Should Contain ${output} @{vers}[2]
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Log ${output} Log ${output}
Get Docker Params ${output} ${true} Get Docker Params ${output} ${true}
Rollback Rollback
Log To Console \nTesting 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 ${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 Contain ${output} Completed successfully
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Enable VCH SSH 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} [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... 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 ${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 Be Equal As Integers ${rc} 0
Should Contain ${output} Completed successfully Should Contain ${output} Completed successfully

View File

@ -1,217 +1,217 @@
# Copyright Project Harbor Authors # Copyright Project Harbor Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License # limitations under the License
*** Settings *** *** Settings ***
Documentation This resource contains any keywords dealing with operations being performed on a Vsphere instance, mostly govc wrappers Documentation This resource contains any keywords dealing with operations being performed on a Vsphere instance, mostly govc wrappers
*** Keywords *** *** Keywords ***
Power On VM OOB Power On VM OOB
[Arguments] ${vm} ${vc_host} ${vc_user} ${vc_password} [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}" ${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 Should Be Equal As Integers ${rc} 0
Log To Console Waiting for VM to power on ... Log To Console Waiting for VM to power on ...
Wait Until VM Powers On "${vm}" ${vc_host} ${vc_user} ${vc_password} Wait Until VM Powers On "${vm}" ${vc_host} ${vc_user} ${vc_password}
Power Off VM OOB Power Off VM OOB
[Arguments] ${vm} ${vc_host} ${vc_user} ${vc_password} [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}" ${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} Log To Console ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Log To Console Waiting for VM to power off ... Log To Console Waiting for VM to power off ...
Wait Until VM Powers Off "${vm}" ${vc_host} ${vc_user} ${vc_password} Wait Until VM Powers Off "${vm}" ${vc_host} ${vc_user} ${vc_password}
Destroy VM OOB Destroy VM OOB
[Arguments] ${vm} [Arguments] ${vm}
${rc} ${output}= Run And Return Rc And Output govc vm.destroy "*-${vm}" ${rc} ${output}= Run And Return Rc And Output govc vm.destroy "*-${vm}"
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Put Host Into Maintenance Mode Put Host Into Maintenance Mode
${rc} ${output}= Run And Return Rc And Output govc host.maintenance.enter -host.ip=%{TEST_URL} ${rc} ${output}= Run And Return Rc And Output govc host.maintenance.enter -host.ip=%{TEST_URL}
Should Contain ${output} entering maintenance mode... OK Should Contain ${output} entering maintenance mode... OK
Remove Host From Maintenance Mode Remove Host From Maintenance Mode
${rc} ${output}= Run And Return Rc And Output govc host.maintenance.exit -host.ip=%{TEST_URL} ${rc} ${output}= Run And Return Rc And Output govc host.maintenance.exit -host.ip=%{TEST_URL}
Should Contain ${output} exiting maintenance mode... OK Should Contain ${output} exiting maintenance mode... OK
Reboot VM Reboot VM
[Arguments] ${vm} ${vc_host} ${vc_user} ${vc_password} [Arguments] ${vm} ${vc_host} ${vc_user} ${vc_password}
Log To Console Rebooting ${vm} ... Log To Console Rebooting ${vm} ...
Power Off VM OOB ${vm} ${vc_host} ${vc_user} ${vc_password} Power Off VM OOB ${vm} ${vc_host} ${vc_user} ${vc_password}
Power On 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 Log To Console ${vm} Powered On
Reset VM Reset VM
[Arguments] ${vm} ${vc_host} ${vc_user} ${vc_password} [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}" ${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} Log To Console ${output}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Log To Console Waiting for VM to reset ... 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 "${vm}" ${vc_host} ${vc_user} ${vc_password}
Wait Until VM Powers On Wait Until VM Powers On
[Arguments] ${vm} ${vc_host} ${vc_user} ${vc_password} [Arguments] ${vm} ${vc_host} ${vc_user} ${vc_password}
FOR ${idx} IN RANGE 0 30 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} ${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} Set Test Variable ${out} ${ret}
${status}= Run Keyword And Return Status Should Contain ${out} poweredOn ${status}= Run Keyword And Return Status Should Contain ${out} poweredOn
Return From Keyword If ${status} Return From Keyword If ${status}
Sleep 1 Sleep 1
END END
Fail VM did not power on within 30 seconds Fail VM did not power on within 30 seconds
Wait Until VM Powers Off Wait Until VM Powers Off
[Arguments] ${vm} ${vc_host} ${vc_user} ${vc_password} [Arguments] ${vm} ${vc_host} ${vc_user} ${vc_password}
FOR ${idx} IN RANGE 0 30 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} ${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} Set Test Variable ${out} ${ret}
${status}= Run Keyword And Return Status Should Contain ${out} poweredOff ${status}= Run Keyword And Return Status Should Contain ${out} poweredOff
Return From Keyword If ${status} Return From Keyword If ${status}
Sleep 1 Sleep 1
END END
Fail VM did not power off within 30 seconds Fail VM did not power off within 30 seconds
Wait Until VM Is Destroyed Wait Until VM Is Destroyed
[Arguments] ${vm} [Arguments] ${vm}
:FOR ${idx} IN RANGE 0 30 :FOR ${idx} IN RANGE 0 30
\ ${ret}= Run govc ls vm/${vm} \ ${ret}= Run govc ls vm/${vm}
\ Set Test Variable ${out} ${ret} \ Set Test Variable ${out} ${ret}
\ ${status}= Run Keyword And Return Status Should Be Empty ${out} \ ${status}= Run Keyword And Return Status Should Be Empty ${out}
\ Return From Keyword If ${status} \ Return From Keyword If ${status}
\ Sleep 1 \ Sleep 1
Fail VM was not destroyed within 30 seconds Fail VM was not destroyed within 30 seconds
Get VM IP Get VM IP
[Arguments] ${vm} [Arguments] ${vm}
${rc} ${out}= Run And Return Rc And Output govc vm.ip ${vm} ${rc} ${out}= Run And Return Rc And Output govc vm.ip ${vm}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
[Return] ${out} [Return] ${out}
Get VM Host Name Get VM Host Name
[Arguments] ${vm} [Arguments] ${vm}
${out}= Run govc vm.info ${vm} ${out}= Run govc vm.info ${vm}
${out}= Split To Lines ${out} ${out}= Split To Lines ${out}
${host}= Fetch From Right @{out}[-1] ${SPACE} ${host}= Fetch From Right @{out}[-1] ${SPACE}
[Return] ${host} [Return] ${host}
Get VM Info Get VM Info
[Arguments] ${vm} [Arguments] ${vm}
${rc} ${out}= Run And Return Rc And Output govc vm.info -r ${vm} ${rc} ${out}= Run And Return Rc And Output govc vm.info -r ${vm}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
[Return] ${out} [Return] ${out}
vMotion A VM vMotion A VM
[Arguments] ${vm} [Arguments] ${vm}
${host}= Get VM Host Name ${vm} ${host}= Get VM Host Name ${vm}
${status}= Run Keyword And Return Status Should Contain ${host} ${esx1-ip} ${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 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} Run Keyword Unless ${status} Run govc vm.migrate -host cls/${esx1-ip} -pool cls/Resources ${vm}
Create Test Server Snapshot Create Test Server Snapshot
[Arguments] ${vm} ${snapshot} [Arguments] ${vm} ${snapshot}
Set Environment Variable GOVC_URL %{BUILD_SERVER} Set Environment Variable GOVC_URL %{BUILD_SERVER}
${rc} ${out}= Run And Return Rc And Output govc snapshot.create -vm ${vm} ${snapshot} ${rc} ${out}= Run And Return Rc And Output govc snapshot.create -vm ${vm} ${snapshot}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Should Be Empty ${out} Should Be Empty ${out}
Set Environment Variable GOVC_URL %{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL} Set Environment Variable GOVC_URL %{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}
Revert Test Server Snapshot Revert Test Server Snapshot
[Arguments] ${vm} ${snapshot} [Arguments] ${vm} ${snapshot}
Set Environment Variable GOVC_URL %{BUILD_SERVER} Set Environment Variable GOVC_URL %{BUILD_SERVER}
${rc} ${out}= Run And Return Rc And Output govc snapshot.revert -vm ${vm} ${snapshot} ${rc} ${out}= Run And Return Rc And Output govc snapshot.revert -vm ${vm} ${snapshot}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Should Be Empty ${out} Should Be Empty ${out}
Set Environment Variable GOVC_URL %{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL} Set Environment Variable GOVC_URL %{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}
Delete Test Server Snapshot Delete Test Server Snapshot
[Arguments] ${vm} ${snapshot} [Arguments] ${vm} ${snapshot}
Set Environment Variable GOVC_URL %{BUILD_SERVER} Set Environment Variable GOVC_URL %{BUILD_SERVER}
${rc} ${out}= Run And Return Rc And Output govc snapshot.remove -vm ${vm} ${snapshot} ${rc} ${out}= Run And Return Rc And Output govc snapshot.remove -vm ${vm} ${snapshot}
Should Be Equal As Integers ${rc} 0 Should Be Equal As Integers ${rc} 0
Should Be Empty ${out} Should Be Empty ${out}
Set Environment Variable GOVC_URL %{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL} Set Environment Variable GOVC_URL %{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}
Setup Snapshot Setup Snapshot
${hostname}= Get Test Server Hostname ${hostname}= Get Test Server Hostname
Set Environment Variable TEST_HOSTNAME ${hostname} Set Environment Variable TEST_HOSTNAME ${hostname}
Set Environment Variable SNAPSHOT vic-ci-test-%{DRONE_BUILD_NUMBER} Set Environment Variable SNAPSHOT vic-ci-test-%{DRONE_BUILD_NUMBER}
Create Test Server Snapshot %{TEST_HOSTNAME} %{SNAPSHOT} Create Test Server Snapshot %{TEST_HOSTNAME} %{SNAPSHOT}
Get Datacenter Name Get Datacenter Name
${out}= Run govc datacenter.info ${out}= Run govc datacenter.info
${out}= Split To Lines ${out} ${out}= Split To Lines ${out}
${name}= Fetch From Right @{out}[0] ${SPACE} ${name}= Fetch From Right @{out}[0] ${SPACE}
[Return] ${name} [Return] ${name}
Get Test Server Hostname Get Test Server Hostname
[Tags] secret [Tags] secret
${hostname}= Run sshpass -p $TEST_PASSWORD ssh $TEST_USERNAME@$TEST_URL hostname ${hostname}= Run sshpass -p $TEST_PASSWORD ssh $TEST_USERNAME@$TEST_URL hostname
[Return] ${hostname} [Return] ${hostname}
Check Delete Success Check Delete Success
[Arguments] ${name} [Arguments] ${name}
${out}= Run govc ls vm ${out}= Run govc ls vm
Log ${out} Log ${out}
Should Not Contain ${out} ${name} Should Not Contain ${out} ${name}
${out}= Run govc datastore.ls ${out}= Run govc datastore.ls
Log ${out} Log ${out}
Should Not Contain ${out} ${name} Should Not Contain ${out} ${name}
${out}= Run govc ls host/*/Resources/* ${out}= Run govc ls host/*/Resources/*
Log ${out} Log ${out}
Should Not Contain ${out} ${name} Should Not Contain ${out} ${name}
Gather Logs From ESX Server Gather Logs From ESX Server
Environment Variable Should Be Set TEST_URL Environment Variable Should Be Set TEST_URL
${out}= Run govc logs.download ${out}= Run govc logs.download
Change Log Level On Server Change Log Level On Server
[Arguments] ${level} [Arguments] ${level}
${out}= Run govc host.option.set Config.HostAgent.log.level ${level} ${out}= Run govc host.option.set Config.HostAgent.log.level ${level}
Should Be Empty ${out} Should Be Empty ${out}
Add Vsphere License Add Vsphere License
[Tags] secret [Tags] secret
[Arguments] ${license} [Arguments] ${license}
${out}= Run govc license.add ${license} ${out}= Run govc license.add ${license}
Should Contain ${out} Key: Should Contain ${out} Key:
Assign Vsphere License Assign Vsphere License
[Tags] secret [Tags] secret
[Arguments] ${license} ${host} [Arguments] ${license} ${host}
${out}= Run govc license.assign -host ${host} ${license} ${out}= Run govc license.assign -host ${host} ${license}
Should Contain ${out} Key: Should Contain ${out} Key:
Add Host To VCenter Add Host To VCenter
[Arguments] ${host} ${user} ${dc} ${pw} [Arguments] ${host} ${user} ${dc} ${pw}
:FOR ${idx} IN RANGE 1 4 :FOR ${idx} IN RANGE 1 4
\ ${out}= Run govc cluster.add -hostname=${host} -username=${user} -dc=${dc} -password=${pw} -noverify=true \ ${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 \ ${status}= Run Keyword And Return Status Should Contain ${out} OK
\ Return From Keyword If ${status} \ Return From Keyword If ${status}
Fail Failed to add the host to the VC in 3 attempts Fail Failed to add the host to the VC in 3 attempts
Get Host Firewall Enabled Get Host Firewall Enabled
${output}= Run govc host.esxcli network firewall get ${output}= Run govc host.esxcli network firewall get
Should Contain ${output} Enabled Should Contain ${output} Enabled
@{output}= Split To Lines ${output} @{output}= Split To Lines ${output}
:FOR ${line} IN @{output} :FOR ${line} IN @{output}
\ Run Keyword If "Enabled" in '''${line}''' Set Test Variable ${out} ${line} \ Run Keyword If "Enabled" in '''${line}''' Set Test Variable ${out} ${line}
${enabled}= Fetch From Right ${out} : ${enabled}= Fetch From Right ${out} :
${enabled}= Strip String ${enabled} ${enabled}= Strip String ${enabled}
Return From Keyword If '${enabled}' == 'false' ${false} Return From Keyword If '${enabled}' == 'false' ${false}
Return From Keyword If '${enabled}' == 'true' ${true} Return From Keyword If '${enabled}' == 'true' ${true}
Enable Host Firewall Enable Host Firewall
Run govc host.esxcli network firewall set --enabled true Run govc host.esxcli network firewall set --enabled true
Disable Host Firewall Disable Host Firewall
Run govc host.esxcli network firewall set --enabled false Run govc host.esxcli network firewall set --enabled false

View File

@ -1,22 +1,22 @@
// Copyright Project Harbor Authors // Copyright Project Harbor Authors
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
*** Settings *** *** Settings ***
Documentation Harbor BATs Documentation Harbor BATs
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
Default Tags Bundle Default Tags Bundle
*** Test Cases *** *** Test Cases ***
Distro Harbor Offline Distro Harbor Offline
Package Harbor Offline Package Harbor Offline

View File

@ -1,22 +1,22 @@
// Copyright Project Harbor Authors // Copyright Project Harbor Authors
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
*** Settings *** *** Settings ***
Documentation Harbor BATs Documentation Harbor BATs
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
Default Tags Bundle Default Tags Bundle
*** Test Cases *** *** Test Cases ***
Distro Harbor Online Distro Harbor Online
Package Harbor Online Package Harbor Online

File diff suppressed because it is too large Load Diff

View File

@ -1,125 +1,125 @@
// Copyright Project Harbor Authors // Copyright Project Harbor Authors
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
*** Settings *** *** Settings ***
Documentation Harbor BATs Documentation Harbor BATs
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
Default Tags Nightly Default Tags Nightly
*** Variables *** *** Variables ***
${HARBOR_URL} https://${OIDC_HOSTNAME} ${HARBOR_URL} https://${OIDC_HOSTNAME}
${HARBOR_ADMIN} admin ${HARBOR_ADMIN} admin
*** Test Cases *** *** Test Cases ***
Test Case - Get Harbor Version Test Case - Get Harbor Version
#Just get harbor version and log it #Just get harbor version and log it
Get Harbor Version Get Harbor Version
Test Case - OIDC User Sign In Test Case - OIDC User Sign In
#Sign in with all 9 users is for user population, other test cases might use these users. #Sign in with all 9 users is for user population, other test cases might use these users.
Sign In Harbor With OIDC User ${HARBOR_URL} Sign In Harbor With OIDC User ${HARBOR_URL}
Sleep 2 Sleep 2
Sign In Harbor With OIDC User ${HARBOR_URL} test2 Sign In Harbor With OIDC User ${HARBOR_URL} test2
Sleep 2 Sleep 2
Sign In Harbor With OIDC User ${HARBOR_URL} test3 Sign In Harbor With OIDC User ${HARBOR_URL} test3
Sleep 2 Sleep 2
Sign In Harbor With OIDC User ${HARBOR_URL} test4 Sign In Harbor With OIDC User ${HARBOR_URL} test4
Sleep 2 Sleep 2
Sign In Harbor With OIDC User ${HARBOR_URL} test5 Sign In Harbor With OIDC User ${HARBOR_URL} test5
Sleep 2 Sleep 2
Sign In Harbor With OIDC User ${HARBOR_URL} test6 Sign In Harbor With OIDC User ${HARBOR_URL} test6
Sleep 2 Sleep 2
Sign In Harbor With OIDC User ${HARBOR_URL} test7 Sign In Harbor With OIDC User ${HARBOR_URL} test7
Sleep 2 Sleep 2
Close Browser Close Browser
Test Case - Create An New Project Test Case - Create An New Project
Sign In Harbor With OIDC User ${HARBOR_URL} Sign In Harbor With OIDC User ${HARBOR_URL}
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New Project And Go Into Project test${d} Create An New Project And Go Into Project test${d}
Close Browser Close Browser
Test Case - Delete A Project Test Case - Delete A Project
Init Chrome Driver Init Chrome Driver
Sign In Harbor With OIDC User ${HARBOR_URL} Sign In Harbor With OIDC User ${HARBOR_URL}
${secret}= Get Secrete By API ${HARBOR_URL} ${secret}= Get Secrete By API ${HARBOR_URL}
Delete A Project Without Sign In Harbor harbor_ip=${OIDC_HOSTNAME} username=${OIDC_USERNAME} password=${secret} Delete A Project Without Sign In Harbor harbor_ip=${OIDC_HOSTNAME} username=${OIDC_USERNAME} password=${secret}
Close Browser Close Browser
Test Case - Manage Project Member Test Case - Manage Project Member
Init Chrome Driver Init Chrome Driver
Sign In Harbor With OIDC User ${HARBOR_URL} Sign In Harbor With OIDC User ${HARBOR_URL}
${secret}= Get Secrete By API ${HARBOR_URL} ${secret}= Get Secrete By API ${HARBOR_URL}
Manage Project Member Without Sign In Harbor sign_in_user=${OIDC_USERNAME} sign_in_pwd=${secret} test_user1=test2 test_user2=test3 is_oidc_mode=${true} Manage Project Member Without Sign In Harbor sign_in_user=${OIDC_USERNAME} sign_in_pwd=${secret} test_user1=test2 test_user2=test3 is_oidc_mode=${true}
Close Browser Close Browser
Test Case - Generate User CLI Secret Test Case - Generate User CLI Secret
Init Chrome Driver Init Chrome Driver
${d}= Get current Date result_format=%m%s ${d}= Get current Date result_format=%m%s
${image}= Set Variable hello-world ${image}= Set Variable hello-world
Sign In Harbor With OIDC User ${HARBOR_URL} Sign In Harbor With OIDC User ${HARBOR_URL}
Create An New Project And Go Into Project project${d} Create An New Project And Go Into Project project${d}
${secret_old}= Get Secrete By API ${HARBOR_URL} ${secret_old}= Get Secrete By API ${HARBOR_URL}
Push image ${ip} ${OIDC_USERNAME} ${secret_old} project${d} ${image} Push image ${ip} ${OIDC_USERNAME} ${secret_old} project${d} ${image}
${secret_new}= Generate And Return Secret ${HARBOR_URL} ${secret_new}= Generate And Return Secret ${HARBOR_URL}
Log To Console ${secret_old} Log To Console ${secret_old}
Log To Console ${secret_new} Log To Console ${secret_new}
Should Not Be Equal As Strings '${secret_old}' '${secret_new}' Should Not Be Equal As Strings '${secret_old}' '${secret_new}'
Cannot Docker Login Harbor ${ip} ${OIDC_USERNAME} ${secret_old} Cannot Docker Login Harbor ${ip} ${OIDC_USERNAME} ${secret_old}
Pull image ${ip} ${OIDC_USERNAME} ${secret_new} project${d} ${image} Pull image ${ip} ${OIDC_USERNAME} ${secret_new} project${d} ${image}
Push image ${ip} ${OIDC_USERNAME} ${secret_new} project${d} ${image} Push image ${ip} ${OIDC_USERNAME} ${secret_new} project${d} ${image}
Close Browser Close Browser
Test Case - Helm CLI Push Test Case - Helm CLI Push
Init Chrome Driver Init Chrome Driver
Sign In Harbor With OIDC User ${HARBOR_URL} Sign In Harbor With OIDC User ${HARBOR_URL}
${secret}= Get Secrete By API ${HARBOR_URL} ${secret}= Get Secrete By API ${HARBOR_URL}
Helm CLI Push Without Sign In Harbor ${OIDC_USERNAME} ${secret} Helm CLI Push Without Sign In Harbor ${OIDC_USERNAME} ${secret}
Close Browser Close Browser
Test Case - Onboard OIDC User Sign In Test Case - Onboard OIDC User Sign In
Init Chrome Driver Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Check Automatic Onboarding And Save Check Automatic Onboarding And Save
Logout Harbor Logout Harbor
Sign In Harbor With OIDC User ${HARBOR_URL} test8 is_onboard=${true} Sign In Harbor With OIDC User ${HARBOR_URL} test8 is_onboard=${true}
Logout Harbor Logout Harbor
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Set User Name Claim And Save email Set User Name Claim And Save email
Logout Harbor Logout Harbor
Sign In Harbor With OIDC User ${HARBOR_URL} test9 is_onboard=${true} username_claim=email Sign In Harbor With OIDC User ${HARBOR_URL} test9 is_onboard=${true} username_claim=email
Logout Harbor Logout Harbor
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Set User Name Claim And Save ${null} Set User Name Claim And Save ${null}
Sleep 2 Sleep 2
Close Browser Close Browser
Test Case - OIDC Group User Test Case - OIDC Group User
Init Chrome Driver Init Chrome Driver
${d}= Get current Date result_format=%m%s ${d}= Get current Date result_format=%m%s
${image}= Set Variable hello-world ${image}= Set Variable hello-world
${admin_user}= Set Variable admin_user ${admin_user}= Set Variable admin_user
${admin_pwd}= Set Variable zhu88jie ${admin_pwd}= Set Variable zhu88jie
${user}= Set Variable mike ${user}= Set Variable mike
${pwd}= Set Variable ${admin_pwd} ${pwd}= Set Variable ${admin_pwd}
Sign In Harbor With OIDC User ${HARBOR_URL} username=${admin_user} password=${admin_pwd} login_with_provider=ldap Sign In Harbor With OIDC User ${HARBOR_URL} username=${admin_user} password=${admin_pwd} login_with_provider=ldap
Switch To Registries Switch To Registries
Create A New Endpoint harbor test_oidc_admin https://cicd.harbor.vmwarecna.net ${null} ${null} Y Create A New Endpoint harbor test_oidc_admin https://cicd.harbor.vmwarecna.net ${null} ${null} Y
${secret}= Get Secrete By API ${HARBOR_URL} username=${admin_user} ${secret}= Get Secrete By API ${HARBOR_URL} username=${admin_user}
Push image ${ip} ${admin_user} ${secret} library ${image} Push image ${ip} ${admin_user} ${secret} library ${image}
Logout Harbor Logout Harbor
Sign In Harbor With OIDC User ${HARBOR_URL} username=${user} password=${pwd} login_with_provider=ldap Sign In Harbor With OIDC User ${HARBOR_URL} username=${user} password=${pwd} login_with_provider=ldap
${output}= Run Keyword And Ignore Error Switch To Configure ${output}= Run Keyword And Ignore Error Switch To Configure
Should Be Equal As Strings '${output[0]}' 'FAIL' Should Be Equal As Strings '${output[0]}' 'FAIL'
Close Browser Close Browser

View File

@ -1,308 +1,308 @@
// Copyright Project Harbor Authors // Copyright Project Harbor Authors
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
*** Settings *** *** Settings ***
Documentation Harbor BATs Documentation Harbor BATs
Library ../../apitests/python/testutils.py Library ../../apitests/python/testutils.py
Library ../../apitests/python/library/repository.py Library ../../apitests/python/library/repository.py
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
Default Tags Replication Default Tags Replication
*** Variables *** *** Variables ***
${HARBOR_URL} https://${ip} ${HARBOR_URL} https://${ip}
${SSH_USER} root ${SSH_USER} root
${HARBOR_ADMIN} admin ${HARBOR_ADMIN} admin
${SERVER} ${ip} ${SERVER} ${ip}
${SERVER_URL} https://${SERVER} ${SERVER_URL} https://${SERVER}
${SERVER_API_ENDPOINT} ${SERVER_URL}/api ${SERVER_API_ENDPOINT} ${SERVER_URL}/api
&{SERVER_CONFIG} endpoint=${SERVER_API_ENDPOINT} verify_ssl=False &{SERVER_CONFIG} endpoint=${SERVER_API_ENDPOINT} verify_ssl=False
${REMOTE_SERVER} ${ip1} ${REMOTE_SERVER} ${ip1}
${REMOTE_SERVER_URL} https://${REMOTE_SERVER} ${REMOTE_SERVER_URL} https://${REMOTE_SERVER}
${REMOTE_SERVER_API_ENDPOINT} ${REMOTE_SERVER_URL}/api ${REMOTE_SERVER_API_ENDPOINT} ${REMOTE_SERVER_URL}/api
*** Test Cases *** *** Test Cases ***
Test Case - Get Harbor Version Test Case - Get Harbor Version
#Just get harbor version and log it #Just get harbor version and log it
Get Harbor Version Get Harbor Version
Test Case - Pro Replication Rules Add Test Case - Pro Replication Rules Add
Init Chrome Driver Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries Switch To Registries
Switch To Replication Manage Switch To Replication Manage
Check New Rule UI Without Endpoint Check New Rule UI Without Endpoint
Close Browser Close Browser
Test Case - Harbor Endpoint Verification Test Case - Harbor Endpoint Verification
#This case need vailid info and selfsign cert #This case need vailid info and selfsign cert
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries Switch To Registries
Create A New Endpoint harbor edp1${d} https://${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} N Create A New Endpoint harbor edp1${d} https://${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} N
Endpoint Is Pingable Endpoint Is Pingable
Enable Certificate Verification Enable Certificate Verification
Endpoint Is Unpingable Endpoint Is Unpingable
Close Browser Close Browser
##Test Case - DockerHub Endpoint Add ##Test Case - DockerHub Endpoint Add
#This case need vailid info and selfsign cert #This case need vailid info and selfsign cert
##Init Chrome Driver ##Init Chrome Driver
##${d}= Get Current Date result_format=%m%s ##${d}= Get Current Date result_format=%m%s
##Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} ##Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
##Switch To Registries ##Switch To Registries
##Create A New Endpoint docker-hub edp1${d} https://hub.docker.com/ ${DOCKER_USER} ${DOCKER_PWD} Y ##Create A New Endpoint docker-hub edp1${d} https://hub.docker.com/ ${DOCKER_USER} ${DOCKER_PWD} Y
##Close Browser ##Close Browser
Test Case - Harbor Endpoint Add Test Case - Harbor Endpoint Add
#This case need vailid info and selfsign cert #This case need vailid info and selfsign cert
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries Switch To Registries
Create A New Endpoint harbor testabc https://${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Y Create A New Endpoint harbor testabc https://${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Y
Close Browser Close Browser
Test Case - Harbor Endpoint Edit Test Case - Harbor Endpoint Edit
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries Switch To Registries
Rename Endpoint testabc deletea Rename Endpoint testabc deletea
Retry Wait Until Page Contains deletea Retry Wait Until Page Contains deletea
Close Browser Close Browser
Test Case - Harbor Endpoint Delete Test Case - Harbor Endpoint Delete
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries Switch To Registries
Delete Endpoint deletea Delete Endpoint deletea
Delete Success deletea Delete Success deletea
Close Browser Close Browser
Test Case - Replication Rule Edit Test Case - Replication Rule Edit
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
${endpoint1}= Set Variable e1${d} ${endpoint1}= Set Variable e1${d}
${endpoint2}= Set Variable e2${d} ${endpoint2}= Set Variable e2${d}
${rule_name_old}= Set Variable rule_testabc${d} ${rule_name_old}= Set Variable rule_testabc${d}
${rule_name_new}= Set Variable rule_abctest${d} ${rule_name_new}= Set Variable rule_abctest${d}
${resource_type}= Set Variable chart ${resource_type}= Set Variable chart
${dest_namespace}= Set Variable dest_namespace${d} ${dest_namespace}= Set Variable dest_namespace${d}
${mode}= Set Variable Scheduled ${mode}= Set Variable Scheduled
${cron_str}= Set Variable 10 10 10 * * * ${cron_str}= Set Variable 10 10 10 * * *
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries Switch To Registries
#Due to docker-hub access limitation, remove docker-hub endpoint #Due to docker-hub access limitation, remove docker-hub endpoint
Create A New Endpoint harbor ${endpoint1} https://cicd.harbor.vmwarecna.net ${null} ${null} Y Create A New Endpoint harbor ${endpoint1} https://cicd.harbor.vmwarecna.net ${null} ${null} Y
Create A New Endpoint harbor ${endpoint2} https://${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Y Create A New Endpoint harbor ${endpoint2} https://${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Y
Switch To Replication Manage Switch To Replication Manage
Create A Rule With Existing Endpoint ${rule_name_old} pull nightly/a* image ${endpoint1} project${d} Create A Rule With Existing Endpoint ${rule_name_old} pull nightly/a* image ${endpoint1} project${d}
Edit Replication Rule ${rule_name_old} Edit Replication Rule ${rule_name_old}
# Change rule-name, source-registry, filter, trigger-mode for edition verification # Change rule-name, source-registry, filter, trigger-mode for edition verification
Clear Field Of Characters ${rule_name_input} 30 Clear Field Of Characters ${rule_name_input} 30
Retry Text Input ${rule_name_input} ${rule_name_new} Retry Text Input ${rule_name_input} ${rule_name_new}
Select Source Registry ${endpoint2} Select Source Registry ${endpoint2}
#Source Resource Filter #Source Resource Filter
Retry Text Input ${filter_name_id} project${d} Retry Text Input ${filter_name_id} project${d}
Select From List By Value ${rule_resource_selector} ${resource_type} Select From List By Value ${rule_resource_selector} ${resource_type}
Retry Text Input ${dest_namespace_xpath} ${dest_namespace} Retry Text Input ${dest_namespace_xpath} ${dest_namespace}
Select Trigger ${mode} Select Trigger ${mode}
Retry Text Input ${targetCron_id} ${cron_str} Retry Text Input ${targetCron_id} ${cron_str}
Retry Double Keywords When Error Retry Element Click ${rule_save_button} Retry Wait Until Page Not Contains Element ${rule_save_button} Retry Double Keywords When Error Retry Element Click ${rule_save_button} Retry Wait Until Page Not Contains Element ${rule_save_button}
# verify all items were changed as expected # verify all items were changed as expected
Edit Replication Rule ${rule_name_new} Edit Replication Rule ${rule_name_new}
Retry Textfield Value Should Be ${rule_name_input} ${rule_name_new} Retry Textfield Value Should Be ${rule_name_input} ${rule_name_new}
Retry List Selection Should Be ${src_registry_dropdown_list} ${endpoint2}-https://${ip} Retry List Selection Should Be ${src_registry_dropdown_list} ${endpoint2}-https://${ip}
Retry Textfield Value Should Be ${filter_name_id} project${d} Retry Textfield Value Should Be ${filter_name_id} project${d}
Retry Textfield Value Should Be ${dest_namespace_xpath} ${dest_namespace} Retry Textfield Value Should Be ${dest_namespace_xpath} ${dest_namespace}
Retry List Selection Should Be ${rule_resource_selector} ${resource_type} Retry List Selection Should Be ${rule_resource_selector} ${resource_type}
Retry List Selection Should Be ${rule_trigger_select} ${mode} Retry List Selection Should Be ${rule_trigger_select} ${mode}
Retry Textfield Value Should Be ${targetCron_id} ${cron_str} Retry Textfield Value Should Be ${targetCron_id} ${cron_str}
Retry Element Click ${rule_cancel_btn} Retry Element Click ${rule_cancel_btn}
Delete Replication Rule ${rule_name_new} Delete Replication Rule ${rule_name_new}
Close Browser Close Browser
Test Case - Replication Rule Delete Test Case - Replication Rule Delete
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
${endpoint1}= Set Variable e1${d} ${endpoint1}= Set Variable e1${d}
${rule_name}= Set Variable rule_testabc${d} ${rule_name}= Set Variable rule_testabc${d}
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries Switch To Registries
Create A New Endpoint harbor ${endpoint1} https://${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Y Create A New Endpoint harbor ${endpoint1} https://${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Y
Switch To Replication Manage Switch To Replication Manage
Create A Rule With Existing Endpoint ${rule_name} pull ${DOCKER_USER}/* image ${endpoint1} project${d} Create A Rule With Existing Endpoint ${rule_name} pull ${DOCKER_USER}/* image ${endpoint1} project${d}
Delete Replication Rule ${rule_name} Delete Replication Rule ${rule_name}
Close Browser Close Browser
Test Case - Replication Of Pull Images from DockerHub To Self Test Case - Replication Of Pull Images from DockerHub To Self
@{target_images}= Create List mariadb centos @{target_images}= Create List mariadb centos
&{image1_with_tag}= Create Dictionary image=centos tag=1.0 &{image1_with_tag}= Create Dictionary image=centos tag=1.0
&{image2_with_tag}= Create Dictionary image=mariadb tag=latest &{image2_with_tag}= Create Dictionary image=mariadb tag=latest
${image1}= Get From Dictionary ${image1_with_tag} image ${image1}= Get From Dictionary ${image1_with_tag} image
${image1}= Get Substring ${image1} 0 -2 ${image1}= Get Substring ${image1} 0 -2
Log All image1:${image1} Log All image1:${image1}
${image2}= Get From Dictionary ${image2_with_tag} image ${image2}= Get From Dictionary ${image2_with_tag} image
@{target_images}= Create List '&{image1_with_tag}' '&{image2_with_tag}' @{target_images}= Create List '&{image1_with_tag}' '&{image2_with_tag}'
Body Of Replication Of Pull Images from Registry To Self docker-hub https://hub.docker.com/ ${DOCKER_USER} ${DOCKER_PWD} ${DOCKER_USER}/{${image1}*,${image2}} ${null} N @{target_images} Body Of Replication Of Pull Images from Registry To Self docker-hub https://hub.docker.com/ ${DOCKER_USER} ${DOCKER_PWD} ${DOCKER_USER}/{${image1}*,${image2}} ${null} N @{target_images}
Test Case - Replication Of Push Images from Self To Harbor Test Case - Replication Of Push Images from Self To Harbor
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
#login source #login source
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project${d} Create An New Project And Go Into Project project${d}
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} hello-world Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} hello-world
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} busybox:latest Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} busybox:latest
Push Image With Tag ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} hello-world v1 Push Image With Tag ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} hello-world v1
Switch To Registries Switch To Registries
Create A New Endpoint harbor e${d} https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Create A New Endpoint harbor e${d} https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Replication Manage Switch To Replication Manage
Create A Rule With Existing Endpoint rule${d} push project${d}/* image e${d} project_dest${d} Create A Rule With Existing Endpoint rule${d} push project${d}/* image e${d} project_dest${d}
#logout and login target #logout and login target
Logout Harbor Logout Harbor
Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project_dest${d} Create An New Project And Go Into Project project_dest${d}
#logout and login source #logout and login source
Logout Harbor Logout Harbor
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Replication Manage Switch To Replication Manage
Select Rule And Replicate rule${d} Select Rule And Replicate rule${d}
Sleep 20 Sleep 20
Logout Harbor Logout Harbor
Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Image Should Be Replicated To Project project_dest${d} hello-world Image Should Be Replicated To Project project_dest${d} hello-world
Image Should Be Replicated To Project project_dest${d} busybox Image Should Be Replicated To Project project_dest${d} busybox
Close Browser Close Browser
Test Case - Replication Of Push Chart from Self To Harbor Test Case - Replication Of Push Chart from Self To Harbor
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
#login source #login source
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project${d} Create An New Project And Go Into Project project${d}
Switch To Project Charts Switch To Project Charts
Upload Chart files Upload Chart files
Switch To Registries Switch To Registries
Create A New Endpoint harbor e${d} https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Create A New Endpoint harbor e${d} https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Replication Manage Switch To Replication Manage
Create A Rule With Existing Endpoint rule${d} push project${d}/* chart e${d} project_dest${d} Create A Rule With Existing Endpoint rule${d} push project${d}/* chart e${d} project_dest${d}
#logout and login target #logout and login target
Logout Harbor Logout Harbor
Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project_dest${d} Create An New Project And Go Into Project project_dest${d}
#logout and login source #logout and login source
Logout Harbor Logout Harbor
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Replication Manage Switch To Replication Manage
Select Rule And Replicate rule${d} Select Rule And Replicate rule${d}
Sleep 20 Sleep 20
Logout Harbor Logout Harbor
Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Go Into Project project_dest${d} has_image=${false} Go Into Project project_dest${d} has_image=${false}
Switch To Project Charts Switch To Project Charts
Go Into Chart Version ${harbor_chart_name} Go Into Chart Version ${harbor_chart_name}
Retry Wait Until Page Contains ${harbor_chart_version} Retry Wait Until Page Contains ${harbor_chart_version}
Go Into Chart Detail ${harbor_chart_version} Go Into Chart Detail ${harbor_chart_version}
Close Browser Close Browser
Test Case - Replication Of Push Images from Self To Harbor By Push Event Test Case - Replication Of Push Images from Self To Harbor By Push Event
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
${image}= Set Variable test_large_image ${image}= Set Variable test_large_image
${image_size}= Set Variable 4096 ${image_size}= Set Variable 4096
${tag1}= Set Variable large_f ${tag1}= Set Variable large_f
@{tags} Create List ${tag1} @{tags} Create List ${tag1}
#login source #login source
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project${d} Create An New Project And Go Into Project project${d}
Switch To Registries Switch To Registries
Create A New Endpoint harbor e${d} https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Create A New Endpoint harbor e${d} https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Replication Manage Switch To Replication Manage
Create A Rule With Existing Endpoint rule${d} push project${d}/* image e${d} project_dest${d} Create A Rule With Existing Endpoint rule${d} push project${d}/* image e${d} project_dest${d}
... Event Based ... Event Based
#logout and login target #logout and login target
Logout Harbor Logout Harbor
Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project_dest${d} Create An New Project And Go Into Project project_dest${d}
Push Special Image To Project project${d} ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} ${image} tags=@{tags} size=${image_size} Push Special Image To Project project${d} ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} ${image} tags=@{tags} size=${image_size}
# Use tag as identifier for this artifact # Use tag as identifier for this artifact
Image Should Be Replicated To Project project_dest${d} ${image} tag=${tag1} expected_image_size_in_regexp=4(\\\.\\d{1,2})*GB Image Should Be Replicated To Project project_dest${d} ${image} tag=${tag1} expected_image_size_in_regexp=4(\\\.\\d{1,2})*GB
Close Browser Close Browser
Test Case - Replication Of Pull Images from AWS-ECR To Self Test Case - Replication Of Pull Images from AWS-ECR To Self
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
#login source #login source
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project${d} Create An New Project And Go Into Project project${d}
Switch To Registries Switch To Registries
Create A New Endpoint aws-ecr e${d} us-east-2 ${ecr_ac_id} ${ecr_ac_key} Y Create A New Endpoint aws-ecr e${d} us-east-2 ${ecr_ac_id} ${ecr_ac_key} Y
Switch To Replication Manage Switch To Replication Manage
Create A Rule With Existing Endpoint rule${d} pull a/* image e${d} project${d} Create A Rule With Existing Endpoint rule${d} pull a/* image e${d} project${d}
Select Rule And Replicate rule${d} Select Rule And Replicate rule${d}
Image Should Be Replicated To Project project${d} httpd Image Should Be Replicated To Project project${d} httpd
Image Should Be Replicated To Project project${d} alpine Image Should Be Replicated To Project project${d} alpine
Image Should Be Replicated To Project project${d} hello-world Image Should Be Replicated To Project project${d} hello-world
Close Browser Close Browser
Test Case - Replication Of Pull Images from Google-GCR To Self Test Case - Replication Of Pull Images from Google-GCR To Self
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
#login source #login source
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project${d} Create An New Project And Go Into Project project${d}
Switch To Registries Switch To Registries
Create A New Endpoint google-gcr e${d} asia.gcr.io ${null} ${gcr_ac_key} Y Create A New Endpoint google-gcr e${d} asia.gcr.io ${null} ${gcr_ac_key} Y
Switch To Replication Manage Switch To Replication Manage
Create A Rule With Existing Endpoint rule${d} pull eminent-nation-87317/* image e${d} project${d} Create A Rule With Existing Endpoint rule${d} pull eminent-nation-87317/* image e${d} project${d}
Filter Replication Rule rule${d} Filter Replication Rule rule${d}
Select Rule And Replicate rule${d} Select Rule And Replicate rule${d}
Image Should Be Replicated To Project project${d} httpd Image Should Be Replicated To Project project${d} httpd
Image Should Be Replicated To Project project${d} tomcat Image Should Be Replicated To Project project${d} tomcat
Close Browser Close Browser
Test Case - Replication Of Push Images to DockerHub Triggered By Event Test Case - Replication Of Push Images to DockerHub Triggered By Event
Body Of Replication Of Push Images to Registry Triggered By Event docker-hub https://hub.docker.com/ ${DOCKER_USER} ${DOCKER_PWD} ${DOCKER_USER} Body Of Replication Of Push Images to Registry Triggered By Event docker-hub https://hub.docker.com/ ${DOCKER_USER} ${DOCKER_PWD} ${DOCKER_USER}
#Due to issue of delete event replication #Due to issue of delete event replication
#Test Case - Replication Of Push Images to Google-GCR Triggered By Event #Test Case - Replication Of Push Images to Google-GCR Triggered By Event
#Body Of Replication Of Push Images to Registry Triggered By Event google-gcr gcr.io ${null} ${gcr_ac_key} eminent-nation-87317/harbor-nightly-replication #Body Of Replication Of Push Images to Registry Triggered By Event google-gcr gcr.io ${null} ${gcr_ac_key} eminent-nation-87317/harbor-nightly-replication
Test Case - Replication Of Push Images to AWS-ECR Triggered By Event Test Case - Replication Of Push Images to AWS-ECR Triggered By Event
Body Of Replication Of Push Images to Registry Triggered By Event aws-ecr us-east-2 ${ecr_ac_id} ${ecr_ac_key} harbor-nightly-replication Body Of Replication Of Push Images to Registry Triggered By Event aws-ecr us-east-2 ${ecr_ac_id} ${ecr_ac_key} harbor-nightly-replication
Test Case - Replication Of Pull Images from Gitlab To Self Test Case - Replication Of Pull Images from Gitlab To Self
&{image1_with_tag}= Create Dictionary image=photon tag=1.0 &{image1_with_tag}= Create Dictionary image=photon tag=1.0
&{image2_with_tag}= Create Dictionary image=alpine tag=latest &{image2_with_tag}= Create Dictionary image=alpine tag=latest
${image1}= Get From Dictionary ${image1_with_tag} image ${image1}= Get From Dictionary ${image1_with_tag} image
${image2}= Get From Dictionary ${image2_with_tag} image ${image2}= Get From Dictionary ${image2_with_tag} image
@{target_images}= Create List '&{image1_with_tag}' '&{image2_with_tag}' @{target_images}= Create List '&{image1_with_tag}' '&{image2_with_tag}'
Body Of Replication Of Pull Images from Registry To Self gitlab https://registry.gitlab.com ${gitlab_id} ${gitlab_key} dannylunsa/test_replication/{${image1},${image2}} ${null} N @{target_images} Body Of Replication Of Pull Images from Registry To Self gitlab https://registry.gitlab.com ${gitlab_id} ${gitlab_key} dannylunsa/test_replication/{${image1},${image2}} ${null} N @{target_images}
Test Case - Replication Of Push Images to Gitlab Triggered By Event Test Case - Replication Of Push Images to Gitlab Triggered By Event
Body Of Replication Of Push Images to Registry Triggered By Event gitlab https://registry.gitlab.com ${gitlab_id} ${gitlab_key} dannylunsa/test_replication Body Of Replication Of Push Images to Registry Triggered By Event gitlab https://registry.gitlab.com ${gitlab_id} ${gitlab_key} dannylunsa/test_replication
Test Case - Replication Of Pull Manifest List and CNAB from Harbor To Self Test Case - Replication Of Pull Manifest List and CNAB from Harbor To Self
&{image1_with_tag}= Create Dictionary image=busybox tag=1.32.0 total_artifact_count=9 archive_count=0 &{image1_with_tag}= Create Dictionary image=busybox tag=1.32.0 total_artifact_count=9 archive_count=0
&{image2_with_tag}= Create Dictionary image=index101603308079 tag=index_tag101603308079 total_artifact_count=2 archive_count=0 &{image2_with_tag}= Create Dictionary image=index101603308079 tag=index_tag101603308079 total_artifact_count=2 archive_count=0
&{image3_with_tag}= Create Dictionary image=cnab011609785126 tag=cnab_tag011609785126 total_artifact_count=3 archive_count=2 &{image3_with_tag}= Create Dictionary image=cnab011609785126 tag=cnab_tag011609785126 total_artifact_count=3 archive_count=2
${image1}= Get From Dictionary ${image1_with_tag} image ${image1}= Get From Dictionary ${image1_with_tag} image
${image2}= Get From Dictionary ${image2_with_tag} image ${image2}= Get From Dictionary ${image2_with_tag} image
${image3}= Get From Dictionary ${image3_with_tag} image ${image3}= Get From Dictionary ${image3_with_tag} image
@{target_images}= Create List '&{image1_with_tag}' '&{image2_with_tag}' '&{image3_with_tag}' @{target_images}= Create List '&{image1_with_tag}' '&{image2_with_tag}' '&{image3_with_tag}'
Body Of Replication Of Pull Images from Registry To Self harbor https://cicd.harbor.vmwarecna.net admin qA5ZgV nightly/{${image1},${image2},${image3}} ${null} Y @{target_images} Body Of Replication Of Pull Images from Registry To Self harbor https://cicd.harbor.vmwarecna.net admin qA5ZgV nightly/{${image1},${image2},${image3}} ${null} Y @{target_images}

View File

@ -1,28 +1,28 @@
// Copyright Project Harbor Authors // Copyright Project Harbor Authors
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
*** Settings *** *** Settings ***
Documentation Harbor BATs Documentation Harbor BATs
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
Default Tags Nightly Default Tags Nightly
*** Test Cases *** *** Test Cases ***
Test Suites Setup Test Suites Setup
[Tags] setup [Tags] setup
Nightly Test Setup In Photon ${ip} ${HARBOR_PASSWORD} ${ip1} Nightly Test Setup In Photon ${ip} ${HARBOR_PASSWORD} ${ip1}
Setup API Test Setup API Test
Test Case - Get Harbor Version Test Case - Get Harbor Version
#Just get harbor version and log it #Just get harbor version and log it
Get Harbor Version Get Harbor Version

View File

@ -1,28 +1,28 @@
// Copyright Project Harbor Authors // Copyright Project Harbor Authors
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
*** Settings *** *** Settings ***
Documentation Harbor BATs Documentation Harbor BATs
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
Default Tags Nightly Default Tags Nightly
*** Test Cases *** *** Test Cases ***
Test Suites Setup For UI Test Test Suites Setup For UI Test
[Tags] setup [Tags] setup
Nightly Test Setup In Ubuntu ${ip} ${HARBOR_PASSWORD} ${ip1} Nightly Test Setup In Ubuntu ${ip} ${HARBOR_PASSWORD} ${ip1}
Setup API Test Setup API Test
Test Case - Get Harbor Version Test Case - Get Harbor Version
#Just get harbor version and log it #Just get harbor version and log it
Get Harbor Version Get Harbor Version

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
from hurry.filesize import size from hurry.filesize import size
from hurry.filesize import alternative from hurry.filesize import alternative
def convert_int_to_readable_file_size(file_size): def convert_int_to_readable_file_size(file_size):
return size(file_size, system=alternative).replace(' ', '') return size(file_size, system=alternative).replace(' ', '')

View File

@ -1,117 +1,117 @@
*** Settings *** *** Settings ***
Documentation Harbor BATs Documentation Harbor BATs
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
Default Tags Nightly Default Tags Nightly
*** Variables *** *** Variables ***
${HARBOR_URL} https://${ip} ${HARBOR_URL} https://${ip}
${HARBOR_ADMIN} admin ${HARBOR_ADMIN} admin
*** Test Cases *** *** Test Cases ***
Test Case - Upgrade Verify Test Case - Upgrade Verify
[Tags] 1.8-latest [Tags] 1.8-latest
${data}= Load Json From File ${CURDIR}${/}data.json ${data}= Load Json From File ${CURDIR}${/}data.json
Run Keyword Verify User ${data} Run Keyword Verify User ${data}
Run Keyword Verify Project ${data} Run Keyword Verify Project ${data}
Run Keyword Verify Project Label ${data} Run Keyword Verify Project Label ${data}
Run Keyword Verify Project Metadata ${data} Run Keyword Verify Project Metadata ${data}
Run Keyword Verify Member Exist ${data} Run Keyword Verify Member Exist ${data}
Run Keyword Verify Robot Account Exist ${data} Run Keyword Verify Robot Account Exist ${data}
Run Keyword Verify User System Admin Role ${data} Run Keyword Verify User System Admin Role ${data}
Run Keyword Verify Endpoint ${data} Run Keyword Verify Endpoint ${data}
Run Keyword Verify Replicationrule ${data} Run Keyword Verify Replicationrule ${data}
Run Keyword Verify System Setting ${data} Run Keyword Verify System Setting ${data}
Run Keyword Verify Image Tag ${data} Run Keyword Verify Image Tag ${data}
Test Case - Upgrade Verify Test Case - Upgrade Verify
[Tags] 1.9-latest [Tags] 1.9-latest
${data}= Load Json From File ${CURDIR}${/}data.json ${data}= Load Json From File ${CURDIR}${/}data.json
Run Keyword Verify User ${data} Run Keyword Verify User ${data}
Run Keyword Verify Project ${data} Run Keyword Verify Project ${data}
Run Keyword Verify Project Label ${data} Run Keyword Verify Project Label ${data}
Run Keyword Verify Project Metadata ${data} Run Keyword Verify Project Metadata ${data}
Run Keyword Verify Member Exist ${data} Run Keyword Verify Member Exist ${data}
Run Keyword Verify Robot Account Exist ${data} Run Keyword Verify Robot Account Exist ${data}
Run Keyword Verify Project-level Allowlist ${data} Run Keyword Verify Project-level Allowlist ${data}
Run Keyword Verify Webhook ${data} Run Keyword Verify Webhook ${data}
Run Keyword Verify Tag Retention Rule ${data} Run Keyword Verify Tag Retention Rule ${data}
Run Keyword Verify User System Admin Role ${data} Run Keyword Verify User System Admin Role ${data}
Run Keyword Verify Endpoint ${data} Run Keyword Verify Endpoint ${data}
Run Keyword Verify Replicationrule ${data} Run Keyword Verify Replicationrule ${data}
Run Keyword Verify Interrogation Services ${data} Run Keyword Verify Interrogation Services ${data}
Run Keyword Verify System Setting ${data} Run Keyword Verify System Setting ${data}
Run Keyword Verify System Setting Allowlist ${data} Run Keyword Verify System Setting Allowlist ${data}
Run Keyword Verify Image Tag ${data} Run Keyword Verify Image Tag ${data}
Run Keyword Verify Trivy Is Default Scanner Run Keyword Verify Trivy Is Default Scanner
Test Case - Upgrade Verify Test Case - Upgrade Verify
[Tags] 1.10-latest [Tags] 1.10-latest
${data}= Load Json From File ${CURDIR}${/}data.json ${data}= Load Json From File ${CURDIR}${/}data.json
Run Keyword Verify User ${data} Run Keyword Verify User ${data}
Run Keyword Verify Project ${data} Run Keyword Verify Project ${data}
Run Keyword Verify Project Label ${data} Run Keyword Verify Project Label ${data}
Run Keyword Verify Project Metadata ${data} Run Keyword Verify Project Metadata ${data}
Run Keyword Verify Member Exist ${data} Run Keyword Verify Member Exist ${data}
Run Keyword Verify Robot Account Exist ${data} Run Keyword Verify Robot Account Exist ${data}
Run Keyword Verify Project-level Allowlist ${data} Run Keyword Verify Project-level Allowlist ${data}
Run Keyword Verify Webhook ${data} Run Keyword Verify Webhook ${data}
Run Keyword Verify Tag Retention Rule ${data} Run Keyword Verify Tag Retention Rule ${data}
Run Keyword Verify Tag Immutability Rule ${data} Run Keyword Verify Tag Immutability Rule ${data}
Run Keyword Verify User System Admin Role ${data} Run Keyword Verify User System Admin Role ${data}
Run Keyword Verify Endpoint ${data} Run Keyword Verify Endpoint ${data}
Run Keyword Verify Replicationrule ${data} Run Keyword Verify Replicationrule ${data}
Run Keyword Verify Interrogation Services ${data} Run Keyword Verify Interrogation Services ${data}
Run Keyword Verify System Setting ${data} Run Keyword Verify System Setting ${data}
Run Keyword Verify System Setting Allowlist ${data} Run Keyword Verify System Setting Allowlist ${data}
Run Keyword Verify Image Tag ${data} Run Keyword Verify Image Tag ${data}
Test Case - Upgrade Verify Test Case - Upgrade Verify
[Tags] 2.0-latest [Tags] 2.0-latest
${data}= Load Json From File ${CURDIR}${/}data.json ${data}= Load Json From File ${CURDIR}${/}data.json
Run Keyword Verify User ${data} Run Keyword Verify User ${data}
Run Keyword Verify Project ${data} Run Keyword Verify Project ${data}
Run Keyword Verify Project Metadata ${data} check_content_trust=${false} Run Keyword Verify Project Metadata ${data} check_content_trust=${false}
#Run Keyword Verify Project Label ${data} #Run Keyword Verify Project Label ${data}
Run Keyword Verify Member Exist ${data} Run Keyword Verify Member Exist ${data}
Run Keyword Verify Robot Account Exist ${data} Run Keyword Verify Robot Account Exist ${data}
Run Keyword Verify Project-level Allowlist ${data} Run Keyword Verify Project-level Allowlist ${data}
Run Keyword Verify Webhook For 2.0 ${data} Run Keyword Verify Webhook For 2.0 ${data}
Run Keyword Verify Tag Retention Rule ${data} Run Keyword Verify Tag Retention Rule ${data}
Run Keyword Verify Tag Immutability Rule ${data} Run Keyword Verify Tag Immutability Rule ${data}
Run Keyword Verify User System Admin Role ${data} Run Keyword Verify User System Admin Role ${data}
Run Keyword Verify Endpoint ${data} Run Keyword Verify Endpoint ${data}
Run Keyword Verify Replicationrule ${data} Run Keyword Verify Replicationrule ${data}
Run Keyword Verify Interrogation Services ${data} Run Keyword Verify Interrogation Services ${data}
Run Keyword Verify System Setting ${data} Run Keyword Verify System Setting ${data}
Run Keyword Verify System Setting Allowlist ${data} Run Keyword Verify System Setting Allowlist ${data}
Run Keyword Verify Image Tag ${data} Run Keyword Verify Image Tag ${data}
Run Keyword Verify Trivy Is Default Scanner Run Keyword Verify Trivy Is Default Scanner
Run Keyword Verify Artifact Index ${data} Run Keyword Verify Artifact Index ${data}
Run Keyword Verify Quotas Display ${data} Run Keyword Verify Quotas Display ${data}
Test Case - Upgrade Verify Test Case - Upgrade Verify
[Tags] 2.1-latest [Tags] 2.1-latest
${data}= Load Json From File ${CURDIR}${/}data.json ${data}= Load Json From File ${CURDIR}${/}data.json
Run Keyword Verify User ${data} Run Keyword Verify User ${data}
Run Keyword Verify Project ${data} verify_registry_name=${true} Run Keyword Verify Project ${data} verify_registry_name=${true}
Run Keyword Verify Project Metadata ${data} check_content_trust=${false} verify_registry_name=${true} Run Keyword Verify Project Metadata ${data} check_content_trust=${false} verify_registry_name=${true}
#Run Keyword Verify Project Label ${data} verify_registry_name=${true} #Run Keyword Verify Project Label ${data} verify_registry_name=${true}
Run Keyword Verify Member Exist ${data} verify_registry_name=${true} Run Keyword Verify Member Exist ${data} verify_registry_name=${true}
Run Keyword Verify Robot Account Exist ${data} verify_registry_name=${true} Run Keyword Verify Robot Account Exist ${data} verify_registry_name=${true}
Run Keyword Verify Project-level Allowlist ${data} verify_registry_name=${true} Run Keyword Verify Project-level Allowlist ${data} verify_registry_name=${true}
Run Keyword Verify Webhook For 2.0 ${data} verify_registry_name=${true} Run Keyword Verify Webhook For 2.0 ${data} verify_registry_name=${true}
Run Keyword Verify Tag Retention Rule ${data} verify_registry_name=${true} Run Keyword Verify Tag Retention Rule ${data} verify_registry_name=${true}
Run Keyword Verify Tag Immutability Rule ${data} verify_registry_name=${true} Run Keyword Verify Tag Immutability Rule ${data} verify_registry_name=${true}
Run Keyword Verify Image Tag ${data} verify_registry_name=${true} Run Keyword Verify Image Tag ${data} verify_registry_name=${true}
Run Keyword Verify User System Admin Role ${data} Run Keyword Verify User System Admin Role ${data}
Run Keyword Verify Endpoint ${data} Run Keyword Verify Endpoint ${data}
Run Keyword Verify Replicationrule ${data} Run Keyword Verify Replicationrule ${data}
Run Keyword Verify Interrogation Services ${data} Run Keyword Verify Interrogation Services ${data}
Run Keyword Verify System Setting ${data} Run Keyword Verify System Setting ${data}
Run Keyword Verify System Setting Allowlist ${data} Run Keyword Verify System Setting Allowlist ${data}
Run Keyword Verify Trivy Is Default Scanner Run Keyword Verify Trivy Is Default Scanner
Run Keyword Verify Artifact Index ${data} Run Keyword Verify Artifact Index ${data}
Run Keyword Verify Proxy Cache Image Existence ${data} Run Keyword Verify Proxy Cache Image Existence ${data}
Run Keyword Verify Distributions ${data} Run Keyword Verify Distributions ${data}
Run Keyword Verify P2P Preheat Policy ${data} Run Keyword Verify P2P Preheat Policy ${data}
Run Keyword Verify Quotas Display ${data} Run Keyword Verify Quotas Display ${data}

View File

@ -5,7 +5,7 @@ set -e
IMAGE_FOR=$1 IMAGE_FOR=$1
VERSION=$2 VERSION=$2
CMD_BASE="cat Dockerfile.base" CMD_BASE="cat Dockerfile.common"
SRC_FILE="" SRC_FILE=""
DST_FILE=Dockerfile DST_FILE=Dockerfile