diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2016-03-09 21:09:12 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2016-03-09 21:09:12 +0000 |
commit | d9042e8b399608fa189ffdb02efa8de30604088d (patch) | |
tree | 1f1f2ed1d83ba6b8c8c8daabbdbebce4206cf216 | |
parent | 8e3485d87899d94cefade8b49203aeb0566c033b (diff) | |
parent | 3da55e37d0d3025893fedb4b87bebd0f2b4635f1 (diff) | |
download | gitlab-ce-d9042e8b399608fa189ffdb02efa8de30604088d.tar.gz |
Merge branch 'retry-bundle' into 'master'
Retry bundler and apt-get
See merge request !3146
-rw-r--r-- | .gitlab-ci.yml | 4 | ||||
-rwxr-xr-x | scripts/prepare_build.sh | 24 |
2 files changed, 15 insertions, 13 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ffefeb6dfd8..d21785f7af2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,11 +19,11 @@ before_script: - source ./scripts/prepare_build.sh - ruby -v - which ruby - - gem install bundler --no-ri --no-rdoc + - retry gem install bundler --no-ri --no-rdoc - cp config/gitlab.yml.example config/gitlab.yml - touch log/application.log - touch log/test.log - - bundle install --without postgres production --jobs $(nproc) "${FLAGS[@]}" + - retry bundle install --without postgres production --jobs $(nproc) "${FLAGS[@]}" - RAILS_ENV=test bundle exec rake db:drop db:create db:schema:load db:migrate stages: diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh index 82de51a9a2e..4a7ee7dbb64 100755 --- a/scripts/prepare_build.sh +++ b/scripts/prepare_build.sh @@ -1,5 +1,16 @@ #!/bin/bash +retry() { + for i in $(seq 1 3); do + if eval "$@"; then + return 0 + fi + sleep 3s + echo "Retrying..." + done + return 1 +} + if [ -f /.dockerinit ]; then mkdir -p vendor @@ -12,17 +23,8 @@ if [ -f /.dockerinit ]; then popd # Try to install packages - for i in $(seq 1 3); do - apt-get update -yqqq || true - - if apt-get -o dir::cache::archives="vendor/apt" install -y -qq --force-yes \ - libicu-dev libkrb5-dev cmake nodejs postgresql-client mysql-client unzip; then - break - fi - - sleep 3s - echo "Retrying package installation..." - done + retry 'apt-get update -yqqq; apt-get -o dir::cache::archives="vendor/apt" install -y -qq --force-yes \ + libicu-dev libkrb5-dev cmake nodejs postgresql-client mysql-client unzip' cp config/database.yml.mysql config/database.yml sed -i 's/username:.*/username: root/g' config/database.yml |