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 @@ ...@@ -2,13 +2,8 @@
deps_file=/var/lib/gitlab-deps/deps.list deps_file=/var/lib/gitlab-deps/deps.list
rev_deps_file=/var/lib/gitlab-deps/reverse-deps.list rev_deps_file=/var/lib/gitlab-deps/reverse-deps.list
reload=1
ret=0 ret=0
if [ "x$1" = "x--no-reload" ]; then
reload=0
fi
[ -e /etc/default/gitlab-deps ] && . /etc/default/gitlab-deps [ -e /etc/default/gitlab-deps ] && . /etc/default/gitlab-deps
if [ -z "$GITLAB_URL" -o -z "$GITLAB_TOKEN_FILE" ]; then if [ -z "$GITLAB_URL" -o -z "$GITLAB_TOKEN_FILE" ]; then
...@@ -21,19 +16,18 @@ opts="--token-file=$GITLAB_TOKEN_FILE --url=$GITLAB_URL" ...@@ -21,19 +16,18 @@ opts="--token-file=$GITLAB_TOKEN_FILE --url=$GITLAB_URL"
tmp_file="${deps_file}.tmp.$$" tmp_file="${deps_file}.tmp.$$"
trap "rm -f $tmp_file 2>/dev/null" EXIT trap "rm -f $tmp_file 2>/dev/null" EXIT
set -o pipefail
gitlab-deps list-projects $opts \ gitlab-deps list-projects $opts \
| egrep "${PROJECT_REGEXP:-.*}" \ | egrep "${PROJECT_REGEXP:-.*}" \
| gitlab-deps deps $opts \ | gitlab-deps deps $opts \
${GITLAB_REGISTRY_HOSTNAME:+--registry=${GITLAB_REGISTRY_HOSTNAME}} \ ${GITLAB_REGISTRY_HOSTNAME:+--registry=${GITLAB_REGISTRY_HOSTNAME}} \
> $tmp_file > $tmp_file
if [ $? -gt 0 ]; then
rm -f $tmp_file
exit 1
fi
if ! cmp --quiet $tmp_file $deps_file; then
mv -f $tmp_file $deps_file mv -f $tmp_file $deps_file
awk '{print $2, $1}' < $deps_file > $rev_deps_file awk '{print $2, $1}' < $deps_file > $rev_deps_file
if [ $reload -eq 1 ]; then
systemctl reload-or-restart gitlab-deps
ret=$?
fi
fi
exit $ret exit 0
...@@ -5,5 +5,6 @@ After=gitlab-deps.service ...@@ -5,5 +5,6 @@ After=gitlab-deps.service
[Service] [Service]
Type=oneshot Type=oneshot
ExecStart=/usr/sbin/update-gitlab-deps ExecStart=/usr/sbin/update-gitlab-deps
ExecStartPost+=/usr/bin/systemctl restart gitlab-deps.service
User=gitlab-deps User=gitlab-deps
Group=gitlab-deps Group=gitlab-deps
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment