Only setup db in the first checkout!

This commit is contained in:
Lin Jen-Shin 2018-05-11 23:06:08 +08:00
parent 73289a8361
commit cdcde75bb7
3 changed files with 11 additions and 6 deletions

View file

@ -234,6 +234,7 @@ stages:
<<: *dedicated-no-docs-and-no-qa-pull-cache-job
variables:
CREATE_DB_USER: "true"
SETUP_DB: "false"
script:
- git fetch https://gitlab.com/gitlab-org/gitlab-ce.git v9.3.0
- git checkout -f FETCH_HEAD
@ -242,7 +243,7 @@ stages:
- cp config/gitlab.yml.example config/gitlab.yml
- bundle exec rake db:drop db:create db:schema:load db:seed_fu
- date
- git checkout $CI_COMMIT_SHA
- git checkout -f $CI_COMMIT_SHA
- bundle install $BUNDLE_INSTALL_FLAGS
- date
- . scripts/prepare_build.sh

View file

@ -60,9 +60,5 @@ if [ "$CREATE_DB_USER" != "false" ]; then
fi
if [ "$SETUP_DB" != "false" ]; then
bundle exec rake db:drop db:create db:schema:load db:migrate
if [ "$GITLAB_DATABASE" = "mysql" ]; then
bundle exec rake add_limits_mysql
fi
setup_db
fi

View file

@ -12,3 +12,11 @@ retry() {
done
return 1
}
setup_db() {
bundle exec rake db:drop db:create db:schema:load db:migrate
if [ "$GITLAB_DATABASE" = "mysql" ]; then
bundle exec rake add_limits_mysql
fi
}