Using bridgehead user for performing git pull

Otherwise problems can arise with authentication.
This commit is contained in:
Gerhard Salvini 2024-07-16 16:06:10 +02:00
parent a8a15aaad8
commit 5b2c3d7725
3 changed files with 11 additions and 6 deletions

View File

@ -60,7 +60,7 @@ services:
[ ! -f /app/data/lock ] && \ [ ! -f /app/data/lock ] && \
( \ ( \
echo 'Wait for Blaze to finish initializing' ; \ echo 'Wait for Blaze to finish initializing' ; \
sleep 300 ; \ sleep 360 ; \
echo 'Remove old output files' ; \ echo 'Remove old output files' ; \
rm -rf /app/test/* ; \ rm -rf /app/test/* ; \
cd /app ; \ cd /app ; \
@ -78,5 +78,5 @@ services:
test-data-loader: test-data-loader:
container_name: test-data-loader container_name: test-data-loader
image: samply/test-data-loader image: samply/test-data-loader
command: sh -c "sleep 400 && echo Listing all resources in FHIR store && blazectl --server http://bridgehead-bbmri-blaze:8080/fhir count-resources && tail -f /dev/null" command: sh -c "sleep 420 && echo Listing all resources in FHIR store && blazectl --server http://bridgehead-bbmri-blaze:8080/fhir count-resources && tail -f /dev/null"

View File

@ -88,9 +88,11 @@ case "$ACTION" in
start) start)
loadVars loadVars
hc_send log "Bridgehead $PROJECT startup: Checking requirements ..." hc_send log "Bridgehead $PROJECT startup: Checking requirements ..."
chown -R bridgehead ${BASE}
checkRequirements checkRequirements
# Note: changes to "bridgehead" script will only take effect after next start. # Note: changes to "bridgehead" script will only take effect after next start.
git pull su bridgehead -c "git pull"
chown -R bridgehead ${BASE}
# Local versions of focus and transfair are needed by EHDS2 # Local versions of focus and transfair are needed by EHDS2
clone_focus_if_nonexistent ${BASE}/.. clone_focus_if_nonexistent ${BASE}/..
build_focus ${BASE}/.. build_focus ${BASE}/..

View File

@ -258,7 +258,8 @@ function clone_repo_if_nonexistent() {
cd "$target_dir" cd "$target_dir"
# Checkout the specified branch # Checkout the specified branch
git checkout "$branch_name" chown -R bridgehead .
su bridgehead -c "git checkout $branch_name"
echo "Checked out branch '$branch_name'." echo "Checked out branch '$branch_name'."
cd - cd -
@ -286,8 +287,9 @@ function build_transfair() {
# 2. There is no data lock file (which means that no ETL has yet been run). # 2. There is no data lock file (which means that no ETL has yet been run).
if ls ../ecdc/data/*.[cC][sS][vV] 1> /dev/null 2>&1 && [ ! -f ../ecdc/data/lock ]; then if ls ../ecdc/data/*.[cC][sS][vV] 1> /dev/null 2>&1 && [ ! -f ../ecdc/data/lock ]; then
cd $base_dir/transfair cd $base_dir/transfair
git pull su bridgehead -c "git pull"
docker build --progress=plain -t samply/transfair --no-cache . docker build --progress=plain -t samply/transfair --no-cache .
chown -R bridgehead .
cd - cd -
fi fi
} }
@ -296,8 +298,9 @@ function build_focus() {
local base_dir="$1" local base_dir="$1"
cd $base_dir/focus cd $base_dir/focus
git pull su bridgehead -c "git pull"
docker build --progress=plain -f DockerfileWithBuild -t samply/focus --no-cache . docker build --progress=plain -f DockerfileWithBuild -t samply/focus --no-cache .
chown -R bridgehead .
cd - cd -
} }