Skip to content

Commit 172d23a

Browse files
committed
Added the conditions to avoid errors when the update-all.sh is run inside of the image, where there is no git.
1 parent b256b45 commit 172d23a

1 file changed

Lines changed: 28 additions & 17 deletions

File tree

scripts/update-all.sh

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,14 @@ done
3232
checkout_to_latest_tag() {
3333
if [ -d $1 ]; then
3434
pushd $1
35-
git fetch --tags
36-
tag=$(git describe --tags `git rev-list --tags --max-count=1`)
37-
git checkout $tag -b $tag
38-
git pull origin $tag
35+
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
36+
git fetch --tags
37+
tag=$(git describe --tags `git rev-list --tags --max-count=1`)
38+
git checkout $tag -b $tag
39+
git pull origin $tag
40+
else
41+
echo "No .git metadata in $1; skipping frontend repository update."
42+
fi
3943
popd
4044
fi
4145
}
@@ -51,11 +55,10 @@ if [[ ! -f "config/autoload/local.php" && $bypass -eq 0 ]]; then
5155
exit 1
5256
fi
5357

54-
git pull
55-
56-
if [ $? != 0 ]; then
57-
echo "A problem occurred while retrieving remote files from repository."
58-
exit 1
58+
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
59+
git pull || { echo "A problem occurred while retrieving remote files from repository."; exit 1; }
60+
else
61+
echo "No .git metadata; skipping git pull."
5962
fi
6063

6164
./scripts/check_composer.sh
@@ -87,21 +90,29 @@ if [[ $bypass -eq 0 ]]; then
8790
migrate_module $pathFO
8891
fi
8992

90-
if [[ -d node_modules && -d node_modules/ng_anr ]]; then
91-
if [[ -d node_modules/ng_anr/.git ]]; then
93+
if [[ -d node_modules/ng_client && -d node_modules/ng_anr ]]; then
94+
if [[ -d node_modules/ng_client/.git && -d node_modules/ng_anr/.git ]]; then
9295
checkout_to_latest_tag node_modules/ng_client
9396
checkout_to_latest_tag node_modules/ng_anr
9497
else
95-
npm update
98+
echo "node_modules/ng_* are not git repos; skipping frontend repository update."
9699
fi
97100
fi
98101

99-
cd node_modules/ng_client
100-
npm ci
101-
cd ../..
102+
if [[ -d node_modules/ng_client ]]; then
103+
cd node_modules/ng_client
104+
npm ci
105+
cd ../..
106+
else
107+
echo "node_modules/ng_client not found; skipping npm ci."
108+
fi
102109

103-
./scripts/link_modules_resources.sh
104-
./scripts/compile_translations.sh
110+
if [[ -d node_modules/ng_client && -d node_modules/ng_anr ]]; then
111+
./scripts/link_modules_resources.sh
112+
./scripts/compile_translations.sh
113+
else
114+
echo "Frontend repositories are missing; skipping resource linking and translation compilation."
115+
fi
105116

106117
if [[ $forceClearCache -eq 1 ]]; then
107118
# Clear Laminas cache

0 commit comments

Comments
 (0)