Skip to content
Snippets Groups Projects
Commit f2730150 authored by ale's avatar ale
Browse files

Always restart the server after the update cron job

Previously the server would not see the updated data due to the update
cron job lacking permissions to restart the server systemd unit.
parent 3ee3aa63
No related branches found
No related tags found
No related merge requests found
Pipeline #59332 passed
......@@ -2,13 +2,8 @@
deps_file=/var/lib/gitlab-deps/deps.list
rev_deps_file=/var/lib/gitlab-deps/reverse-deps.list
reload=1
ret=0
if [ "x$1" = "x--no-reload" ]; then
reload=0
fi
[ -e /etc/default/gitlab-deps ] && . /etc/default/gitlab-deps
if [ -z "$GITLAB_URL" -o -z "$GITLAB_TOKEN_FILE" ]; then
......@@ -21,19 +16,18 @@ opts="--token-file=$GITLAB_TOKEN_FILE --url=$GITLAB_URL"
tmp_file="${deps_file}.tmp.$$"
trap "rm -f $tmp_file 2>/dev/null" EXIT
set -o pipefail
gitlab-deps list-projects $opts \
| egrep "${PROJECT_REGEXP:-.*}" \
| gitlab-deps deps $opts \
${GITLAB_REGISTRY_HOSTNAME:+--registry=${GITLAB_REGISTRY_HOSTNAME}} \
> $tmp_file
if ! cmp --quiet $tmp_file $deps_file; then
mv -f $tmp_file $deps_file
awk '{print $2, $1}' < $deps_file > $rev_deps_file
if [ $reload -eq 1 ]; then
systemctl reload-or-restart gitlab-deps
ret=$?
fi
if [ $? -gt 0 ]; then
rm -f $tmp_file
exit 1
fi
exit $ret
mv -f $tmp_file $deps_file
awk '{print $2, $1}' < $deps_file > $rev_deps_file
exit 0
......@@ -5,5 +5,6 @@ After=gitlab-deps.service
[Service]
Type=oneshot
ExecStart=/usr/sbin/update-gitlab-deps
ExecStartPost+=/usr/bin/systemctl restart gitlab-deps.service
User=gitlab-deps
Group=gitlab-deps
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment