blob: 49eb41e1801669f2f8ef18e8c87eaad16776ee34 [file] [log] [blame]
Sergiusz Bazanskia7e26cc2019-06-21 20:38:35 +02001#!/bin/bash -e
2
3ls -la /var/gerrit/*
4
5if [ ! -d /var/gerrit/git/All-Projects.git ] || [ "$1" == "init" ]
6then
7 echo "Initializing Gerrit site ..."
8 java -jar /var/gerrit/bin/gerrit.war init --batch --install-all-plugins -d /var/gerrit
9 java -jar /var/gerrit/bin/gerrit.war reindex -d /var/gerrit
10fi
11
12echo "Running hscloud init setup..."
13
14rm -f /var/gerrit/etc/gerrit.config
15cp /var/gerrit-config/gerrit.config /var/gerrit/etc/gerrit.config
16
17rm -f /var/gerrit/etc/secure.config
18cp /var/gerrit-secure/secure.config /var/gerrit/etc/secure.config
19
20cp /var/gerrit-plugins/* /var/gerrit/plugins/
Serge Bazanski7f5f2092023-10-08 14:01:04 +000021mkdir -p /var/gerrit/hooks/
22cp /var/gerrit-hooks/* /var/gerrit/hooks/
Sergiusz Bazanskia7e26cc2019-06-21 20:38:35 +020023
Sergiusz Bazanskia7e26cc2019-06-21 20:38:35 +020024echo "Starting config updater..."
25# Keep copying config over in background. We cannot run directly from
26# the configmap filesystem as gerrit really wants a read-write FS.
27(
28 src=/var/gerrit-config/gerrit.config
29 dst=/var/gerrit/etc/gerrit.config
30 while true; do
31 sleep 60
32 if ! cmp -s $src $dst; then
33 echo "HSCLOUD: bumping config"
34 cp $src $dst
35 fi
36 done
37) &
38
39ls -la /var/gerrit/*
40
41if [ "$1" != "init" ]
42then
43 echo "Running Gerrit ..."
44 exec /var/gerrit/bin/gerrit.sh run
45fi