Skip to content

Commit

Permalink
feat mysql and mariadb
Browse files Browse the repository at this point in the history
Signed-off-by: yvonnexyang <yvonnexyang@tencent.com>
  • Loading branch information
JinXingYoung committed Oct 10, 2022
1 parent e078cd7 commit 098974d
Show file tree
Hide file tree
Showing 145 changed files with 5,773 additions and 487 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/CI-mariadb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: CI-mariadb
env:
DATABASE_TYPE: mariadb
DB_HOST: localhost
DB_PORT: 3306
DB_USERNAME: root
DB_PASSWORD: root123
DB_DATABASE: registry
DB_COLLATION: utf8mb4_general_ci
DOCKER_COMPOSE_VERSION: 1.23.0
HARBOR_ADMIN: admin
HARBOR_ADMIN_PASSWD: Harbor12345
CORE_SECRET: tempString
KEY_PATH: "/data/secret/keys/secretkey"
REDIS_HOST: localhost
REG_VERSION: v2.7.1-patch-2819-2553
UI_BUILDER_VERSION: 1.6.0

on:
pull_request:
push:
paths-ignore:
- 'docs/**'

jobs:
UTTEST4MARIADB:
env:
UTTEST: true
runs-on:
#- self-hosted
- ubuntu-latest
timeout-minutes: 100
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v1
with:
go-version: 1.17.7
id: go
- name: setup Docker
uses: docker-practice/actions-setup-docker@0.0.1
with:
docker_version: 20.04
docker_channel: stable
- uses: actions/checkout@v2
with:
path: src/github.com/goharbor/harbor
- name: setup env
run: |
cd src/github.com/goharbor/harbor
pwd
go env
echo "GOPATH=$(go env GOPATH):$GITHUB_WORKSPACE" >> $GITHUB_ENV
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
shell: bash
- name: before_install
run: |
set -x
cd src/github.com/goharbor/harbor
pwd
env
#sudo apt install -y xvfb
#xvfb-run ls
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 "IP=$IP" >> $GITHUB_ENV
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/ut_install.sh
- name: script
run: |
echo IP: $IP
df -h
cd src/github.com/goharbor/harbor
bash ./tests/showtime.sh ./tests/ci/ut_run.sh $IP
df -h
- name: Codecov For BackEnd
uses: codecov/codecov-action@v1
with:
file: ./src/github.com/goharbor/harbor/profile.cov
flags: unittests

91 changes: 91 additions & 0 deletions .github/workflows/CI-mysql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: CI-mysql
env:
DATABASE_TYPE: mysql
DB_HOST: localhost
DB_PORT: 3308
DB_USERNAME: root
DB_PASSWORD: root123
DB_DATABASE: registry
DB_COLLATION: utf8mb4_general_ci
DOCKER_COMPOSE_VERSION: 1.23.0
HARBOR_ADMIN: admin
HARBOR_ADMIN_PASSWD: Harbor12345
CORE_SECRET: tempString
KEY_PATH: "/data/secret/keys/secretkey"
REDIS_HOST: localhost
REG_VERSION: v2.7.1-patch-2819-2553
UI_BUILDER_VERSION: 1.6.0

on:
pull_request:
push:
paths-ignore:
- 'docs/**'

jobs:
UTTEST4MYSQL:
env:
UTTEST: true
runs-on:
#- self-hosted
- ubuntu-latest
timeout-minutes: 100
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v1
with:
go-version: 1.17.7
id: go
- name: setup Docker
uses: docker-practice/actions-setup-docker@0.0.1
with:
docker_version: 20.04
docker_channel: stable
- uses: actions/checkout@v2
with:
path: src/github.com/goharbor/harbor
- name: setup env
run: |
cd src/github.com/goharbor/harbor
pwd
go env
echo "GOPATH=$(go env GOPATH):$GITHUB_WORKSPACE" >> $GITHUB_ENV
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
shell: bash
- name: before_install
run: |
set -x
cd src/github.com/goharbor/harbor
pwd
env
#sudo apt install -y xvfb
#xvfb-run ls
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 "IP=$IP" >> $GITHUB_ENV
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/ut_install.sh
- name: script
run: |
echo IP: $IP
df -h
cd src/github.com/goharbor/harbor
bash ./tests/showtime.sh ./tests/ci/ut_run.sh $IP
df -h
- name: Codecov For BackEnd
uses: codecov/codecov-action@v1
with:
file: ./src/github.com/goharbor/harbor/profile.cov
flags: unittests

11 changes: 6 additions & 5 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: CI
env:
POSTGRESQL_HOST: localhost
POSTGRESQL_PORT: 5432
POSTGRESQL_USR: postgres
POSTGRESQL_PWD: root123
POSTGRESQL_DATABASE: registry
DATABASE_TYPE: postgresql
DB_HOST: localhost
DB_PORT: 5432
DB_USERNAME: postgres
DB_PASSWORD: root123
DB_DATABASE: registry
DOCKER_COMPOSE_VERSION: 1.23.0
HARBOR_ADMIN: admin
HARBOR_ADMIN_PASSWD: Harbor12345
Expand Down
4 changes: 4 additions & 0 deletions make/harbor.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,16 @@ _version: 2.6.0
# Uncomment external_database if using external database.
# external_database:
# harbor:
# # database type, default is postgresql, options include postgresql, mariadb and mysql
# type: harbor_db_type
# host: harbor_db_host
# port: harbor_db_port
# db_name: harbor_db_name
# username: harbor_db_username
# password: harbor_db_password
# ssl_mode: disable
# # collation setting for mariadb and mysql
# collation: utf8mb4_general_ci
# max_idle_conns: 2
# max_open_conns: 0
# notary_signer:
Expand Down
Loading

0 comments on commit 098974d

Please sign in to comment.