[med-svn] [Git][med-team/community/helper-scripts][master] Set some hooks
Andreas Tille
gitlab at salsa.debian.org
Sat Oct 27 06:44:46 BST 2018
Andreas Tille pushed to branch master at Debian Med / community / helper-scripts
Commits:
353cf0e2 by Andreas Tille at 2018-10-26T07:35:18Z
Set some hooks
- - - - -
1 changed file:
- inject-into-salsa-git
Changes:
=====================================
inject-into-salsa-git
=====================================
@@ -1,5 +1,7 @@
#!/bin/sh
+# Also, dpt-salsa (in pkg-perl-tools) might be able to do what you want
+
set -eu
SALSARC=~/.ssh/salsarc
@@ -9,6 +11,14 @@ if [ ! -f $SALSARC ] ; then
exit 1
fi
+check_return_code() {
+ if [ $? -ne 0 ]; then
+ echo
+ echo "Something went wrong!"
+ exit 1
+ fi
+}
+
. ${SALSARC}
DEBPKGNAME=`dpkg-parsechangelog | awk '/^Source:/ {print $2}'`
@@ -27,11 +37,41 @@ if [ "$SALSA_GROUP_ID" = "" ] ; then
fi
set -x
-curl "$SALSA_URL/projects?private_token=$SALSA_TOKEN" \
- --data "path=${DEBPKGNAME}&namespace_id=${SALSA_GROUP_ID}&description=${SHORTDESC}&visibility=public"
+RESPONSE=$(curl "$SALSA_URL/projects?private_token=$SALSA_TOKEN" \
+ --data "path=${DEBPKGNAME}&namespace_id=${SALSA_GROUP_ID}&description=${SHORTDESC}&visibility=public")
+
+echo $RESPONSE | jq --exit-status .id > /dev/null
+check_return_code
+
+PROJECT_ID=$(echo $RESPONSE | jq '.id')
set +x
git remote add origin git at salsa.debian.org:${SALSA_GROUP}/${DEBPKGNAME}.git
git push origin master
git push --all --set-upstream
git push --tags
+
+# Stolen from ~/debian-maintain/salsa/java-team/pkg-java-scripts/setup-salsa-repository"
+
+# -----------------------------------------------------------------------------
+
+echo "Configuring the BTS tag pending hook..."
+
+TAGPENDING_URL="https://webhook.salsa.debian.org/tagpending/$DEBPKGNAME"
+curl --silent --output /dev/null -XPOST --header "PRIVATE-TOKEN: $SALSA_TOKEN" $SALSA_URL/projects/$PROJECT_ID/hooks \
+ --data "url=$TAGPENDING_URL&push_events=1&enable_ssl_verification=1"
+check_return_code
+
+if [ "$SALSA_GROUP" = "med-team" ] ; then
+ echo "Configuring the KGB hook for $SALSA_GROUP ..."
+ KGB_URL="http://kgb.debian.net:9418/webhook/?channel=debian-med%26network=oftc%26private=1%26use_color=1%26use_irc_notices=1%26squash_threshold=20"
+ curl --silent --output /dev/null -XPOST --header "PRIVATE-TOKEN: $SALSA_TOKEN" $SALSA_URL/projects/$PROJECT_ID/hooks \
+ --data "url=$KGB_URL&push_events=yes&issues_events=yes&merge_requests_events=yes&tag_push_events=yes¬e_events=yes&job_events=yes&pipeline_events=yes&wiki_events=yes&enable_ssl_verification=yes"
+ check_return_code
+
+ echo "Configuring email notification on push to $SALSA_GROUP commit list ..."
+
+ curl --silent --output /dev/null -XPUT --header "PRIVATE-TOKEN: $SALSA_TOKEN" $SALSA_URL/projects/$PROJECT_ID/services/emails-on-push \
+ --data "recipients=debian-med-commit at lists.alioth.debian.org dispatch at tracker.debian.org"
+ check_return_code
+fi
View it on GitLab: https://salsa.debian.org/med-team/community/helper-scripts/commit/353cf0e276ad506fafad9ba684c24ae7a3c8e2eb
--
View it on GitLab: https://salsa.debian.org/med-team/community/helper-scripts/commit/353cf0e276ad506fafad9ba684c24ae7a3c8e2eb
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20181027/9fe74068/attachment-0001.html>
More information about the debian-med-commit
mailing list