cache tags of submodules, load_env function

This commit is contained in:
chandi 2023-12-06 13:18:58 +01:00
parent 03dcee6dac
commit ce48732004
7 changed files with 76 additions and 20 deletions

13
repos/tags Normal file
View File

@ -0,0 +1,13 @@
# autogenerated by ./scripts/collect-tags
#
# used to determine submodule tags without the need for
# checking out the whole submodule
repos/bbb-etherpad-plugin 068ded5
repos/bbb-etherpad-skin 8328b77
repos/bbb-pads v1.5.1
repos/bbb-playback v5.0.0
repos/bbb-webhooks v2.6.0
repos/bbb-webrtc-sfu v2.11.0
repos/bigbluebutton v2.7.0
repos/freeswitch v1.10.10

View File

@ -4,11 +4,8 @@ set -e
cd $(dirname $0)/.. cd $(dirname $0)/..
# load .env # load .env
if [ -f .env ] . functions.sh
then load_env
# exclude WELCOME_FOOTER because it may contain invalid characters
export $(cat .env | sed 's/#.*//g' | grep -v "WELCOME_FOOTER" | grep -v "WELCOME_MESSAGE" | xargs)
fi
if [ ! "$ENABLE_RECORDING" == true ]; then if [ ! "$ENABLE_RECORDING" == true ]; then
echo "Error: recording is disabled why can't use bbb-record" echo "Error: recording is disabled why can't use bbb-record"

20
scripts/collect-tags Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
set -e
cd "$(dirname "$0")/.."
. scripts/functions.sh
# can't summarize the submodules without having the submodules
ensure_submodules
FILE=repos/tags
echo '# autogenerated by ./scripts/collect-tags' > $FILE
echo '#' >> $FILE
echo '# used to determine submodule tags without the need for' >> $FILE
echo '# checking out the whole submodule' >> $FILE
echo "" >> $FILE
# get list of submodules and their current tag as `git describe` also provides
git submodule foreach --quiet 'echo $sm_path $(git describe --tags --always)' >> $FILE

View File

@ -4,9 +4,7 @@ set -e
cd $(dirname $0)/.. cd $(dirname $0)/..
# load .env # load .env
if [ -f .env ] . functions.sh
then load_env
export $(cat .env | sed 's/#.*//g' | grep "FSESL_PASSWORD" | xargs)
fi
docker compose exec freeswitch /opt/freeswitch/bin/fs_cli -H 10.7.7.1 -p "$FSESL_PASSWORD" docker compose exec freeswitch /opt/freeswitch/bin/fs_cli -H 10.7.7.1 -p "$FSESL_PASSWORD"

28
scripts/functions.sh Normal file
View File

@ -0,0 +1,28 @@
function load_env {
FILE=.env
if [ "$BBB_DOCKER_DEV" = "1" ]; then
FILE=dev.env
else
FILE=.env
fi
if [ -f $FILE ]
then
export $(cat $FILE | sed 's/#.*//g' | grep -v "WELCOME_FOOTER" | grep -v "WELCOME_MESSAGE" | grep -v "CLIENT_TITLE" | xargs)
fi
}
function ensure_submodules {
MISSING_SUBMODULES=$(git submodule status | grep -v ' (' | awk '{print $2}' || /bin/true)
echo
if [ ! -z "$MISSING_SUBMODULES" ]; then
echo "ERROR: following submodules are not checked out. we can't continue here"
git submodule status | grep -v ' (' | awk '{print " -", $2}'
echo ""
echo "if you really want to build images by yourself (not required for a normal production setup), use following command to check out all the submodules and try again"
echo " git submodule update --init"
exit 1
fi
}

View File

@ -4,11 +4,8 @@ set -e
cd $(dirname $0)/.. cd $(dirname $0)/..
# load .env # load .env
if [ -f .env ] . scripts/functions.sh
then load_env
# exclude WELCOME_MESSAGE && WELCOME_FOOTER && CLIENT_TITLE because it may contain invalid characters
export $(cat .env | sed 's/#.*//g' | grep -v "WELCOME_FOOTER" | grep -v "WELCOME_MESSAGE" | grep -v "CLIENT_TITLE" | xargs)
fi
# check for non-optional environment variables, # check for non-optional environment variables,
# which got introduced later and may miss in existing # which got introduced later and may miss in existing
@ -34,7 +31,13 @@ if [ "$ENABLE_COTURN" == true ]; then
fi fi
function get_tag { function get_tag {
# is submodule checked out?
if [ -f "$1/.git" ]; then
git --git-dir=$1/.git describe --tags --always git --git-dir=$1/.git describe --tags --always
else
# get cached tag name from repos/tags
grep "$1" repos/tags | awk '{print $2}'
fi
} }
docker run \ docker run \

View File

@ -4,11 +4,8 @@ set -e
cd "$(dirname "$0")/.." cd "$(dirname "$0")/.."
# load .env # load .env
if [ -f .env ] . functions.sh
then load_env
# exclude WELCOME_MESSAGE && WELCOME_FOOTER && CLIENT_TITLE because it may contain invalid characters
export $(cat .env | sed 's/#.*//g' | grep -v "WELCOME_FOOTER" | grep -v "WELCOME_MESSAGE" | grep -v "CLIENT_TITLE" | xargs)
fi
if [ -z "$ENABLE_WEBHOOKS" ]; then if [ -z "$ENABLE_WEBHOOKS" ]; then
echo "ERROR: ENABLE_WEBHOOKS must be set to true, otherwise the image would not be built" echo "ERROR: ENABLE_WEBHOOKS must be set to true, otherwise the image would not be built"