mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 18:25:56 +01:00
Merge pull request #11801 from wy65701436/conformance-ci
add conformance test to CI
This commit is contained in:
commit
2f2fe8ba68
75
.github/workflows/conformance_test.yml
vendored
Normal file
75
.github/workflows/conformance_test.yml
vendored
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
name: CONFORMANCE_TEST
|
||||||
|
env:
|
||||||
|
DOCKER_COMPOSE_VERSION: 1.23.0
|
||||||
|
|
||||||
|
on:
|
||||||
|
repository_dispatch:
|
||||||
|
types:
|
||||||
|
- manual-trigger-conformance
|
||||||
|
schedule:
|
||||||
|
- cron: '0 6 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
CONFORMANCE_TEST:
|
||||||
|
env:
|
||||||
|
CONFORMANCE_TEST: true
|
||||||
|
runs-on:
|
||||||
|
#- self-hosted
|
||||||
|
- ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
|
||||||
|
with:
|
||||||
|
version: '285.0.0'
|
||||||
|
project_id: ${{ secrets.GCP_PROJECT_ID }}
|
||||||
|
service_account_email: ${{ secrets.GCP_SA_EMAIL }}
|
||||||
|
service_account_key: ${{ secrets.GCP_SA_KEY }}
|
||||||
|
export_default_credentials: true
|
||||||
|
- run: gcloud info
|
||||||
|
- name: Set up Go 1.13
|
||||||
|
uses: actions/setup-go@v1
|
||||||
|
with:
|
||||||
|
go-version: 1.13.8
|
||||||
|
id: go
|
||||||
|
- name: setup Docker
|
||||||
|
uses: docker-practice/actions-setup-docker@0.0.1
|
||||||
|
with:
|
||||||
|
docker_version: 18.09
|
||||||
|
docker_channel: stable
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
path: src/github.com/goharbor/harbor
|
||||||
|
- name: before_install
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
cd src/github.com/goharbor/harbor
|
||||||
|
pwd
|
||||||
|
env
|
||||||
|
df -h
|
||||||
|
curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
|
||||||
|
chmod +x docker-compose
|
||||||
|
sudo mv docker-compose /usr/local/bin
|
||||||
|
IP=`hostname -I | awk '{print $1}'`
|
||||||
|
echo '{"insecure-registries" : ["'$IP':5000"]}' | sudo tee /etc/docker/daemon.json
|
||||||
|
echo "::set-env name=IP::$IP"
|
||||||
|
sudo cp ./tests/harbor_ca.crt /usr/local/share/ca-certificates/
|
||||||
|
sudo update-ca-certificates
|
||||||
|
sudo service docker restart
|
||||||
|
- name: install
|
||||||
|
run: |
|
||||||
|
cd src/github.com/goharbor/harbor
|
||||||
|
env
|
||||||
|
df -h
|
||||||
|
bash ./tests/showtime.sh ./tests/ci/api_common_install.sh $IP DB
|
||||||
|
- name: script
|
||||||
|
run: |
|
||||||
|
echo IP: $IP
|
||||||
|
df -h
|
||||||
|
cd src/github.com/goharbor/harbor
|
||||||
|
bash ./tests/showtime.sh ./tests/ci/conformance_test.sh $IP
|
||||||
|
df -h
|
||||||
|
- name: upload test result to gs
|
||||||
|
run: |
|
||||||
|
gsutil cp report.html gs://harbor-conformance-test/report.html
|
||||||
|
gsutil acl ch -u AllUsers:R gs://harbor-conformance-test/report.html
|
||||||
|
if: always()
|
@ -1,12 +1,12 @@
|
|||||||
# Harbor
|
# Harbor
|
||||||
|
|
||||||
[![CI](https://github.com/goharbor/harbor/workflows/CI/badge.svg?branch=master&event=push)](https:///github.com/goharbor/harbor/actions?query=event%3Apush+branch%3Amaster+workflow%3ACI+)
|
[![CI](https://github.com/goharbor/harbor/workflows/CI/badge.svg?branch=master&event=push)](https://github.com/goharbor/harbor/actions?query=event%3Apush+branch%3Amaster+workflow%3ACI+)
|
||||||
[![Coverage Status](https://codecov.io/gh/goharbor/harbor/branch/master/graph/badge.svg)](https://codecov.io/gh/goharbor/harbor)
|
[![Coverage Status](https://codecov.io/gh/goharbor/harbor/branch/master/graph/badge.svg)](https://codecov.io/gh/goharbor/harbor)
|
||||||
[![Go Report Card](https://goreportcard.com/badge/github.com/goharbor/harbor)](https://goreportcard.com/report/github.com/goharbor/harbor)
|
[![Go Report Card](https://goreportcard.com/badge/github.com/goharbor/harbor)](https://goreportcard.com/report/github.com/goharbor/harbor)
|
||||||
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2095/badge)](https://bestpractices.coreinfrastructure.org/projects/2095)
|
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2095/badge)](https://bestpractices.coreinfrastructure.org/projects/2095)
|
||||||
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/c8d726c9cfd047ffaf681449d673f246)](https://www.codacy.com/app/goharbor/harbor?utm_source=github.com&utm_medium=referral&utm_content=goharbor/harbor&utm_campaign=Badge_Grade)
|
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/c8d726c9cfd047ffaf681449d673f246)](https://www.codacy.com/app/goharbor/harbor?utm_source=github.com&utm_medium=referral&utm_content=goharbor/harbor&utm_campaign=Badge_Grade)
|
||||||
[![Nightly Status](https://us-central1-eminent-nation-87317.cloudfunctions.net/harbor-nightly-result)](https://www.googleapis.com/storage/v1/b/harbor-nightly/o)
|
[![Nightly Status](https://us-central1-eminent-nation-87317.cloudfunctions.net/harbor-nightly-result)](https://www.googleapis.com/storage/v1/b/harbor-nightly/o)
|
||||||
|
[![Conformance Status](https://github.com/goharbor/harbor/workflows/conformance_test/badge.svg)](https://github.com/goharbor/harbor/actions?query=workflow%3Aconformance_test)
|
||||||
</br>
|
</br>
|
||||||
|
|
||||||
|![notification](docs/img/bell-outline-badged.svg)Community Meeting|
|
|![notification](docs/img/bell-outline-badged.svg)Community Meeting|
|
||||||
|
23
tests/ci/conformance_test.sh
Executable file
23
tests/ci/conformance_test.sh
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
set -e
|
||||||
|
|
||||||
|
echo "get the conformance testing code..."
|
||||||
|
git clone https://github.com/opencontainers/distribution-spec.git
|
||||||
|
|
||||||
|
echo "create testing project"
|
||||||
|
STATUS=$(curl -w '%{http_code}' -H 'Content-Type: application/json' -H 'Accept: application/json' -X POST -u "admin:Harbor12345" -s --insecure "https://$IP/api/v2.0/projects" --data '{"project_name":"conformance","metadata":{"public":"false"},"storage_limit":-1}')
|
||||||
|
if [ $STATUS -ne 201 ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "run conformance test..."
|
||||||
|
export OCI_ROOT_URL="https://$1"
|
||||||
|
export OCI_NAMESPACE="conformance/testrepo"
|
||||||
|
export OCI_USERNAME="admin"
|
||||||
|
export OCI_PASSWORD="Harbor12345"
|
||||||
|
export OCI_DEBUG="true"
|
||||||
|
## will add more test, so far only cover pull & push
|
||||||
|
export OCI_TEST_PUSH=1
|
||||||
|
export OCI_TEST_PULL=1
|
||||||
|
|
||||||
|
cd ./distribution-spec/conformance
|
||||||
|
go test .
|
Loading…
Reference in New Issue
Block a user