can run local master config file now with docker

This commit is contained in:
Peter Buchegger 2020-01-16 15:36:23 +01:00
parent ab2b3af1d1
commit 7813ab3860

View File

@ -5,18 +5,21 @@
# we download the config from an arbitrary curl accessible tar.gz file (which github can generate for us) # we download the config from an arbitrary curl accessible tar.gz file (which github can generate for us)
B=`pwd` B=`pwd`
BUILDBOT_CONFIG_DIR=${BUILDBOT_CONFIG_DIR:-config}
if [ -z "$BUILDBOT_CONFIG_URL" ] if [ -z "$BUILDBOT_CONFIG_URL" ]
then then
if [ ! -f "$B/master.cfg" ] if [ ! -f "$B/$BUILDBOT_CONFIG_DIR/master.cfg" ]
then then
echo No master.cfg found nor $$BUILDBOT_CONFIG_URL ! echo No master.cfg found nor $$BUILDBOT_CONFIG_URL !
echo Please provide a master.cfg file in $B or provide a $$BUILDBOT_CONFIG_URL variable via -e echo Please provide a master.cfg file in $B/$BUILDBOT_CONFIG_DIR or provide a $$BUILDBOT_CONFIG_URL variable via -e
exit 1 exit 1
fi fi
fi
else # if config is not downloaded, do it
BUILDBOT_CONFIG_DIR=${BUILDBOT_CONFIG_DIR:-config} if [ -n "$BUILDBOT_CONFIG_URL" ]
then
mkdir -p $B/$BUILDBOT_CONFIG_DIR mkdir -p $B/$BUILDBOT_CONFIG_DIR
# if it ends with .tar.gz then its a tarball, else its directly the file # if it ends with .tar.gz then its a tarball, else its directly the file
if echo "$BUILDBOT_CONFIG_URL" | grep '.tar.gz$' >/dev/null if echo "$BUILDBOT_CONFIG_URL" | grep '.tar.gz$' >/dev/null
@ -26,20 +29,21 @@ else
echo "Can't download from \$BUILDBOT_CONFIG_URL: $BUILDBOT_CONFIG_URL" echo "Can't download from \$BUILDBOT_CONFIG_URL: $BUILDBOT_CONFIG_URL"
sleep 1 sleep 1
done done
ln -sf $B/$BUILDBOT_CONFIG_DIR/master.cfg $B/master.cfg
if [ -f $B/$BUILDBOT_CONFIG_DIR/buildbot.tac ]
then
ln -sf $B/$BUILDBOT_CONFIG_DIR/buildbot.tac $B/buildbot.tac
fi
else else
until curl -sL $BUILDBOT_CONFIG_URL > $B/master.cfg until curl -sL $BUILDBOT_CONFIG_URL > $B/$BUILDBOT_CONFIG_DIR/master.cfg
do do
echo "Can't download from $$BUILDBOT_CONFIG_URL: $BUILDBOT_CONFIG_URL" echo "Can't download from $$BUILDBOT_CONFIG_URL: $BUILDBOT_CONFIG_URL"
done done
fi fi
fi fi
# link downloaded/local files
ln -sf $B/$BUILDBOT_CONFIG_DIR/master.cfg $B/master.cfg
if [ -f $B/$BUILDBOT_CONFIG_DIR/buildbot.tac ]
then
ln -sf $B/$BUILDBOT_CONFIG_DIR/buildbot.tac $B/buildbot.tac
fi
# copy the default buildbot.tac if not provided by the config # copy the default buildbot.tac if not provided by the config
if [ ! -f $B/buildbot.tac ] if [ ! -f $B/buildbot.tac ]
then then