prepare_build.sh 1.42 KB
Newer Older
1
. scripts/utils.sh
Kamil Trzciński's avatar
Kamil Trzciński committed
2

3
4
export SETUP_DB=${SETUP_DB:-true}
export USE_BUNDLE_INSTALL=${USE_BUNDLE_INSTALL:-true}
Kamil Trzciński's avatar
Kamil Trzciński committed
5

6
if [ "$USE_BUNDLE_INSTALL" != "false" ]; then
7
  bundle_install_script
8
9
10
fi

cp config/gitlab.yml.example config/gitlab.yml
11
sed -i 's/bin_path: \/usr\/bin\/git/bin_path: \/usr\/local\/bin\/git/' config/gitlab.yml
12

13
14
15
16
17
18
if [ "$DECOMPOSED_DB" == "true" ]; then
  echo "Using decomposed database config (config/database.yml.decomposed-postgresql)"
  cp config/database.yml.decomposed-postgresql config/database.yml
else
  cp config/database.yml.postgresql config/database.yml
fi
19

20
21
22
23
24
# Remove Geo database setting if `ee/` directory does not exist. When it does
# not exist, it runs the GitLab test suite "as if FOSS", meaning the jobs run
# in the context of gitlab-org/gitlab-foss where the Geo is not available.
if [ ! -d "ee/" ] ; then
  sed -i '/geo:/,/^$/d' config/database.yml
25
26
fi

27
28
29
# Set user to a non-superuser to ensure we test permissions
sed -i 's/username: root/username: gitlab/g' config/database.yml

30
31
sed -i 's/localhost/postgres/g' config/database.yml
sed -i 's/username: git/username: postgres/g' config/database.yml
32

33
34
35
cp config/cable.yml.example config/cable.yml
sed -i 's|url:.*$|url: redis://redis:6379|g' config/cable.yml

36
cp config/resque.yml.example config/resque.yml
37
sed -i 's|url:.*$|url: redis://redis:6379|g' config/resque.yml
38

39
if [ "$SETUP_DB" != "false" ]; then
40
  setup_db
41
elif getent hosts postgres; then
42
  setup_db_user_only
43
fi