BigW Consortium Gitlab

Commit f1e2387e by Lin Jen-Shin

Use GITLAB_DATABASE: $CI_JOB_NAME[1] so that we

parent a9945a65
...@@ -7,6 +7,7 @@ cache: ...@@ -7,6 +7,7 @@ cache:
variables: variables:
MYSQL_ALLOW_EMPTY_PASSWORD: "1" MYSQL_ALLOW_EMPTY_PASSWORD: "1"
GITLAB_DATABASE: $CI_JOB_NAME[1]
RAILS_ENV: "test" RAILS_ENV: "test"
NODE_ENV: "test" NODE_ENV: "test"
SIMPLECOV: "true" SIMPLECOV: "true"
...@@ -51,15 +52,11 @@ stages: ...@@ -51,15 +52,11 @@ stages:
services: services:
- postgres:latest - postgres:latest
- redis:alpine - redis:alpine
variables:
GITLAB_DATABASE: "postgresql"
.use-mysql: &use-mysql .use-mysql: &use-mysql
services: services:
- mysql:latest - mysql:latest
- redis:alpine - redis:alpine
variables:
GITLAB_DATABASE: "mysql"
.only-master-and-ee-or-mysql: &only-master-and-ee-or-mysql .only-master-and-ee-or-mysql: &only-master-and-ee-or-mysql
only: only:
...@@ -288,11 +285,11 @@ rake ee_compat_check: ...@@ -288,11 +285,11 @@ rake ee_compat_check:
script: script:
- bundle exec rake db:migrate:reset - bundle exec rake db:migrate:reset
pg rake db:migrate:reset: rake pg db:migrate:reset:
<<: *db-migrate-reset <<: *db-migrate-reset
<<: *use-pg <<: *use-pg
mysql rake db:migrate:reset: rake mysql db:migrate:reset:
<<: *db-migrate-reset <<: *db-migrate-reset
<<: *use-mysql <<: *use-mysql
...@@ -303,19 +300,14 @@ mysql rake db:migrate:reset: ...@@ -303,19 +300,14 @@ mysql rake db:migrate:reset:
- bundle exec rake db:rollback STEP=120 - bundle exec rake db:rollback STEP=120
- bundle exec rake db:migrate - bundle exec rake db:migrate
pg rake db:rollback: rake pg db:rollback:
<<: *db-rollback <<: *db-rollback
<<: *use-pg <<: *use-pg
mysql rake db:rollback: rake mysql db:rollback:
<<: *db-rollback <<: *db-rollback
<<: *use-mysql <<: *use-mysql
.db-seed_fu-variables: &db-seed_fu-variables
SIZE: "1"
SETUP_DB: "false"
RAILS_ENV: "development"
.db-seed_fu: &db-seed_fu .db-seed_fu: &db-seed_fu
stage: test stage: test
<<: *dedicated-runner <<: *dedicated-runner
...@@ -323,25 +315,24 @@ mysql rake db:rollback: ...@@ -323,25 +315,24 @@ mysql rake db:rollback:
- git clone https://gitlab.com/gitlab-org/gitlab-test.git - git clone https://gitlab.com/gitlab-org/gitlab-test.git
/home/git/repositories/gitlab-org/gitlab-test.git /home/git/repositories/gitlab-org/gitlab-test.git
- bundle exec rake db:setup db:seed_fu - bundle exec rake db:setup db:seed_fu
variables:
GITLAB_DATABASE: $CI_JOB_NAME[1]
SIZE: "1"
SETUP_DB: "false"
RAILS_ENV: "development"
artifacts: artifacts:
when: on_failure when: on_failure
expire_in: 1d expire_in: 1d
paths: paths:
- log/development.log - log/development.log
pg rake db:seed_fu: rake pg db:seed_fu:
<<: *db-seed_fu <<: *db-seed_fu
<<: *use-pg <<: *use-pg
variables:
<<: *db-seed_fu-variables
GITLAB_DATABASE: "postgresql"
mysql rake db:seed_fu: rake mysql db:seed_fu:
<<: *db-seed_fu <<: *db-seed_fu
<<: *use-mysql <<: *use-mysql
variables:
<<: *db-seed_fu-variables
GITLAB_DATABASE: "mysql"
rake gitlab:assets:compile: rake gitlab:assets:compile:
stage: test stage: test
...@@ -444,20 +435,17 @@ bundler:audit: ...@@ -444,20 +435,17 @@ bundler:audit:
- bundle install --without production --jobs $(nproc) $FLAGS --retry=3 - bundle install --without production --jobs $(nproc) $FLAGS --retry=3
- source scripts/prepare_build.sh - source scripts/prepare_build.sh
- bundle exec rake db:migrate - bundle exec rake db:migrate
variables:
GITLAB_DATABASE: $CI_JOB_NAME[1]
SETUP_DB: "false"
pg migration paths: migration pg paths:
<<: *migration-paths <<: *migration-paths
<<: *use-pg <<: *use-pg
variables:
SETUP_DB: "false"
GITLAB_DATABASE: "postgresql"
mysql migration paths: migration mysql paths:
<<: *migration-paths <<: *migration-paths
<<: *use-mysql <<: *use-mysql
variables:
SETUP_DB: "false"
GITLAB_DATABASE: "mysql"
coverage: coverage:
stage: post-test stage: post-test
......
...@@ -6,6 +6,10 @@ export SETUP_DB=${SETUP_DB:-true} ...@@ -6,6 +6,10 @@ export SETUP_DB=${SETUP_DB:-true}
export GITLAB_DATABASE=${GITLAB_DATABASE:-postgresql} export GITLAB_DATABASE=${GITLAB_DATABASE:-postgresql}
export USE_BUNDLE_INSTALL=${USE_BUNDLE_INSTALL:-true} export USE_BUNDLE_INSTALL=${USE_BUNDLE_INSTALL:-true}
if [ "$GITLAB_DATABASE" = 'pg' ]; then
export GITLAB_DATABASE='postgresql'
fi
if [ -f /.dockerenv ] || [ -f ./dockerinit ]; then if [ -f /.dockerenv ] || [ -f ./dockerinit ]; then
cp config/database.yml.$GITLAB_DATABASE config/database.yml cp config/database.yml.$GITLAB_DATABASE config/database.yml
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment