diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-03-09 14:12:29 +0100 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-03-09 14:22:32 +0100 |
commit | 978703abe287519784b8258296ca71d783f67794 (patch) | |
tree | 27e39cf834680ed95904821311884132be3a89f1 | |
parent | af43401602d637c5b91def323ba3a0bac824b785 (diff) | |
download | gitlab-ce-978703abe287519784b8258296ca71d783f67794.tar.gz |
Retry apt-get installation and bundle install
-rw-r--r-- | .gitlab-ci.yml | 2 | ||||
-rwxr-xr-x | scripts/prepare_build.sh | 26 |
2 files changed, 20 insertions, 8 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f77b5bdc955..ffefeb6dfd8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,7 +23,7 @@ before_script: - cp config/gitlab.yml.example config/gitlab.yml - touch log/application.log - touch log/test.log - - bundle install --without postgres production --jobs $(nproc) "${FLAGS[@]}" + - 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 b6f076a90c3..bce9bce99c3 100755 --- a/scripts/prepare_build.sh +++ b/scripts/prepare_build.sh @@ -2,15 +2,27 @@ if [ -f /.dockerinit ]; then mkdir -p vendor - if [ ! -e vendor/phantomjs_1.9.8-0jessie_amd64.deb ]; then + + # Install phantomjs package + pushd vendor + if [ ! -e phantomjs_1.9.8-0jessie_amd64.deb ]; then wget -q https://gitlab.com/axil/phantomjs-debian/raw/master/phantomjs_1.9.8-0jessie_amd64.deb - mv phantomjs_1.9.8-0jessie_amd64.deb vendor/ fi - dpkg -i vendor/phantomjs_1.9.8-0jessie_amd64.deb + dpkg -i phantomjs_1.9.8-0jessie_amd64.deb + popd + + # Try to install packages + for i in $(seq 1 3); do + apt-get update -yqqq || true - apt-get update -qq - apt-get -o dir::cache::archives="vendor/apt" install -y -qq --force-yes \ - libicu-dev libkrb5-dev cmake nodejs postgresql-client mysql-client unzip + 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..." + fi cp config/database.yml.mysql config/database.yml sed -i 's/username:.*/username: root/g' config/database.yml @@ -20,7 +32,7 @@ if [ -f /.dockerinit ]; then cp config/resque.yml.example config/resque.yml sed -i 's/localhost/redis/g' config/resque.yml - export FLAGS=(--path vendor) + export FLAGS=(--path vendor --retry 3) else export PATH=$HOME/bin:/usr/local/bin:/usr/bin:/bin cp config/database.yml.mysql config/database.yml |