bugfix persistent idhubs were not updating code

includes refactor of common functionality moved to build__common

related, somehow, to #2
This commit is contained in:
pedro 2024-02-06 14:50:38 +01:00
parent 24739e3983
commit cd796ce262
6 changed files with 28 additions and 52 deletions

View file

@ -26,15 +26,25 @@ common_start() {
fi
)
# some targets might use idhub1 and/or idhub2
idhub="${idhub:-idhub__${target}}"
idhub1="${idhub1:-idhub1__${target}}"
idhub2="${idhub2:-idhub2__${target}}"
# process idhubs instances for the purpose
for idhub in ${idhubs}; do
if [ "${persistence}" = "n" ]; then
# no data persistence: cleanup previous possible data
rm -rf "./${idhub}"
fi
# detect existing deployment
if [ -d "./${idhub}" ]; then
git -C "${idhub}" pull
# looks new
else
echo "Detected new deployment, recreating git repos ${idhub}"
cp -rp IdHub "${idhub}"
# ensure the copy does not contain a DB
rm -f "${idhub}/db.sqlite3"
fi
done
}
common_end() {

View file

@ -13,21 +13,13 @@ main() {
# common_end
. ./build__common.sh
# vars used in common_start and end
target='instance-autotest'
idhub="idhub__${target}"
persistence='n'
idhubs='idhub'
common_start
# detect if is new
if [ ! -f "./${idhub}" ]; then
echo 'Detected new deployment, recreating idhub git repo'
cp -rp IdHub "${idhub}"
rm -f "${idhub}/db.sqlite3"
fi
common_end
}

View file

@ -13,17 +13,12 @@ main() {
# common_end
. ./build__common.sh
# vars used in common_start and end
target='pilot-lafede'
idhubs='idhub'
common_start
# detect if is new
if [ ! -f "./${idhub1}" ]; then
echo 'Detected new deployment, recreating idhub git repo'
cp -rp IdHub "${idhub1}"
rm -f "${idhub1}/db.sqlite3"
fi
common_end
}

View file

@ -13,19 +13,12 @@ main() {
# common_end
. ./build__common.sh
# vars used in common_start and end
target='pilot-pangea'
idhubs='idhub1 idhub2'
common_start
# detect if is new
if [ ! -f "./${idhub1}" ] && [ ! -f "./${idhub2}" ]; then
echo 'Detected new deployment, recreating git repos idhub1 and idhub2'
cp -rp IdHub "${idhub1}"
rm -f "${idhub1}/db.sqlite3"
cp -rp IdHub "${idhub2}"
rm -f "${idhub2}/db.sqlite3"
fi
# common_end builds idhub
# these are extra builds specific for this pilot
make musician_build

View file

@ -13,19 +13,12 @@ main() {
# common_end
. ./build__common.sh
# vars used in common_start and end
target='pilot-setem'
idhubs='idhub1 idhub2'
common_start
# detect if is new
if [ ! -f "./${idhub1}" ] && [ ! -f "./${idhub2}" ]; then
echo 'Detected new deployment, recreating git repos idhub1 and idhub2'
cp -rp IdHub "${idhub1}"
rm -f "${idhub1}/db.sqlite3"
cp -rp IdHub "${idhub2}"
rm -f "${idhub2}/db.sqlite3"
fi
common_end
}

View file

@ -13,19 +13,12 @@ main() {
# common_end
. ./build__common.sh
# vars used in common_start and end
target='pilot-xo9b'
idhubs='idhub1 idhub2'
common_start
# detect if is new
if [ ! -f "./${idhub1}" ] && [ ! -f "./${idhub2}" ]; then
echo 'Detected new deployment, recreating git repos idhub1 and idhub2'
cp -rp IdHub "${idhub1}"
rm -f "${idhub1}/db.sqlite3"
cp -rp IdHub "${idhub2}"
rm -f "${idhub2}/db.sqlite3"
fi
common_end
}