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 #!/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 if [ -z "$GITLAB_URL" ]; then
echo "Gitlab-deps is not configured (GITLAB_URL empty)" >&2 echo "Gitlab-deps is not configured (GITLAB_URL empty)" >&2
exit 0 exit 0
fi fi
if [ ! -e $deps_file ]; then if [ ! -e $rev_deps_file ]; then
echo "No deps.json file, executing update..." >&2 echo "No reverse-deps.list file, executing update..." >&2
/usr/sbin/update-gitlab-deps --no-reload /usr/sbin/update-gitlab-deps --no-reload
if [ $? -gt 0 ]; then if [ $? -gt 0 ]; then
echo "update-gitlab-deps failed" >&2 echo "update-gitlab-deps failed" >&2
...@@ -20,4 +20,4 @@ exec /usr/bin/gitlab-deps server \ ...@@ -20,4 +20,4 @@ exec /usr/bin/gitlab-deps server \
--token-file=$GITLAB_TOKEN_FILE --url=$GITLAB_URL \ --token-file=$GITLAB_TOKEN_FILE --url=$GITLAB_URL \
--addr=${ADDR:-0.0.0.0} --port=${PORT:-3535} \ --addr=${ADDR:-0.0.0.0} --port=${PORT:-3535} \
--webhook-auth-token=$WEBHOOK_AUTH_TOKEN \ --webhook-auth-token=$WEBHOOK_AUTH_TOKEN \
< $deps_file < $rev_deps_file
#!/bin/sh #!/bin/sh
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
reload=1 reload=1
ret=0 ret=0
...@@ -25,8 +26,9 @@ gitlab-deps list-projects $opts \ ...@@ -25,8 +26,9 @@ gitlab-deps list-projects $opts \
| gitlab-deps deps $opts \ | gitlab-deps deps $opts \
> $tmp_file > $tmp_file
if ! cmp $tmp_file $deps_file; then 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
if [ $reload -eq 1 ]; then if [ $reload -eq 1 ]; then
systemctl reload-or-restart gitlab-deps systemctl reload-or-restart gitlab-deps
ret=$? 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