Skip to content

Commit 60aed9a

Browse files
committed
conf(grep): better git repository refresh
If there's nothing to update, don't do the git reset, which is costly.
1 parent 261a924 commit 60aed9a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

apps/grep/base/deployment.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,13 @@ spec:
5959
[ -f /shared/metacpan_git/.init_complete ] \
6060
&& cd /shared/metacpan_git \
6161
&& while true; do
62-
git fetch origin && git reset --hard origin/master
62+
git fetch origin
63+
if [ "$(git rev-parse HEAD)" != "$(git rev-parse origin/master)" ]; then
64+
git reset --hard origin/master
65+
echo "Reset to origin/master"
66+
else
67+
echo "Already up-to-date with origin/master"
68+
fi
6369
sleep 15m
6470
done
6571
imagePullPolicy: IfNotPresent

0 commit comments

Comments
 (0)