Commit e174d7fc authored by ale's avatar ale

Generate a reverse dependency file for "gitlab-deps server"

The server needs the reverse dependency graph, make sure the
update-gitlab-deps script generates it as well.
parent 4eb28782
Pipeline #7626 passed with stages
in 22 seconds
#!/bin/sh
deps_file=/var/lib/gitlab-deps/deps.list
rev_deps_file=/var/lib/gitlab-deps/reverse-deps.list
if [ -z "$GITLAB_URL" ]; then
echo "Gitlab-deps is not configured (GITLAB_URL empty)" >&2
exit 0
fi
if [ ! -e $deps_file ]; then
echo "No deps.json file, executing update..." >&2
if [ ! -e $rev_deps_file ]; then
echo "No reverse-deps.list file, executing update..." >&2
/usr/sbin/update-gitlab-deps --no-reload
if [ $? -gt 0 ]; then
echo "update-gitlab-deps failed" >&2
......@@ -20,4 +20,4 @@ exec /usr/bin/gitlab-deps server \
--token-file=$GITLAB_TOKEN_FILE --url=$GITLAB_URL \
--addr=${ADDR:-0.0.0.0} --port=${PORT:-3535} \
--webhook-auth-token=$WEBHOOK_AUTH_TOKEN \
< $deps_file
< $rev_deps_file
#!/bin/sh
deps_file=/var/lib/gitlab-deps/deps.list
rev_deps_file=/var/lib/gitlab-deps/reverse-deps.list
reload=1
ret=0
......@@ -25,8 +26,9 @@ gitlab-deps list-projects $opts \
| gitlab-deps deps $opts \
> $tmp_file
if ! cmp $tmp_file $deps_file; then
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=$?
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment