Skip to content
Snippets Groups Projects
Commit eaa7b1f9 authored by Georges Racinet's avatar Georges Racinet
Browse files

GitLab hooks: option not to send, controlled by env variable

It can be useful for certain operations launched from
the Rails app itself.
parent 058cd467
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -14,6 +14,9 @@
for ref, (old_gitsha, new_gitsha) in changes.items())
SKIP = object()
class Hook(object):
"""Allow to call a GitLab hook.
......@@ -39,6 +42,9 @@
def environ(self):
base = self.repo.ui.environ
if base.get('HEPTAPOD_SKIP_GITLAB_HOOK', '').strip() == self.name:
return SKIP
gl_id = base.get('HEPTAPOD_USERINFO_ID')
project_id = base.get('HEPTAPOD_PROJECT_ID')
......@@ -77,6 +83,10 @@
self.repo.ui.warn("%s: %s" % (self, msg))
return 1, '', msg
if env is SKIP:
self.repo.ui.note('%s: bailing (explicitely told not to send)')
return 0, '', ''
self.repo.ui.note("%s: sending changes %r" % (self, changes))
pr = subprocess.Popen(
[os.path.join(self.gitlab_shell, 'hooks', self.name)],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment