From dc2595b4891e4f52dbb34244e3abfef2d012ce34 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 31 Oct 2018 21:24:17 +0800 Subject: [PATCH 1/7] Add test environment for Mysql8 --- .drone.yml | 23 ++++++++++++ .gitignore | 3 ++ Makefile | 19 ++++++++-- integrations/mysql8.ini.tmpl | 72 ++++++++++++++++++++++++++++++++++++ 4 files changed, 114 insertions(+), 3 deletions(-) create mode 100644 integrations/mysql8.ini.tmpl diff --git a/.drone.yml b/.drone.yml index 1a770ef4b659a..7148886261087 100644 --- a/.drone.yml +++ b/.drone.yml @@ -161,6 +161,21 @@ pipeline: when: event: [ tag ] + test-mysql8: + image: golang:1.11 + pull: true + group: test + environment: + TAGS: bindata + TEST_LDAP: "1" + commands: + - curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash + - apt-get install -y git-lfs + - (sleep 1200 && (echo 'kill -ABRT $(pidof gitea) $(pidof integrations.test)' | sh)) & + - make test-mysql8 + when: + event: [ tag ] + test-pgsql: image: golang:1.11 pull: true @@ -337,6 +352,14 @@ services: when: event: [ push, tag, pull_request ] + mysql8: + image: mysql:8.0 + environment: + - MYSQL_DATABASE=test + - MYSQL_ALLOW_EMPTY_PASSWORD=yes + when: + event: [ push, tag, pull_request ] + pgsql: image: postgres:9.5 environment: diff --git a/.gitignore b/.gitignore index 9a5f01bb94c43..e197ed8dc334a 100644 --- a/.gitignore +++ b/.gitignore @@ -51,12 +51,15 @@ coverage.all /log /public/img/avatar /integrations/gitea-integration-mysql +/integrations/gitea-integration-mysql8 /integrations/gitea-integration-pgsql /integrations/gitea-integration-sqlite /integrations/indexers-mysql +/integrations/indexers-mysql8 /integrations/indexers-pgsql /integrations/indexers-sqlite /integrations/mysql.ini +/integrations/mysql8.ini /integrations/pgsql.ini /node_modules diff --git a/Makefile b/Makefile index 6f3779e30b568..948830bce0eac 100644 --- a/Makefile +++ b/Makefile @@ -50,6 +50,10 @@ TEST_MYSQL_HOST ?= mysql:3306 TEST_MYSQL_DBNAME ?= testgitea TEST_MYSQL_USERNAME ?= root TEST_MYSQL_PASSWORD ?= +TEST_MYSQL8_HOST ?= mysql8:3306 +TEST_MYSQL8_DBNAME ?= testgitea +TEST_MYSQL8_USERNAME ?= root +TEST_MYSQL8_PASSWORD ?= TEST_PGSQL_HOST ?= pgsql:5432 TEST_PGSQL_DBNAME ?= testgitea TEST_PGSQL_USERNAME ?= postgres @@ -74,9 +78,9 @@ clean: $(GO) clean -i ./... rm -rf $(EXECUTABLE) $(DIST) $(BINDATA) \ integrations*.test \ - integrations/gitea-integration-pgsql/ integrations/gitea-integration-mysql/ integrations/gitea-integration-sqlite/ \ - integrations/indexers-mysql/ integrations/indexers-pgsql integrations/indexers-sqlite \ - integrations/mysql.ini integrations/pgsql.ini + integrations/gitea-integration-pgsql/ integrations/gitea-integration-mysql/ integrations/gitea-integration-mysql8/ integrations/gitea-integration-sqlite/ \ + integrations/indexers-mysql/ integrations/indexers-mysql8/ integrations/indexers-pgsql integrations/indexers-sqlite \ + integrations/mysql.ini integrations/mysql8.ini integrations/pgsql.ini .PHONY: fmt fmt: @@ -199,6 +203,11 @@ generate-ini: -e 's|{{TEST_MYSQL_USERNAME}}|${TEST_MYSQL_USERNAME}|g' \ -e 's|{{TEST_MYSQL_PASSWORD}}|${TEST_MYSQL_PASSWORD}|g' \ integrations/mysql.ini.tmpl > integrations/mysql.ini + sed -e 's|{{TEST_MYSQL8_HOST}}|${TEST_MYSQL8_HOST}|g' \ + -e 's|{{TEST_MYSQL8_DBNAME}}|${TEST_MYSQL8_DBNAME}|g' \ + -e 's|{{TEST_MYSQL8_USERNAME}}|${TEST_MYSQL8_USERNAME}|g' \ + -e 's|{{TEST_MYSQL8_PASSWORD}}|${TEST_MYSQL8_PASSWORD}|g' \ + integrations/mysql8.ini.tmpl > integrations/mysql8.ini sed -e 's|{{TEST_PGSQL_HOST}}|${TEST_PGSQL_HOST}|g' \ -e 's|{{TEST_PGSQL_DBNAME}}|${TEST_PGSQL_DBNAME}|g' \ -e 's|{{TEST_PGSQL_USERNAME}}|${TEST_PGSQL_USERNAME}|g' \ @@ -209,6 +218,10 @@ generate-ini: test-mysql: integrations.test generate-ini GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.test +.PHONY: test-mysql8 +test-mysql8: integrations.test generate-ini + GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql8.ini ./integrations.test + .PHONY: test-pgsql test-pgsql: integrations.test generate-ini GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.test diff --git a/integrations/mysql8.ini.tmpl b/integrations/mysql8.ini.tmpl new file mode 100644 index 0000000000000..ecd6ea569776e --- /dev/null +++ b/integrations/mysql8.ini.tmpl @@ -0,0 +1,72 @@ +APP_NAME = Gitea: Git with a cup of tea +RUN_MODE = prod + +[database] +DB_TYPE = mysql +HOST = {{TEST_MYSQL8_HOST}} +NAME = {{TEST_MYSQL8_DBNAME}} +USER = {{TEST_MYSQL8_USERNAME}} +PASSWD = {{TEST_MYSQL8_PASSWORD}} +SSL_MODE = disable + +[indexer] +ISSUE_INDEXER_PATH = integrations/indexers-mysql/issues.bleve +REPO_INDEXER_ENABLED = true +REPO_INDEXER_PATH = integrations/indexers-mysql/repos.bleve + +[repository] +ROOT = integrations/gitea-integration-mysql/gitea-repositories + +[repository.local] +LOCAL_COPY_PATH = tmp/local-repo-mysql +LOCAL_WIKI_PATH = tmp/local-wiki-mysql + +[server] +SSH_DOMAIN = localhost +HTTP_PORT = 3001 +ROOT_URL = http://localhost:3001/ +DISABLE_SSH = false +SSH_LISTEN_HOST = localhost +SSH_PORT = 2201 +START_SSH_SERVER = true +LFS_START_SERVER = true +LFS_CONTENT_PATH = data/lfs-mysql +OFFLINE_MODE = false +LFS_JWT_SECRET = Tv_MjmZuHqpIY6GFl12ebgkRAMt4RlWt0v4EHKSXO0w +APP_DATA_PATH = integrations/gitea-integration-mysql/data + +[mailer] +ENABLED = false + +[service] +REGISTER_EMAIL_CONFIRM = false +ENABLE_NOTIFY_MAIL = false +DISABLE_REGISTRATION = false +ENABLE_CAPTCHA = false +REQUIRE_SIGNIN_VIEW = false +DEFAULT_KEEP_EMAIL_PRIVATE = false +DEFAULT_ALLOW_CREATE_ORGANIZATION = true +NO_REPLY_ADDRESS = noreply.example.org + +[picture] +DISABLE_GRAVATAR = false +ENABLE_FEDERATED_AVATAR = false + +[session] +PROVIDER = file +PROVIDER_CONFIG = data/sessions-mysql + +[log] +MODE = console,file +ROOT_PATH = mysql-log + +[log.console] +LEVEL = Warn + +[log.file] +LEVEL = Debug + +[security] +INSTALL_LOCK = true +SECRET_KEY = 9pCviYTWSb +INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE0OTU1NTE2MTh9.hhSVGOANkaKk3vfCd2jDOIww4pUk0xtg9JRde5UogyQ From 070253df199a29cc4331fa2ade2e37c86595a578 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 31 Oct 2018 21:45:42 +0800 Subject: [PATCH 2/7] fix drone test for mysql8 --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 7148886261087..b47b9c7298b4b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -174,7 +174,7 @@ pipeline: - (sleep 1200 && (echo 'kill -ABRT $(pidof gitea) $(pidof integrations.test)' | sh)) & - make test-mysql8 when: - event: [ tag ] + event: [ push, tag, pull_request ] test-pgsql: image: golang:1.11 From 785a109698228638d9e819b3154b0ff15ee2d850 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 1 Nov 2018 09:03:06 +0800 Subject: [PATCH 3/7] update mysql8.ini.tmpl --- integrations/mysql8.ini.tmpl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/integrations/mysql8.ini.tmpl b/integrations/mysql8.ini.tmpl index ecd6ea569776e..0f721928d0112 100644 --- a/integrations/mysql8.ini.tmpl +++ b/integrations/mysql8.ini.tmpl @@ -10,21 +10,21 @@ PASSWD = {{TEST_MYSQL8_PASSWORD}} SSL_MODE = disable [indexer] -ISSUE_INDEXER_PATH = integrations/indexers-mysql/issues.bleve +ISSUE_INDEXER_PATH = integrations/indexers-mysql8/issues.bleve REPO_INDEXER_ENABLED = true -REPO_INDEXER_PATH = integrations/indexers-mysql/repos.bleve +REPO_INDEXER_PATH = integrations/indexers-mysql8/repos.bleve [repository] -ROOT = integrations/gitea-integration-mysql/gitea-repositories +ROOT = integrations/gitea-integration-mysql8/gitea-repositories [repository.local] -LOCAL_COPY_PATH = tmp/local-repo-mysql -LOCAL_WIKI_PATH = tmp/local-wiki-mysql +LOCAL_COPY_PATH = tmp/local-repo-mysql8 +LOCAL_WIKI_PATH = tmp/local-wiki-mysql8 [server] SSH_DOMAIN = localhost HTTP_PORT = 3001 -ROOT_URL = http://localhost:3001/ +ROOT_URL = http://localhost:3003/ DISABLE_SSH = false SSH_LISTEN_HOST = localhost SSH_PORT = 2201 From 2b97c85db4f90612c8dc16275e799f8d5d0b0eca Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 7 Nov 2018 17:47:52 +0800 Subject: [PATCH 4/7] fix tests --- integrations/mysql8.ini.tmpl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/integrations/mysql8.ini.tmpl b/integrations/mysql8.ini.tmpl index 0f721928d0112..246ec800a6841 100644 --- a/integrations/mysql8.ini.tmpl +++ b/integrations/mysql8.ini.tmpl @@ -23,17 +23,17 @@ LOCAL_WIKI_PATH = tmp/local-wiki-mysql8 [server] SSH_DOMAIN = localhost -HTTP_PORT = 3001 -ROOT_URL = http://localhost:3003/ +HTTP_PORT = 3004 +ROOT_URL = http://localhost:3004/ DISABLE_SSH = false SSH_LISTEN_HOST = localhost -SSH_PORT = 2201 +SSH_PORT = 2204 START_SSH_SERVER = true LFS_START_SERVER = true -LFS_CONTENT_PATH = data/lfs-mysql +LFS_CONTENT_PATH = data/lfs-mysql8 OFFLINE_MODE = false LFS_JWT_SECRET = Tv_MjmZuHqpIY6GFl12ebgkRAMt4RlWt0v4EHKSXO0w -APP_DATA_PATH = integrations/gitea-integration-mysql/data +APP_DATA_PATH = integrations/gitea-integration-mysql8/data [mailer] ENABLED = false @@ -54,11 +54,11 @@ ENABLE_FEDERATED_AVATAR = false [session] PROVIDER = file -PROVIDER_CONFIG = data/sessions-mysql +PROVIDER_CONFIG = data/sessions-mysql8 [log] MODE = console,file -ROOT_PATH = mysql-log +ROOT_PATH = mysql8-log [log.console] LEVEL = Warn From 232bf423914d9f9368210ae607f65a11d029eb73 Mon Sep 17 00:00:00 2001 From: techknowlogick Date: Sat, 5 Jan 2019 01:46:20 -0500 Subject: [PATCH 5/7] Update .drone.yml --- .drone.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.drone.yml b/.drone.yml index c54be7817e576..cf85f5a7848ae 100644 --- a/.drone.yml +++ b/.drone.yml @@ -374,6 +374,7 @@ services: environment: - MYSQL_DATABASE=test - MYSQL_ALLOW_EMPTY_PASSWORD=yes + - MYSQL_DATABASE=testgitea when: event: [ push, tag, pull_request ] From 6c5b44619f9bb07f85d4f0ae2b0a9784fc1d3af1 Mon Sep 17 00:00:00 2001 From: techknowlogick Date: Wed, 6 Mar 2019 13:31:45 -0500 Subject: [PATCH 6/7] Update Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 39672e3a645ec..4d9f5e72b6fc4 100644 --- a/Makefile +++ b/Makefile @@ -242,7 +242,7 @@ test-mysql8: integrations.test generate-ini GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql8.ini ./integrations.test .PHONY: test-mysql8-migration -test-mysql-migration: migrations.test generate-ini +test-mysql8-migration: migrations.test generate-ini GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql8.ini ./migrations.test .PHONY: test-pgsql From d6ece5f92d7e379e7b6437a4ec4b5a735e9e4382 Mon Sep 17 00:00:00 2001 From: techknowlogick Date: Wed, 6 Mar 2019 13:38:07 -0500 Subject: [PATCH 7/7] mysql8 migration test --- .drone.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.drone.yml b/.drone.yml index f183dee995ac4..311d3fd611870 100644 --- a/.drone.yml +++ b/.drone.yml @@ -175,6 +175,7 @@ pipeline: - curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash - apt-get install -y git-lfs - (sleep 1200 && (echo 'kill -ABRT $(pidof gitea) $(pidof integrations.test)' | sh)) & + - make test-mysql8-migration - make test-mysql8 when: event: [ push, tag, pull_request ]