diff --git a/contrib/start-server.sh b/contrib/start-server.sh new file mode 100755 index 0000000000000000000000000000000000000000..c44ce7eccf2941c548b0f3f342e07959fbd43021 --- /dev/null +++ b/contrib/start-server.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +if [ -z "$GITLAB_URL" ]; then + echo "Gitlab-deps is not configured (GITLAB_URL empty)" >&2 + exit 0 +fi + +if [ ! -e /var/lib/gitlab-deps/deps.json ]; then + echo "No deps.json file, executing update..." >&2 + /usr/sbin/update-gitlab-deps + if [ $? -gt 0 ]; then + echo "update-gitlab-deps failed" >&2 + exit 1 + fi +fi + +exec /usr/bin/gitlab-deps server \ + --token-file=$GITLAB_TOKEN_FILE --url=$GITLAB_URL \ + < /var/lib/gitlab-deps/deps.json diff --git a/contrib/update.sh b/contrib/update.sh new file mode 100755 index 0000000000000000000000000000000000000000..a6abffdcdb7779b5ba56dde3e3b7562b829677cf --- /dev/null +++ b/contrib/update.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +[ -e /etc/default/gitlab-deps ] && . /etc/default/gitlab-deps + +if [ -z "$GITLAB_URL" -o -z "$GITLAB_TOKEN_FILE" ]; then + echo "Gitlab-deps is not configured" >&2 + exit 2 +fi + +opts="--token-file=$GITLAB_TOKEN_FILE --url=$GITLAB_URL" + +gitlab-deps list-projects $opts \ + | egrep "${PROJECT_REGEXP:-.*}" \ + | gitlab-deps deps $opts \ + > $deps_file diff --git a/debian/accountserver.service b/debian/accountserver.service new file mode 100644 index 0000000000000000000000000000000000000000..af68e335c7961ec057034eb75ff2ef93551c02dc --- /dev/null +++ b/debian/accountserver.service @@ -0,0 +1,11 @@ +[Unit] +Description=A/I account server +After=slapd.service + +[Service] +EnvironmentFile=-/etc/default/accountserver +ExecStart=/usr/bin/accountserver $DAEMON_OPTS +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000000000000000000000000000000000000..aca065b75111bd501ddf645db31e0132cc5b2cf0 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +gitlab-deps (0.1) unstable; urgency=low + + * First packaged release. + + -- Autistici/Inventati <debian@autistici.org> Sat, 22 Aug 2020 17:21:02 +0100 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +13 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000000000000000000000000000000000000..1a12076a99caa351d06bde34b2ce5a3dbe55dcd9 --- /dev/null +++ b/debian/control @@ -0,0 +1,13 @@ +Source: gitlab-deps +Section: net +Priority: extra +Maintainer: Autistici/Inventati <debian@autistici.org> +Build-Depends: debhelper (>= 11), dh-python, python3, +Standards-Version: 4.1.3 + +Package: gitlab-deps +Architecture: all +Depends: ${python:Depends}, ${misc:Depends} +Description: Gitlab dependencies tool + Build dependency maps between Gitlab projects and + automatically trigger rebuilds on pipeline completion. diff --git a/debian/gitlab-deps.default b/debian/gitlab-deps.default new file mode 100644 index 0000000000000000000000000000000000000000..3b34dd17562640dfa37f01b1f4bf73c9b1d75da4 --- /dev/null +++ b/debian/gitlab-deps.default @@ -0,0 +1,9 @@ +# Set to the public URL of your Gitlab repository. +GITLAB_URL= + +# File with the authorization token. +GITLAB_TOKEN_FILE=/var/lib/gitlab-deps/auth_token + +# Set to a regular expression (extended) if you want to filter the +# project list. +#PROJECT_REGEXP= diff --git a/debian/gitlab-deps.service b/debian/gitlab-deps.service new file mode 100644 index 0000000000000000000000000000000000000000..24a97c1aec5f747dfc525e4e783f0a79195ff800 --- /dev/null +++ b/debian/gitlab-deps.service @@ -0,0 +1,21 @@ +[Unit] +Description=gitlab-deps server +After=network.target + +[Service] +Type=simple +Restart=on-failure +EnvironmentFile=/etc/default/gitlab-deps +ExecStart=/usr/sbin/gitlab-deps-server-wrapper +User=gitlab-deps +Group=gitlab-deps +LimitNOFILE=16384 +NoNewPrivileges=yes +PrivateTmp=yes +PrivateDevices=yes +ProtectHome=yes +ProtectSystem=full +ReadOnlyDirectories=/ + +[Install] +WantedBy=multi-user.target diff --git a/debian/postinst b/debian/postinst new file mode 100755 index 0000000000000000000000000000000000000000..8d4e30b1e6c0c0a8ab79ac33d2ca964a1b32079f --- /dev/null +++ b/debian/postinst @@ -0,0 +1,20 @@ +#!/bin/sh + +set -e + +case "$1" in +configure) + addgroup --system --quiet gitlab-deps + adduser --system --no-create-home --home /var/lib/gitlab-deps \ + --disabled-password --disabled-login \ + --quiet --ingroup gitlab-deps gitlab-deps + + mkdir /var/lib/gitlab-deps + chown gitlab-deps:gitlab-deps /var/lib/gitlab-deps + chmod 0700 /var/lib/gitlab-deps + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000000000000000000000000000000000000..c3f3b535e717826b3679db41bbfb5daf5f732c21 --- /dev/null +++ b/debian/rules @@ -0,0 +1,14 @@ +#!/usr/bin/make -f +# -*- makefile -*- + +export PYBUILD_NAME=gitlab-deps + +%: + dh $@ --with=python3 --buildsystem=pybuild + +override_dh_auto_install: + dh_auto_install + install -o root -g root -m 755 $(CURDIR)/contrib/start-server.sh \ + $(CURDIR)/debian/gitlab-deps/usr/sbin/gitlab-deps-server-wrapper + install -o root -g root -m 755 $(CURDIR)/contrib/update.sh \ + $(CURDIR)/debian/gitlab-deps/usr/sbin/update-gitlab-deps