mirror of
https://github.com/goharbor/harbor
synced 2024-09-20 16:35:44 +00:00
Fix LDAP API test issue by upgrading python
Signed-off-by: danfengliu <danfengl@vmware.com>
This commit is contained in:
parent
23ac6b55ce
commit
07f5f549d0
658
.github/workflows/CI.yml
vendored
658
.github/workflows/CI.yml
vendored
|
@ -1,325 +1,333 @@
|
||||||
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
|
||||||
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.14.5
|
go-version: 1.14.5
|
||||||
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 "::set-env name=GOPATH::$(go env GOPATH):$GITHUB_WORKSPACE"
|
echo "::set-env name=GOPATH::$(go env GOPATH):$GITHUB_WORKSPACE"
|
||||||
echo "::add-path::$(go env GOPATH)/bin"
|
echo "::add-path::$(go env GOPATH)/bin"
|
||||||
echo "::set-env name=TOKEN_PRIVATE_KEY_PATH::${GITHUB_WORKSPACE}/src/github.com/goharbor/harbor/tests/private_key.pem"
|
echo "::set-env name=TOKEN_PRIVATE_KEY_PATH::${GITHUB_WORKSPACE}/src/github.com/goharbor/harbor/tests/private_key.pem"
|
||||||
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 "::set-env name=IP::$IP"
|
echo "::set-env name=IP::$IP"
|
||||||
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
|
||||||
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.14.5
|
go-version: 1.14.5
|
||||||
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 "::set-env name=CNAB_PATH::$(go env GOPATH)/src/github.com/docker"
|
echo "::set-env name=CNAB_PATH::$(go env GOPATH)/src/github.com/docker"
|
||||||
echo "::set-env name=GITHUB_TOKEN::${{ secrets.GITHUB_TOKEN }}"
|
echo "::set-env name=GITHUB_TOKEN::${{ secrets.GITHUB_TOKEN }}"
|
||||||
echo "::set-env name=GOPATH::$(go env GOPATH):$GITHUB_WORKSPACE"
|
echo "::set-env name=GOPATH::$(go env GOPATH):$GITHUB_WORKSPACE"
|
||||||
echo "::add-path::$(go env GOPATH)/bin"
|
echo "::add-path::$(go env GOPATH)/bin"
|
||||||
echo "::set-env name=TOKEN_PRIVATE_KEY_PATH::${GITHUB_WORKSPACE}/src/github.com/goharbor/harbor/tests/private_key.pem"
|
echo "::set-env name=TOKEN_PRIVATE_KEY_PATH::${GITHUB_WORKSPACE}/src/github.com/goharbor/harbor/tests/private_key.pem"
|
||||||
IP=`hostname -I | awk '{print $1}'`
|
IP=`hostname -I | awk '{print $1}'`
|
||||||
echo "::set-env name=IP::$IP"
|
echo "::set-env name=IP::$IP"
|
||||||
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
|
||||||
echo '{"insecure-registries" : ["'$IP':5000"]}' | sudo tee /etc/docker/daemon.json
|
echo '{"insecure-registries" : ["'$IP':5000"]}' | sudo tee /etc/docker/daemon.json
|
||||||
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
|
||||||
wget https://get.helm.sh/helm-v2.14.1-linux-386.tar.gz && tar zxvf helm-v2.14.1-linux-386.tar.gz
|
wget https://get.helm.sh/helm-v2.14.1-linux-386.tar.gz && tar zxvf helm-v2.14.1-linux-386.tar.gz
|
||||||
sudo mv linux-386/helm /usr/local/bin/helm2
|
sudo mv linux-386/helm /usr/local/bin/helm2
|
||||||
helm2 init --client-only
|
helm2 init --client-only
|
||||||
helm2 plugin list | grep push || helm2 plugin install https://github.com/chartmuseum/helm-push
|
helm2 plugin list | grep push || helm2 plugin install https://github.com/chartmuseum/helm-push
|
||||||
wget https://get.helm.sh/helm-v3.1.1-linux-386.tar.gz && tar zxvf helm-v3.1.1-linux-386.tar.gz
|
wget https://get.helm.sh/helm-v3.1.1-linux-386.tar.gz && tar zxvf helm-v3.1.1-linux-386.tar.gz
|
||||||
sudo mv linux-386/helm /usr/local/bin/helm3
|
sudo mv linux-386/helm /usr/local/bin/helm3
|
||||||
helm3 plugin list | grep push || helm3 plugin install https://github.com/chartmuseum/helm-push
|
helm3 plugin list | grep push || helm3 plugin install https://github.com/chartmuseum/helm-push
|
||||||
rm -rf $CNAB_PATH;mkdir -p $CNAB_PATH && cd $CNAB_PATH && git clone https://github.com/cnabio/cnab-to-oci.git
|
rm -rf $CNAB_PATH;mkdir -p $CNAB_PATH && cd $CNAB_PATH && git clone https://github.com/cnabio/cnab-to-oci.git
|
||||||
cd cnab-to-oci && git checkout v0.3.0-beta4
|
cd cnab-to-oci && git checkout v0.3.0-beta4
|
||||||
go list
|
go list
|
||||||
make build
|
make build
|
||||||
sudo mv bin/cnab-to-oci /usr/local/bin
|
sudo mv bin/cnab-to-oci /usr/local/bin
|
||||||
curl -LO https://github.com/deislabs/oras/releases/download/v0.8.1/oras_0.8.1_linux_amd64.tar.gz
|
curl -LO https://github.com/deislabs/oras/releases/download/v0.8.1/oras_0.8.1_linux_amd64.tar.gz
|
||||||
mkdir -p oras-install/
|
mkdir -p oras-install/
|
||||||
tar -zxf oras_0.8.1_*.tar.gz -C oras-install/
|
tar -zxf oras_0.8.1_*.tar.gz -C oras-install/
|
||||||
sudo mv oras-install/oras /usr/local/bin/
|
sudo mv oras-install/oras /usr/local/bin/
|
||||||
sudo apt-get update && sudo apt-get install -y \
|
sudo apt-get update && sudo apt-get install -y \
|
||||||
build-essential \
|
build-essential \
|
||||||
uuid-dev \
|
uuid-dev \
|
||||||
libgpgme-dev \
|
libgpgme-dev \
|
||||||
squashfs-tools \
|
squashfs-tools \
|
||||||
libseccomp-dev \
|
libseccomp-dev \
|
||||||
pkg-config \
|
pkg-config \
|
||||||
cryptsetup-bin
|
cryptsetup-bin
|
||||||
export VERSION=3.5.3 && \
|
export VERSION=3.5.3 && \
|
||||||
wget https://github.com/sylabs/singularity/releases/download/v${VERSION}/singularity-${VERSION}.tar.gz && \
|
wget https://github.com/sylabs/singularity/releases/download/v${VERSION}/singularity-${VERSION}.tar.gz && \
|
||||||
tar -xzf singularity-${VERSION}.tar.gz && \
|
tar -xzf singularity-${VERSION}.tar.gz && \
|
||||||
cd singularity
|
cd singularity
|
||||||
./mconfig && \
|
./mconfig && \
|
||||||
make -C builddir && \
|
make -C builddir && \
|
||||||
sudo make -C builddir install
|
sudo make -C builddir install
|
||||||
- name: install
|
python -V
|
||||||
run: |
|
sudo apt-get update -y && sudo apt-get install -y zbar-tools libzbar-dev python-zbar
|
||||||
cd src/github.com/goharbor/harbor
|
sudo apt-get update -y
|
||||||
env
|
sudo apt-get install -y python3.6
|
||||||
df -h
|
sudo rm /usr/bin/python
|
||||||
docker system prune -a -f
|
sudo ln -s /usr/bin/python3.6 /usr/bin/python
|
||||||
bash ./tests/showtime.sh ./tests/ci/api_common_install.sh $IP DB
|
sudo apt-get install -y python3-pip
|
||||||
- name: script
|
python -V
|
||||||
run: |
|
- name: install
|
||||||
cd src/github.com/goharbor/harbor
|
run: |
|
||||||
echo IP: $IP
|
cd src/github.com/goharbor/harbor
|
||||||
df -h
|
env
|
||||||
bash ./tests/showtime.sh ./tests/ci/api_run.sh DB $IP
|
df -h
|
||||||
df -h
|
docker system prune -a -f
|
||||||
|
bash ./tests/showtime.sh ./tests/ci/api_common_install.sh $IP DB
|
||||||
APITEST_LDAP:
|
- name: script
|
||||||
env:
|
run: |
|
||||||
APITEST_LDAP: true
|
cd src/github.com/goharbor/harbor
|
||||||
runs-on:
|
echo IP: $IP
|
||||||
#- self-hosted
|
df -h
|
||||||
- ubuntu-latest
|
bash ./tests/showtime.sh ./tests/ci/api_run.sh DB $IP
|
||||||
steps:
|
df -h
|
||||||
- name: Set up Go 1.14
|
|
||||||
uses: actions/setup-go@v1
|
APITEST_LDAP:
|
||||||
with:
|
env:
|
||||||
go-version: 1.14.5
|
APITEST_LDAP: true
|
||||||
id: go
|
runs-on:
|
||||||
- name: setup Docker
|
#- self-hosted
|
||||||
uses: docker-practice/actions-setup-docker@0.0.1
|
- ubuntu-latest
|
||||||
with:
|
steps:
|
||||||
docker_version: 18.09
|
- name: Set up Go 1.14
|
||||||
docker_channel: stable
|
uses: actions/setup-go@v1
|
||||||
- uses: actions/checkout@v2
|
with:
|
||||||
with:
|
go-version: 1.14.5
|
||||||
path: src/github.com/goharbor/harbor
|
id: go
|
||||||
- name: setup env
|
- name: setup Docker
|
||||||
run: |
|
uses: docker-practice/actions-setup-docker@0.0.1
|
||||||
cd src/github.com/goharbor/harbor
|
with:
|
||||||
pwd
|
docker_version: 18.09
|
||||||
go env
|
docker_channel: stable
|
||||||
echo "::set-env name=GOPATH::$(go env GOPATH):$GITHUB_WORKSPACE"
|
- uses: actions/checkout@v2
|
||||||
echo "::add-path::$(go env GOPATH)/bin"
|
with:
|
||||||
echo "::set-env name=TOKEN_PRIVATE_KEY_PATH::${GITHUB_WORKSPACE}/src/github.com/goharbor/harbor/tests/private_key.pem"
|
path: src/github.com/goharbor/harbor
|
||||||
shell: bash
|
- name: setup env
|
||||||
- name: before_install
|
run: |
|
||||||
run: |
|
cd src/github.com/goharbor/harbor
|
||||||
set -x
|
pwd
|
||||||
cd src/github.com/goharbor/harbor
|
go env
|
||||||
pwd
|
echo "::set-env name=GOPATH::$(go env GOPATH):$GITHUB_WORKSPACE"
|
||||||
env
|
echo "::add-path::$(go env GOPATH)/bin"
|
||||||
df -h
|
echo "::set-env name=TOKEN_PRIVATE_KEY_PATH::${GITHUB_WORKSPACE}/src/github.com/goharbor/harbor/tests/private_key.pem"
|
||||||
#sudo apt install -y xvfb
|
shell: bash
|
||||||
#xvfb-run ls
|
- name: before_install
|
||||||
curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
|
run: |
|
||||||
chmod +x docker-compose
|
set -x
|
||||||
sudo mv docker-compose /usr/local/bin
|
cd src/github.com/goharbor/harbor
|
||||||
IP=`hostname -I | awk '{print $1}'`
|
pwd
|
||||||
echo '{"insecure-registries" : ["'$IP':5000"]}' | sudo tee /etc/docker/daemon.json
|
env
|
||||||
echo "::set-env name=IP::$IP"
|
df -h
|
||||||
sudo cp ./tests/harbor_ca.crt /usr/local/share/ca-certificates/
|
#sudo apt install -y xvfb
|
||||||
sudo update-ca-certificates
|
#xvfb-run ls
|
||||||
sudo service docker restart
|
curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
|
||||||
- name: install
|
chmod +x docker-compose
|
||||||
run: |
|
sudo mv docker-compose /usr/local/bin
|
||||||
cd src/github.com/goharbor/harbor
|
IP=`hostname -I | awk '{print $1}'`
|
||||||
env
|
echo '{"insecure-registries" : ["'$IP':5000"]}' | sudo tee /etc/docker/daemon.json
|
||||||
df -h
|
echo "::set-env name=IP::$IP"
|
||||||
bash ./tests/showtime.sh ./tests/ci/api_common_install.sh $IP LDAP
|
sudo cp ./tests/harbor_ca.crt /usr/local/share/ca-certificates/
|
||||||
- name: script
|
sudo update-ca-certificates
|
||||||
run: |
|
sudo service docker restart
|
||||||
echo IP: $IP
|
- name: install
|
||||||
df -h
|
run: |
|
||||||
cd src/github.com/goharbor/harbor
|
cd src/github.com/goharbor/harbor
|
||||||
bash ./tests/showtime.sh ./tests/ci/api_run.sh LDAP $IP
|
env
|
||||||
df -h
|
df -h
|
||||||
|
bash ./tests/showtime.sh ./tests/ci/api_common_install.sh $IP LDAP
|
||||||
OFFLINE:
|
- name: script
|
||||||
env:
|
run: |
|
||||||
OFFLINE: true
|
echo IP: $IP
|
||||||
runs-on:
|
df -h
|
||||||
#- self-hosted
|
cd src/github.com/goharbor/harbor
|
||||||
- ubuntu-latest
|
bash ./tests/showtime.sh ./tests/ci/api_run.sh LDAP $IP
|
||||||
steps:
|
df -h
|
||||||
- name: Set up Go 1.14
|
|
||||||
uses: actions/setup-go@v1
|
OFFLINE:
|
||||||
with:
|
env:
|
||||||
go-version: 1.14.5
|
OFFLINE: true
|
||||||
id: go
|
runs-on:
|
||||||
- name: setup Docker
|
#- self-hosted
|
||||||
uses: docker-practice/actions-setup-docker@0.0.1
|
- ubuntu-latest
|
||||||
with:
|
steps:
|
||||||
docker_version: 18.09
|
- name: Set up Go 1.14
|
||||||
docker_channel: stable
|
uses: actions/setup-go@v1
|
||||||
- uses: actions/checkout@v2
|
with:
|
||||||
with:
|
go-version: 1.14.5
|
||||||
path: src/github.com/goharbor/harbor
|
id: go
|
||||||
- name: setup env
|
- name: setup Docker
|
||||||
run: |
|
uses: docker-practice/actions-setup-docker@0.0.1
|
||||||
cd src/github.com/goharbor/harbor
|
with:
|
||||||
pwd
|
docker_version: 18.09
|
||||||
docker version
|
docker_channel: stable
|
||||||
go env
|
- uses: actions/checkout@v2
|
||||||
echo "::set-env name=GOPATH::$(go env GOPATH):$GITHUB_WORKSPACE"
|
with:
|
||||||
echo "::add-path::$(go env GOPATH)/bin"
|
path: src/github.com/goharbor/harbor
|
||||||
echo "::set-env name=TOKEN_PRIVATE_KEY_PATH::${GITHUB_WORKSPACE}/src/github.com/goharbor/harbor/tests/private_key.pem"
|
- name: setup env
|
||||||
shell: bash
|
run: |
|
||||||
- name: before_install
|
cd src/github.com/goharbor/harbor
|
||||||
run: |
|
pwd
|
||||||
set -x
|
docker version
|
||||||
cd src/github.com/goharbor/harbor
|
go env
|
||||||
pwd
|
echo "::set-env name=GOPATH::$(go env GOPATH):$GITHUB_WORKSPACE"
|
||||||
env
|
echo "::add-path::$(go env GOPATH)/bin"
|
||||||
df -h
|
echo "::set-env name=TOKEN_PRIVATE_KEY_PATH::${GITHUB_WORKSPACE}/src/github.com/goharbor/harbor/tests/private_key.pem"
|
||||||
#sudo apt install -y xvfb
|
shell: bash
|
||||||
#xvfb-run ls
|
- name: before_install
|
||||||
curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
|
run: |
|
||||||
chmod +x docker-compose
|
set -x
|
||||||
sudo mv docker-compose /usr/local/bin
|
cd src/github.com/goharbor/harbor
|
||||||
IP=`hostname -I | awk '{print $1}'`
|
pwd
|
||||||
echo '{"insecure-registries" : ["'$IP':5000"]}' | sudo tee /etc/docker/daemon.json
|
env
|
||||||
echo "::set-env name=IP::$IP"
|
df -h
|
||||||
sudo cp ./tests/harbor_ca.crt /usr/local/share/ca-certificates/
|
#sudo apt install -y xvfb
|
||||||
sudo update-ca-certificates
|
#xvfb-run ls
|
||||||
sudo service docker restart
|
curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
|
||||||
- name: script
|
chmod +x docker-compose
|
||||||
run: |
|
sudo mv docker-compose /usr/local/bin
|
||||||
echo IP: $IP
|
IP=`hostname -I | awk '{print $1}'`
|
||||||
df -h
|
echo '{"insecure-registries" : ["'$IP':5000"]}' | sudo tee /etc/docker/daemon.json
|
||||||
cd src/github.com/goharbor/harbor
|
echo "::set-env name=IP::$IP"
|
||||||
bash ./tests/showtime.sh ./tests/ci/distro_installer.sh
|
sudo cp ./tests/harbor_ca.crt /usr/local/share/ca-certificates/
|
||||||
df -h
|
sudo update-ca-certificates
|
||||||
|
sudo service docker restart
|
||||||
UI_UT:
|
- name: script
|
||||||
env:
|
run: |
|
||||||
UI_UT: true
|
echo IP: $IP
|
||||||
runs-on:
|
df -h
|
||||||
#- self-hosted
|
cd src/github.com/goharbor/harbor
|
||||||
- ubuntu-latest
|
bash ./tests/showtime.sh ./tests/ci/distro_installer.sh
|
||||||
steps:
|
df -h
|
||||||
- uses: actions/setup-node@v1
|
|
||||||
with:
|
UI_UT:
|
||||||
node-version: '10.16.2'
|
env:
|
||||||
- uses: actions/checkout@v2
|
UI_UT: true
|
||||||
with:
|
runs-on:
|
||||||
path: src/github.com/goharbor/harbor
|
#- self-hosted
|
||||||
- name: script
|
- ubuntu-latest
|
||||||
run: |
|
steps:
|
||||||
echo IP: $IP
|
- uses: actions/setup-node@v1
|
||||||
df -h
|
with:
|
||||||
cd src/github.com/goharbor/harbor
|
node-version: '10.16.2'
|
||||||
bash ./tests/showtime.sh ./tests/ci/ui_ut_run.sh
|
- uses: actions/checkout@v2
|
||||||
df -h
|
with:
|
||||||
- name: Codecov For UI
|
path: src/github.com/goharbor/harbor
|
||||||
uses: codecov/codecov-action@v1
|
- name: script
|
||||||
with:
|
run: |
|
||||||
file: ./src/github.com/goharbor/harbor/src/portal/coverage/lcov.info
|
echo IP: $IP
|
||||||
flags: unittests
|
df -h
|
||||||
|
cd src/github.com/goharbor/harbor
|
||||||
|
bash ./tests/showtime.sh ./tests/ci/ui_ut_run.sh
|
||||||
|
df -h
|
||||||
|
- name: Codecov For UI
|
||||||
|
uses: codecov/codecov-action@v1
|
||||||
|
with:
|
||||||
|
file: ./src/github.com/goharbor/harbor/src/portal/coverage/lcov.info
|
||||||
|
flags: unittests
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import site
|
|
||||||
reload(site)
|
|
||||||
import project
|
import project
|
||||||
import label
|
import label
|
||||||
import registry
|
import registry
|
||||||
|
|
|
@ -103,7 +103,7 @@ class DockerAPI(object):
|
||||||
caught_err = False
|
caught_err = False
|
||||||
ret = ""
|
ret = ""
|
||||||
try:
|
try:
|
||||||
ret = base._get_string_from_unicode(self.DCLIENT.pull(r'{}:{}'.format(image, _tag)))
|
self.DCLIENT.pull(r'{}:{}'.format(image, _tag))
|
||||||
return ret
|
return ret
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
caught_err = True
|
caught_err = True
|
||||||
|
@ -137,7 +137,7 @@ class DockerAPI(object):
|
||||||
if expected_error_message is "":
|
if expected_error_message is "":
|
||||||
expected_error_message = None
|
expected_error_message = None
|
||||||
try:
|
try:
|
||||||
ret = base._get_string_from_unicode(self.DCLIENT.push(harbor_registry, tag, stream=True))
|
self.DCLIENT.push(harbor_registry, tag)
|
||||||
return ret
|
return ret
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
caught_err = True
|
caught_err = True
|
||||||
|
|
|
@ -6,6 +6,6 @@ def sign_image(registry_ip, project_name, image, tag):
|
||||||
try:
|
try:
|
||||||
ret = subprocess.check_output(["./tests/apitests/python/sign_image.sh", registry_ip, project_name, image, tag, notary_url], shell=False)
|
ret = subprocess.check_output(["./tests/apitests/python/sign_image.sh", registry_ip, project_name, image, tag, notary_url], shell=False)
|
||||||
print("sign_image return: ", ret)
|
print("sign_image return: ", ret)
|
||||||
except subprocess.CalledProcessError, exc:
|
except subprocess.CalledProcessError as exc:
|
||||||
raise Exception("Failed to sign image error is {} {}.".format(exc.returncode, exc.output))
|
raise Exception("Failed to sign image error is {} {}.".format(exc.returncode, exc.output))
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ import docker
|
||||||
|
|
||||||
import swagger_client
|
import swagger_client
|
||||||
|
|
||||||
|
from testutils import ADMIN_CLIENT
|
||||||
from swagger_client.models.project import Project
|
from swagger_client.models.project import Project
|
||||||
from swagger_client.models.project_req import ProjectReq
|
from swagger_client.models.project_req import ProjectReq
|
||||||
from swagger_client.models.project_metadata import ProjectMetadata
|
from swagger_client.models.project_metadata import ProjectMetadata
|
||||||
|
@ -29,8 +30,8 @@ from swagger_client.models.project_member import ProjectMember
|
||||||
from swagger_client.models.user_group import UserGroup
|
from swagger_client.models.user_group import UserGroup
|
||||||
from swagger_client.models.configurations import Configurations
|
from swagger_client.models.configurations import Configurations
|
||||||
from library.projectV2 import ProjectV2
|
from library.projectV2 import ProjectV2
|
||||||
from testutils import ADMIN_CLIENT
|
|
||||||
from library.base import _assert_status_code
|
from library.base import _assert_status_code
|
||||||
|
from library.base import _random_name
|
||||||
|
|
||||||
|
|
||||||
from v2_swagger_client.rest import ApiException
|
from v2_swagger_client.rest import ApiException
|
||||||
|
@ -45,6 +46,7 @@ class TestAssignRoleToLdapGroup(unittest.TestCase):
|
||||||
repository_api = testutils.GetRepositoryApi("admin", "Harbor12345")
|
repository_api = testutils.GetRepositoryApi("admin", "Harbor12345")
|
||||||
project_id = 0
|
project_id = 0
|
||||||
docker_client = docker.from_env()
|
docker_client = docker.from_env()
|
||||||
|
_project_name = _random_name("test_private")
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.projectv2= ProjectV2()
|
self.projectv2= ProjectV2()
|
||||||
|
@ -55,13 +57,13 @@ class TestAssignRoleToLdapGroup(unittest.TestCase):
|
||||||
cfgs = self.product_api.configurations_get()
|
cfgs = self.product_api.configurations_get()
|
||||||
pprint(cfgs)
|
pprint(cfgs)
|
||||||
req = ProjectReq()
|
req = ProjectReq()
|
||||||
req.project_name = "ldap_group_test_prj"
|
req.project_name = self._project_name
|
||||||
req.metadata = ProjectMetadata(public="false")
|
req.metadata = ProjectMetadata(public="false")
|
||||||
result = self.product_api.projects_post(req)
|
result = self.product_api.projects_post(req)
|
||||||
pprint(result)
|
pprint(result)
|
||||||
|
|
||||||
projs = self.product_api.projects_get(name="ldap_group_test_prj")
|
projs = self.product_api.projects_get(name = self._project_name)
|
||||||
if projs.count>0 :
|
if len(projs)>0 :
|
||||||
project = projs[0]
|
project = projs[0]
|
||||||
self.project_id = project.project_id
|
self.project_id = project.project_id
|
||||||
|
|
||||||
|
@ -93,9 +95,9 @@ class TestAssignRoleToLdapGroup(unittest.TestCase):
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
#delete images in project
|
#delete images in project
|
||||||
result = self.repository_api.delete_repository("ldap_group_test_prj", "busybox")
|
result = self.repository_api.delete_repository(self._project_name, "busybox")
|
||||||
pprint(result)
|
pprint(result)
|
||||||
result = self.repository_api.delete_repository("ldap_group_test_prj", "busyboxdev")
|
result = self.repository_api.delete_repository(self._project_name, "busyboxdev")
|
||||||
pprint(result)
|
pprint(result)
|
||||||
if self.project_id > 0 :
|
if self.project_id > 0 :
|
||||||
self.product_api.projects_project_id_delete(self.project_id)
|
self.product_api.projects_project_id_delete(self.project_id)
|
||||||
|
@ -104,19 +106,19 @@ class TestAssignRoleToLdapGroup(unittest.TestCase):
|
||||||
def testAssignRoleToLdapGroup(self):
|
def testAssignRoleToLdapGroup(self):
|
||||||
"""Test AssignRoleToLdapGroup"""
|
"""Test AssignRoleToLdapGroup"""
|
||||||
admin_product_api = testutils.GetProductApi(username="admin_user", password="zhu88jie")
|
admin_product_api = testutils.GetProductApi(username="admin_user", password="zhu88jie")
|
||||||
projects = admin_product_api.projects_get(name="ldap_group_test_prj")
|
projects = admin_product_api.projects_get(name=self._project_name)
|
||||||
self.assertTrue(projects.count > 1)
|
self.assertTrue(len(projects) == 1)
|
||||||
self.assertEqual(1, projects[0].current_user_role_id)
|
self.assertEqual(1, projects[0].current_user_role_id)
|
||||||
|
|
||||||
|
|
||||||
dev_product_api = testutils.GetProductApi("dev_user", "zhu88jie")
|
dev_product_api = testutils.GetProductApi("dev_user", "zhu88jie")
|
||||||
projects = dev_product_api.projects_get(name="ldap_group_test_prj")
|
projects = dev_product_api.projects_get(name=self._project_name)
|
||||||
self.assertTrue(projects.count > 1)
|
self.assertTrue(len(projects) == 1)
|
||||||
self.assertEqual(2, projects[0].current_user_role_id)
|
self.assertEqual(2, projects[0].current_user_role_id)
|
||||||
|
|
||||||
guest_product_api = testutils.GetProductApi("guest_user", "zhu88jie")
|
guest_product_api = testutils.GetProductApi("guest_user", "zhu88jie")
|
||||||
projects = guest_product_api.projects_get(name="ldap_group_test_prj")
|
projects = guest_product_api.projects_get(name=self._project_name)
|
||||||
self.assertTrue(projects.count > 1)
|
self.assertTrue(len(projects) == 1)
|
||||||
self.assertEqual(3, projects[0].current_user_role_id)
|
self.assertEqual(3, projects[0].current_user_role_id)
|
||||||
|
|
||||||
self.dockerCmdLoginAdmin(username="admin_user", password="zhu88jie")
|
self.dockerCmdLoginAdmin(username="admin_user", password="zhu88jie")
|
||||||
|
@ -136,19 +138,19 @@ class TestAssignRoleToLdapGroup(unittest.TestCase):
|
||||||
self.docker_client.login(username=username, password=password, registry=self.harbor_host)
|
self.docker_client.login(username=username, password=password, registry=self.harbor_host)
|
||||||
self.docker_client.images.pull("busybox:latest")
|
self.docker_client.images.pull("busybox:latest")
|
||||||
image = self.docker_client.images.get("busybox:latest")
|
image = self.docker_client.images.get("busybox:latest")
|
||||||
image.tag(repository=self.harbor_host+"/ldap_group_test_prj/busybox", tag="latest")
|
image.tag(repository=self.harbor_host+"/"+self._project_name+"/busybox", tag="latest")
|
||||||
output = self.docker_client.images.push(repository=self.harbor_host+"/ldap_group_test_prj/busybox", tag="latest")
|
output = self.docker_client.images.push(repository=self.harbor_host+"/"+self._project_name+"/busybox", tag="latest")
|
||||||
if output.find("error")>0 :
|
if output.find("error")>0 :
|
||||||
self.fail("Should not fail to push image for admin_user")
|
self.fail("Should not fail to push image for admin_user")
|
||||||
self.docker_client.images.pull(repository=self.harbor_host+"/ldap_group_test_prj/busybox", tag="latest")
|
self.docker_client.images.pull(repository=self.harbor_host+"/"+self._project_name+"/busybox", tag="latest")
|
||||||
pass
|
pass
|
||||||
# dev user can push, pull images
|
# dev user can push, pull images
|
||||||
def dockerCmdLoginDev(self, username, password, harbor_server=harbor_host):
|
def dockerCmdLoginDev(self, username, password, harbor_server=harbor_host):
|
||||||
self.docker_client.login(username=username, password=password, registry=self.harbor_host)
|
self.docker_client.login(username=username, password=password, registry=self.harbor_host)
|
||||||
self.docker_client.images.pull("busybox:latest")
|
self.docker_client.images.pull("busybox:latest")
|
||||||
image = self.docker_client.images.get("busybox:latest")
|
image = self.docker_client.images.get("busybox:latest")
|
||||||
image.tag(repository=self.harbor_host+"/ldap_group_test_prj/busyboxdev", tag="latest")
|
image.tag(repository=self.harbor_host+"/"+self._project_name+"/busyboxdev", tag="latest")
|
||||||
output = self.docker_client.images.push(repository=self.harbor_host+"/ldap_group_test_prj/busyboxdev", tag="latest")
|
output = self.docker_client.images.push(repository=self.harbor_host+"/"+self._project_name+"/busyboxdev", tag="latest")
|
||||||
if output.find("error") >0 :
|
if output.find("error") >0 :
|
||||||
self.fail("Should not fail to push images for dev_user")
|
self.fail("Should not fail to push images for dev_user")
|
||||||
pass
|
pass
|
||||||
|
@ -157,17 +159,17 @@ class TestAssignRoleToLdapGroup(unittest.TestCase):
|
||||||
self.docker_client.login(username=username, password=password, registry=self.harbor_host)
|
self.docker_client.login(username=username, password=password, registry=self.harbor_host)
|
||||||
self.docker_client.images.pull("busybox:latest")
|
self.docker_client.images.pull("busybox:latest")
|
||||||
image = self.docker_client.images.get("busybox:latest")
|
image = self.docker_client.images.get("busybox:latest")
|
||||||
image.tag(repository=self.harbor_host+"/ldap_group_test_prj/busyboxguest", tag="latest")
|
image.tag(repository=self.harbor_host+"/"+self._project_name+"/busyboxguest", tag="latest")
|
||||||
output = self.docker_client.images.push(repository=self.harbor_host+"1/ldap_group_test_prj/busyboxguest", tag="latest")
|
output = self.docker_client.images.push(repository=self.harbor_host+"1/"+self._project_name+"/busyboxguest", tag="latest")
|
||||||
if output.find("error")<0 :
|
if output.find("error")<0 :
|
||||||
self.fail("Should failed to push image for guest user")
|
self.fail("Should failed to push image for guest user")
|
||||||
self.docker_client.images.pull(repository=self.harbor_host+"/ldap_group_test_prj/busybox", tag="latest")
|
self.docker_client.images.pull(repository=self.harbor_host+"/"+self._project_name+"/busybox", tag="latest")
|
||||||
pass
|
pass
|
||||||
# check can see his log in current project
|
# check can see his log in current project
|
||||||
def queryUserLogs(self, username, password, status_code=200):
|
def queryUserLogs(self, username, password, status_code=200):
|
||||||
client=dict(endpoint = ADMIN_CLIENT["endpoint"], username = username, password = password)
|
client=dict(endpoint = ADMIN_CLIENT["endpoint"], username = username, password = password)
|
||||||
try:
|
try:
|
||||||
logs = self.projectv2.get_project_log("ldap_group_test_prj", status_code, **client)
|
logs = self.projectv2.get_project_log(self._project_name, status_code, **client)
|
||||||
count = 0
|
count = 0
|
||||||
for log in list(logs):
|
for log in list(logs):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
|
|
|
@ -3,11 +3,10 @@ from __future__ import absolute_import
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from library.base import _assert_status_code
|
|
||||||
from testutils import ADMIN_CLIENT
|
from testutils import ADMIN_CLIENT
|
||||||
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.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
|
||||||
|
|
|
@ -3,13 +3,12 @@ from __future__ import absolute_import
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
from testutils import ADMIN_CLIENT
|
||||||
|
from testutils import harbor_server
|
||||||
|
from testutils import TEARDOWN
|
||||||
import library.repository
|
import library.repository
|
||||||
import library.docker_api
|
import library.docker_api
|
||||||
from library.base import _assert_status_code
|
from library.base import _assert_status_code
|
||||||
from testutils import ADMIN_CLIENT
|
|
||||||
from testutils import harbor_server
|
|
||||||
|
|
||||||
from testutils import TEARDOWN
|
|
||||||
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
|
||||||
|
|
|
@ -3,11 +3,10 @@ from __future__ import absolute_import
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from library.base import _assert_status_code
|
|
||||||
from testutils import ADMIN_CLIENT
|
from testutils import ADMIN_CLIENT
|
||||||
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.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
|
||||||
|
|
|
@ -5,12 +5,12 @@ import time
|
||||||
|
|
||||||
from testutils import ADMIN_CLIENT
|
from testutils import ADMIN_CLIENT
|
||||||
from testutils import TEARDOWN
|
from testutils import TEARDOWN
|
||||||
|
from testutils import harbor_server
|
||||||
from library.user import User
|
from library.user import User
|
||||||
from library.system import System
|
from library.system import System
|
||||||
from library.project import Project
|
from library.project import Project
|
||||||
from library.repository import Repository
|
from library.repository import Repository
|
||||||
from library.repository import push_image_to_project
|
from library.repository import push_image_to_project
|
||||||
from testutils import harbor_server
|
|
||||||
from library.base import _assert_status_code
|
from library.base import _assert_status_code
|
||||||
from library.repository import push_special_image_to_project
|
from library.repository import push_special_image_to_project
|
||||||
from library.artifact import Artifact
|
from library.artifact import Artifact
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
"""
|
"""
|
||||||
Harbor API
|
Harbor API
|
||||||
|
|
||||||
These APIs provide services for manipulating Harbor project.
|
These APIs provide services for manipulating Harbor project.
|
||||||
|
|
||||||
OpenAPI spec version: 1.4.0
|
OpenAPI spec version: 1.4.0
|
||||||
|
|
||||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -20,10 +20,10 @@ sys.path.append(os.environ["SWAGGER_CLIENT_PATH"])
|
||||||
import unittest
|
import unittest
|
||||||
import testutils
|
import testutils
|
||||||
import swagger_client
|
import swagger_client
|
||||||
|
from library.base import _random_name
|
||||||
from swagger_client.models.project_req import ProjectReq
|
from swagger_client.models.project_req import ProjectReq
|
||||||
from swagger_client.models.configurations import Configurations
|
from swagger_client.models.configurations import Configurations
|
||||||
from swagger_client.rest import ApiException
|
from swagger_client.rest import ApiException
|
||||||
from swagger_client.models.configurations import Configurations
|
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,16 +44,17 @@ class TestLdapAdminRole(unittest.TestCase):
|
||||||
|
|
||||||
def testLdapAdminRole(self):
|
def testLdapAdminRole(self):
|
||||||
"""Test LdapAdminRole"""
|
"""Test LdapAdminRole"""
|
||||||
|
_project_name = _random_name("test_private")
|
||||||
result = self.product_api.configurations_put(configurations=Configurations(ldap_group_admin_dn="cn=harbor_users,ou=groups,dc=example,dc=com"))
|
result = self.product_api.configurations_put(configurations=Configurations(ldap_group_admin_dn="cn=harbor_users,ou=groups,dc=example,dc=com"))
|
||||||
pprint(result)
|
|
||||||
|
|
||||||
# Create a private project
|
# Create a private project
|
||||||
result = self.product_api.projects_post(project=ProjectReq(project_name="test_private"))
|
result = self.product_api.projects_post(project=ProjectReq(project_name= _project_name))
|
||||||
pprint(result)
|
|
||||||
|
|
||||||
# query project with ldap user mike
|
# query project with ldap user mike
|
||||||
projects = self.mike_product_api.projects_get(name="test_private")
|
projects = self.mike_product_api.projects_get(name=_project_name)
|
||||||
self.assertTrue(projects.count>1)
|
|
||||||
|
print("=================", projects)
|
||||||
|
self.assertTrue(len(projects) == 1)
|
||||||
self.project_id = projects[0].project_id
|
self.project_id = projects[0].project_id
|
||||||
|
|
||||||
# check the mike is not admin in Database
|
# check the mike is not admin in Database
|
||||||
|
|
|
@ -4,7 +4,6 @@ import unittest
|
||||||
|
|
||||||
from testutils import ADMIN_CLIENT
|
from testutils import ADMIN_CLIENT
|
||||||
from testutils import harbor_server
|
from testutils import harbor_server
|
||||||
|
|
||||||
from testutils import TEARDOWN
|
from testutils import TEARDOWN
|
||||||
from library.artifact import Artifact
|
from library.artifact import Artifact
|
||||||
from library.project import Project
|
from library.project import Project
|
||||||
|
|
|
@ -3,12 +3,11 @@ from __future__ import absolute_import
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import library.repository
|
|
||||||
import library.helm
|
|
||||||
from testutils import ADMIN_CLIENT, CHART_API_CLIENT
|
from testutils import ADMIN_CLIENT, CHART_API_CLIENT
|
||||||
from testutils import harbor_server
|
from testutils import harbor_server
|
||||||
|
|
||||||
from testutils import TEARDOWN
|
from testutils import TEARDOWN
|
||||||
|
import library.repository
|
||||||
|
import library.helm
|
||||||
from library.project import Project
|
from library.project import Project
|
||||||
from library.user import User
|
from library.user import User
|
||||||
from library.chart import Chart
|
from library.chart import Chart
|
||||||
|
|
|
@ -3,12 +3,11 @@ from __future__ import absolute_import
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import library.repository
|
|
||||||
import library.helm
|
|
||||||
from testutils import ADMIN_CLIENT
|
from testutils import ADMIN_CLIENT
|
||||||
from testutils import harbor_server
|
from testutils import harbor_server
|
||||||
|
|
||||||
from testutils import TEARDOWN
|
from testutils import TEARDOWN
|
||||||
|
import library.repository
|
||||||
|
import library.helm
|
||||||
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
|
||||||
|
|
|
@ -3,13 +3,11 @@ from __future__ import absolute_import
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import library.repository
|
|
||||||
import library.cnab
|
|
||||||
|
|
||||||
from testutils import ADMIN_CLIENT
|
from testutils import ADMIN_CLIENT
|
||||||
from testutils import harbor_server
|
from testutils import harbor_server
|
||||||
|
|
||||||
from testutils import TEARDOWN
|
from testutils import TEARDOWN
|
||||||
|
import library.repository
|
||||||
|
import library.cnab
|
||||||
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
|
||||||
|
|
|
@ -2,11 +2,11 @@ from __future__ import absolute_import
|
||||||
import unittest
|
import unittest
|
||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
import library.oras
|
|
||||||
from library.sign import sign_image
|
|
||||||
from testutils import ADMIN_CLIENT
|
from testutils import ADMIN_CLIENT
|
||||||
from testutils import harbor_server
|
from testutils import harbor_server
|
||||||
from testutils import TEARDOWN
|
from testutils import TEARDOWN
|
||||||
|
import library.oras
|
||||||
|
from library.sign import sign_image
|
||||||
from library.user import User
|
from library.user import User
|
||||||
from library.project import Project
|
from library.project import Project
|
||||||
from library.repository import Repository
|
from library.repository import Repository
|
||||||
|
|
|
@ -2,10 +2,10 @@ from __future__ import absolute_import
|
||||||
import unittest
|
import unittest
|
||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
from library.sign import sign_image
|
|
||||||
from testutils import ADMIN_CLIENT
|
from testutils import ADMIN_CLIENT
|
||||||
from testutils import harbor_server
|
from testutils import harbor_server
|
||||||
from testutils import TEARDOWN
|
from testutils import TEARDOWN
|
||||||
|
from library.sign import sign_image
|
||||||
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
|
||||||
|
@ -77,9 +77,9 @@ class TestProjects(unittest.TestCase):
|
||||||
TestProjects.repo_name, tag = push_image_to_project(TestProjects.project_sign_image_name, harbor_server, user_sign_image_name, user_001_password, image, src_tag, profix_for_image=profix)
|
TestProjects.repo_name, tag = push_image_to_project(TestProjects.project_sign_image_name, harbor_server, user_sign_image_name, user_001_password, image, src_tag, profix_for_image=profix)
|
||||||
|
|
||||||
#7. Get signature of image with tag(TA), it should be exist.
|
#7. Get signature of image with tag(TA), it should be exist.
|
||||||
full_name = urllib.quote(profix+"/"+image,'utf-8')
|
full_name = urllib.parse.quote(profix+"/"+image,'utf-8')
|
||||||
artifact = self.artifact.get_reference_info(TestProjects.project_sign_image_name, (str(full_name)).encode(), tag, **TestProjects.USER_sign_image_CLIENT)
|
|
||||||
|
|
||||||
|
artifact = self.artifact.get_reference_info(TestProjects.project_sign_image_name, full_name, tag, **TestProjects.USER_sign_image_CLIENT)
|
||||||
self.assertEqual(artifact[0].type, 'IMAGE')
|
self.assertEqual(artifact[0].type, 'IMAGE')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -3,14 +3,13 @@ from __future__ import absolute_import
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
from testutils import ADMIN_CLIENT
|
||||||
|
from testutils import harbor_server
|
||||||
|
from testutils import TEARDOWN
|
||||||
import library.repository
|
import library.repository
|
||||||
import library.docker_api
|
import library.docker_api
|
||||||
import library.containerd
|
import library.containerd
|
||||||
from library.base import _assert_status_code
|
from library.base import _assert_status_code
|
||||||
from testutils import ADMIN_CLIENT
|
|
||||||
from testutils import harbor_server
|
|
||||||
|
|
||||||
from testutils import TEARDOWN
|
|
||||||
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
|
||||||
|
|
|
@ -2,11 +2,11 @@ from __future__ import absolute_import
|
||||||
import unittest
|
import unittest
|
||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
import library.singularity
|
|
||||||
from library.sign import sign_image
|
|
||||||
from testutils import ADMIN_CLIENT
|
from testutils import ADMIN_CLIENT
|
||||||
from testutils import harbor_server
|
from testutils import harbor_server
|
||||||
from testutils import TEARDOWN
|
from testutils import TEARDOWN
|
||||||
|
import library.singularity
|
||||||
|
from library.sign import sign_image
|
||||||
from library.user import User
|
from library.user import User
|
||||||
from library.project import Project
|
from library.project import Project
|
||||||
from library.repository import Repository
|
from library.repository import Repository
|
||||||
|
|
|
@ -13,6 +13,8 @@ from library.repository import Repository
|
||||||
from library.repository import push_image_to_project
|
from library.repository import push_image_to_project
|
||||||
from library.artifact import Artifact
|
from library.artifact import Artifact
|
||||||
from library.scanner import Scanner
|
from library.scanner import Scanner
|
||||||
|
from library.docker_api import list_image_tags
|
||||||
|
from library.docker_api import list_repositories
|
||||||
import os
|
import os
|
||||||
import library.base
|
import library.base
|
||||||
import json
|
import json
|
||||||
|
@ -84,24 +86,24 @@ class TestProjects(unittest.TestCase):
|
||||||
for tag in create_tags:
|
for tag in create_tags:
|
||||||
self.artifact.create_tag(TestProjects.project_Alice_name, self.repo_name, tag_c, tag, **USER_ALICE_CLIENT)
|
self.artifact.create_tag(TestProjects.project_Alice_name, self.repo_name, tag_c, tag, **USER_ALICE_CLIENT)
|
||||||
#4. Call the image_list_tags API
|
#4. Call the image_list_tags API
|
||||||
tags = library.docker_api.list_image_tags(harbor_server,TestProjects.repo_c,user_Alice_name,user_common_password)
|
tags = list_image_tags(harbor_server,TestProjects.repo_c,user_Alice_name,user_common_password)
|
||||||
for tag in create_tags:
|
for tag in create_tags:
|
||||||
self.assertTrue(tags.count(tag)>0, "Expect tag: %s is not listed"%tag)
|
self.assertTrue(tags.count(tag)>0, "Expect tag: %s is not listed"%tag)
|
||||||
page_tags = library.docker_api.list_image_tags(harbor_server,TestProjects.repo_c,user_Alice_name,user_common_password,len(tags)/2+1)
|
page_tags = list_image_tags(harbor_server,TestProjects.repo_c,user_Alice_name,user_common_password,len(tags)/2+1)
|
||||||
page_tags += library.docker_api.list_image_tags(harbor_server,TestProjects.repo_c,user_Alice_name,user_common_password,len(tags)/2+1,tags[len(tags)/2])
|
page_tags += list_image_tags(harbor_server,TestProjects.repo_c,user_Alice_name,user_common_password,len(tags)/2+1,tags[int(len(tags)/2)])
|
||||||
for tag in create_tags:
|
for tag in create_tags:
|
||||||
self.assertTrue(page_tags.count(tag)>0, "Expect tag: %s is not listed by the pagination query"%tag)
|
self.assertTrue(page_tags.count(tag)>0, "Expect tag: %s is not listed by the pagination query"%tag)
|
||||||
#5. Call the catalog API;
|
#5. Call the catalog API;
|
||||||
repos = library.docker_api.list_repositories(harbor_server,admin_user,admin_pwd)
|
repos = list_repositories(harbor_server,admin_user,admin_pwd)
|
||||||
self.assertTrue(repos.count(TestProjects.repo_a)>0 and repos.count(TestProjects.repo_b)>0 and repos.count(TestProjects.repo_c)>0, "Expected repo not found")
|
self.assertTrue(repos.count(TestProjects.repo_a)>0 and repos.count(TestProjects.repo_b)>0 and repos.count(TestProjects.repo_c)>0, "Expected repo not found")
|
||||||
for repo in [TestProjects.repo_a,TestProjects.repo_b,TestProjects.repo_c]:
|
for repo in [TestProjects.repo_a,TestProjects.repo_b,TestProjects.repo_c]:
|
||||||
self.assertTrue(repos.count(repo)>0,"Expected repo: %s is not listed"%repo)
|
self.assertTrue(repos.count(repo)>0,"Expected repo: %s is not listed"%repo)
|
||||||
page_repos = library.docker_api.list_repositories(harbor_server,admin_user,admin_pwd,len(repos)/2+1)
|
page_repos = list_repositories(harbor_server,admin_user,admin_pwd,len(repos)/2+1)
|
||||||
page_repos += library.docker_api.list_repositories(harbor_server,admin_user,admin_pwd,len(repos)/2+1,repos[len(repos)/2])
|
page_repos += list_repositories(harbor_server,admin_user,admin_pwd,len(repos)/2+1,repos[int(len(repos)/2)])
|
||||||
for repo in [TestProjects.repo_a,TestProjects.repo_b,TestProjects.repo_c]:
|
for repo in [TestProjects.repo_a,TestProjects.repo_b,TestProjects.repo_c]:
|
||||||
self.assertTrue(page_repos.count(repo)>0,"Expected repo: %s is not listed by the pagination query"%repo)
|
self.assertTrue(page_repos.count(repo)>0,"Expected repo: %s is not listed by the pagination query"%repo)
|
||||||
|
|
||||||
null_repos = library.docker_api.list_repositories(harbor_server,user_Alice_name,user_common_password)
|
null_repos = list_repositories(harbor_server,user_Alice_name,user_common_password)
|
||||||
self.assertEqual(null_repos, "")
|
self.assertEqual(null_repos, "")
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -8,7 +8,6 @@ from testutils import TEARDOWN
|
||||||
from testutils import harbor_server
|
from testutils import harbor_server
|
||||||
from library.repository import push_special_image_to_project
|
from library.repository import push_special_image_to_project
|
||||||
from library.docker_api import list_image_tags
|
from library.docker_api import list_image_tags
|
||||||
|
|
||||||
from library.retention import Retention
|
from library.retention import Retention
|
||||||
from library.project import Project
|
from library.project import Project
|
||||||
from library.repository import Repository
|
from library.repository import Repository
|
||||||
|
|
|
@ -4,12 +4,12 @@ import unittest
|
||||||
|
|
||||||
from testutils import ADMIN_CLIENT
|
from testutils import ADMIN_CLIENT
|
||||||
from testutils import TEARDOWN
|
from testutils import TEARDOWN
|
||||||
|
from testutils import harbor_server
|
||||||
from library.user import User
|
from library.user import User
|
||||||
from library.project import Project
|
from library.project import Project
|
||||||
from library.repository import Repository
|
from library.repository import Repository
|
||||||
from library.repository import pull_harbor_image
|
from library.repository import pull_harbor_image
|
||||||
from library.repository import push_image_to_project
|
from library.repository import push_image_to_project
|
||||||
from testutils import harbor_server
|
|
||||||
from library.base import _assert_status_code
|
from library.base import _assert_status_code
|
||||||
|
|
||||||
class TestProjects(unittest.TestCase):
|
class TestProjects(unittest.TestCase):
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from library.sign import sign_image
|
|
||||||
from testutils import ADMIN_CLIENT
|
from testutils import ADMIN_CLIENT
|
||||||
from testutils import harbor_server
|
from testutils import harbor_server
|
||||||
from testutils import TEARDOWN
|
from testutils import TEARDOWN
|
||||||
|
from library.sign import sign_image
|
||||||
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
|
||||||
|
|
|
@ -3,6 +3,13 @@ import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.insert(0, os.environ["SWAGGER_CLIENT_PATH"])
|
sys.path.insert(0, os.environ["SWAGGER_CLIENT_PATH"])
|
||||||
|
path=os.getcwd() + "/library"
|
||||||
|
sys.path.insert(0, path)
|
||||||
|
|
||||||
|
|
||||||
|
path=os.getcwd() + "/tests/apitests/python/library"
|
||||||
|
sys.path.insert(0, path)
|
||||||
|
|
||||||
import v2_swagger_client
|
import v2_swagger_client
|
||||||
from swagger_client.rest import ApiException
|
from swagger_client.rest import ApiException
|
||||||
import swagger_client.models
|
import swagger_client.models
|
||||||
|
|
|
@ -165,7 +165,7 @@ Docker Pull
|
||||||
[Arguments] ${image}
|
[Arguments] ${image}
|
||||||
${output}= Retry Keyword N Times When Error 10 Wait Unitl Command Success docker pull ${image}
|
${output}= Retry Keyword N Times When Error 10 Wait Unitl Command Success docker pull ${image}
|
||||||
Log ${output}
|
Log ${output}
|
||||||
Log To Console Docker Pull: \n ${output}
|
Log To Console Docker Pull: ${output}
|
||||||
[Return] ${output}
|
[Return] ${output}
|
||||||
|
|
||||||
Docker Tag
|
Docker Tag
|
||||||
|
|
|
@ -26,7 +26,7 @@ Install Harbor to Test Server
|
||||||
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 \n${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
|
||||||
|
@ -34,7 +34,7 @@ Install Harbor to Test Server
|
||||||
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 \n${output}
|
Log To Console ${output}
|
||||||
Generate Certificate Authority For Chrome
|
Generate Certificate Authority For Chrome
|
||||||
|
|
||||||
Up Harbor
|
Up Harbor
|
||||||
|
@ -55,7 +55,7 @@ Package Harbor Offline
|
||||||
[Arguments] ${with_notary}=true ${with_clair}=true ${with_chartmuseum}=true ${with_trivy}=true
|
[Arguments] ${with_notary}=true ${with_clair}=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 \n\nmake package_offline GOBUILDTAGS="include_oss include_gcs" BASEIMAGETAG=%{Harbor_Build_Base_Tag} NPM_REGISTRY=%{NPM_REGISTRY} VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} CHARTFLAG=${with_chartmuseum} TRIVYFLAG=${with_trivy} HTTPPROXY=
|
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} CLAIRFLAG=${with_clair} CHARTFLAG=${with_chartmuseum} TRIVYFLAG=${with_trivy} HTTPPROXY=
|
||||||
${rc} ${output}= Run And Return Rc And Output make package_offline GOBUILDTAGS="include_oss include_gcs" BASEIMAGETAG=%{Harbor_Build_Base_Tag} NPM_REGISTRY=%{NPM_REGISTRY} VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} CHARTFLAG=${with_chartmuseum} TRIVYFLAG=${with_trivy} HTTPPROXY=
|
${rc} ${output}= Run And Return Rc And Output make package_offline GOBUILDTAGS="include_oss include_gcs" BASEIMAGETAG=%{Harbor_Build_Base_Tag} NPM_REGISTRY=%{NPM_REGISTRY} VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} CHARTFLAG=${with_chartmuseum} TRIVYFLAG=${with_trivy} HTTPPROXY=
|
||||||
Log To Console ${rc}
|
Log To Console ${rc}
|
||||||
Log To Console ${output}
|
Log To Console ${output}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user