From cdcde75bb782951b27ab9db0d54a71db7c94d7cb Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Fri, 11 May 2018 23:06:08 +0800 Subject: [PATCH] Only setup db in the first checkout! --- .gitlab-ci.yml | 3 ++- scripts/prepare_build.sh | 6 +----- scripts/utils.sh | 8 ++++++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b1445feee58..690e26711be 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh index 206d62dbc78..01cb01ed812 100644 --- a/scripts/prepare_build.sh +++ b/scripts/prepare_build.sh @@ -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 diff --git a/scripts/utils.sh b/scripts/utils.sh index 6faa701f0ce..08c33f3f67e 100644 --- a/scripts/utils.sh +++ b/scripts/utils.sh @@ -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 +}