2016-11-18 06:52:18 -05:00
|
|
|
#!/bin/sh
|
2016-01-22 12:16:59 -05:00
|
|
|
|
2016-03-09 15:22:25 -05:00
|
|
|
retry() {
|
2016-06-07 07:06:24 -04:00
|
|
|
if eval "$@"; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
for i in 2 1; do
|
|
|
|
sleep 3s
|
|
|
|
echo "Retrying $i..."
|
2016-03-09 15:22:25 -05:00
|
|
|
if eval "$@"; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
2016-04-19 05:57:10 -04:00
|
|
|
if [ -f /.dockerenv ] || [ -f ./dockerinit ]; then
|
2015-06-17 06:23:43 -04:00
|
|
|
cp config/database.yml.mysql config/database.yml
|
|
|
|
sed -i 's/username:.*/username: root/g' config/database.yml
|
|
|
|
sed -i 's/password:.*/password:/g' config/database.yml
|
|
|
|
sed -i 's/# socket:.*/host: mysql/g' config/database.yml
|
|
|
|
|
|
|
|
cp config/resque.yml.example config/resque.yml
|
|
|
|
sed -i 's/localhost/redis/g' config/resque.yml
|
2016-01-22 12:16:59 -05:00
|
|
|
|
2016-11-18 06:52:18 -05:00
|
|
|
export FLAGS="--path vendor --retry 3 --quiet"
|
2015-06-17 06:23:43 -04:00
|
|
|
else
|
2016-11-18 06:52:18 -05:00
|
|
|
rnd=$(awk 'BEGIN { srand() ; printf("%d\n",rand()*5) }')
|
|
|
|
export PATH="$HOME/bin:/usr/local/bin:/usr/bin:/bin"
|
2015-06-17 06:23:43 -04:00
|
|
|
cp config/database.yml.mysql config/database.yml
|
|
|
|
sed "s/username\:.*$/username\: runner/" -i config/database.yml
|
|
|
|
sed "s/password\:.*$/password\: 'password'/" -i config/database.yml
|
2016-11-18 06:52:18 -05:00
|
|
|
sed "s/gitlabhq_test/gitlabhq_test_$rnd/" -i config/database.yml
|
2015-06-17 06:23:43 -04:00
|
|
|
fi
|