summaryrefslogtreecommitdiff
path: root/scripts/prepare_build.sh
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-03-09 21:22:25 +0100
committerKamil Trzcinski <ayufan@ayufan.eu>2016-03-09 21:22:25 +0100
commit3da55e37d0d3025893fedb4b87bebd0f2b4635f1 (patch)
tree89074aa14a1397b4c1a39595477a117945625e44 /scripts/prepare_build.sh
parentfdfcc1ac0d35026fdc41133ac39b619ac8728d93 (diff)
downloadgitlab-ce-3da55e37d0d3025893fedb4b87bebd0f2b4635f1.tar.gz
Retry bundler and apt-getretry-bundle
Diffstat (limited to 'scripts/prepare_build.sh')
-rwxr-xr-xscripts/prepare_build.sh24
1 files changed, 13 insertions, 11 deletions
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