Julien Cristau pushed to branch master at X Strike Force / debian / xsf-tools
Commits:
365634e2 by Julien Cristau at 2018-07-03T16:11:09+02:00
Add a script for kgb/emails-on-push setup
Tries to be idempotent, as far as possible, rather than overwriting
existing setup.
- - - - -
1 changed file:
- + salsa-hooks
Changes:
=====================================
salsa-hooks
=====================================
--- /dev/null
+++ b/salsa-hooks
@@ -0,0 +1,40 @@
+#!/usr/bin/python3
+
+import os
+import sys
+import gitlab
+
+project = sys.argv[1]
+
+api = gitlab.Gitlab('https://salsa.debian.org', os.environ['SALSA_TOKEN'])
+p = api.projects.get(project)
+print('Setting up KGB and emails-on-push for project %s (%s)' % (project,
p.id))
+
+for hook in p.hooks.list():
+ if hook.url.startswith('http://kgb.debian.net'):
+ print('KGB hook %s (%s) already exists, skipping setup' % (hook.id,
hook.url))
+ break
+else:
+ print('added hook',
+ p.hooks.create({
+ 'url':
'http://kgb.debian.net:9418/webhook/?channel=%s&network=oftc&private=1&use_color=1&use_irc_notices=1&squash_threshold=3&always_squash_outside_dir=debian'
% channel,
+ 'push_events': 'yes',
+ 'issues_events': 'yes',
+ 'merge_requests_events': 'yes',
+ 'tag_push_events': 'yes',
+ 'note_events': 'yes',
+ 'job_events': 'yes',
+ 'pipeline_events': 'yes',
+ 'wiki_events': 'yes',
+ 'enable_ssl_verification': 'yes',
+ })
+ )
+
+emailservice = p.services.get('emails-on-push')
+if emailservice.active:
+ print('emails-on-push already enabled, skipping')
+else:
+ emailservice.recipients = '[email protected]'
+ emailservice.send_from_committer_email = True
+ emailservice.save()
+ print('emails-on-push service enabled')
View it on GitLab:
https://salsa.debian.org/xorg-team/debian/xsf-tools/commit/365634e2695384df082b361af11a73b7cff15e5b
--
View it on GitLab:
https://salsa.debian.org/xorg-team/debian/xsf-tools/commit/365634e2695384df082b361af11a73b7cff15e5b
You're receiving this email because of your account on salsa.debian.org.