Skip to content

Commit

Permalink
fix(start-app, start-api): make git handling more robust (DEV-1520) #258
Browse files Browse the repository at this point in the history
  • Loading branch information
jnussbaum committed Nov 23, 2022
1 parent 1507b21 commit 193e093
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions knora/dsplib/utils/start-api.sh
Expand Up @@ -32,13 +32,20 @@ if [[ ! -d dsp-api ]]; then
fi
cd dsp-api
rm -f "$logfile"

echo "make stack-down-delete-volumes..." 2>&1 | tee -a "$logfile"
make stack-down-delete-volumes >>"$logfile" 2>&1

if echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 -w 10 > /dev/null 2>&1; then
# only pull if there is an internet connection
echo "git reset --hard HEAD ..." 2>&1 | tee -a "$logfile"
git reset --hard HEAD >>"$logfile" 2>&1
echo "git checkout main ..." 2>&1 | tee -a "$logfile"
git checkout main >>"$logfile" 2>&1
echo "git pull ..." 2>&1 | tee -a "$logfile"
git pull >>"$logfile" 2>&1
fi

echo "make init-db-test..." 2>&1 | tee -a "$logfile"
make init-db-test >>"$logfile" 2>&1
echo "make stack-up..." 2>&1 | tee -a "$logfile"
Expand Down
5 changes: 4 additions & 1 deletion knora/dsplib/utils/start-app.sh
Expand Up @@ -27,8 +27,11 @@ rm -f "$logfile"

if echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 -w 10 > /dev/null 2>&1; then
# only pull if there is an internet connection
echo "git reset --hard HEAD ..." 2>&1 | tee -a "$logfile"
git reset --hard HEAD >>"$logfile" 2>&1
echo "git checkout main ..." 2>&1 | tee -a "$logfile"
git checkout main >>"$logfile" 2>&1
echo "git pull ..." 2>&1 | tee -a "$logfile"
git checkout HEAD package-lock.json >>"$logfile" 2>&1
git pull >>"$logfile" 2>&1
fi

Expand Down

0 comments on commit 193e093

Please sign in to comment.