From 5b2c3d772501656603092b2a1dccdf344f43e341 Mon Sep 17 00:00:00 2001 From: Gerhard Salvini Date: Tue, 16 Jul 2024 16:06:10 +0200 Subject: [PATCH] Using bridgehead user for performing git pull Otherwise problems can arise with authentication. --- bbmri/modules/ehds2-compose.yml | 4 ++-- bridgehead | 4 +++- lib/functions.sh | 9 ++++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bbmri/modules/ehds2-compose.yml b/bbmri/modules/ehds2-compose.yml index bd717bb..957a7dc 100644 --- a/bbmri/modules/ehds2-compose.yml +++ b/bbmri/modules/ehds2-compose.yml @@ -60,7 +60,7 @@ services: [ ! -f /app/data/lock ] && \ ( \ echo 'Wait for Blaze to finish initializing' ; \ - sleep 300 ; \ + sleep 360 ; \ echo 'Remove old output files' ; \ rm -rf /app/test/* ; \ cd /app ; \ @@ -78,5 +78,5 @@ services: test-data-loader: container_name: 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" diff --git a/bridgehead b/bridgehead index 33303ef..3cb6dc4 100755 --- a/bridgehead +++ b/bridgehead @@ -88,9 +88,11 @@ case "$ACTION" in start) loadVars hc_send log "Bridgehead $PROJECT startup: Checking requirements ..." + chown -R bridgehead ${BASE} checkRequirements # 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 clone_focus_if_nonexistent ${BASE}/.. build_focus ${BASE}/.. diff --git a/lib/functions.sh b/lib/functions.sh index 0126801..ea0d8e4 100644 --- a/lib/functions.sh +++ b/lib/functions.sh @@ -258,7 +258,8 @@ function clone_repo_if_nonexistent() { cd "$target_dir" # Checkout the specified branch - git checkout "$branch_name" + chown -R bridgehead . + su bridgehead -c "git checkout $branch_name" echo "Checked out branch '$branch_name'." cd - @@ -286,8 +287,9 @@ function build_transfair() { # 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 cd $base_dir/transfair - git pull + su bridgehead -c "git pull" docker build --progress=plain -t samply/transfair --no-cache . + chown -R bridgehead . cd - fi } @@ -296,8 +298,9 @@ function build_focus() { local base_dir="$1" cd $base_dir/focus - git pull + su bridgehead -c "git pull" docker build --progress=plain -f DockerfileWithBuild -t samply/focus --no-cache . + chown -R bridgehead . cd - }