Verified Commit c57f7288 authored by A. Wilcox's avatar A. Wilcox 🦊
Browse files

Fix GitLab pipeline stuff

parent 99f2535e
......@@ -43,6 +43,19 @@ Details are:
issue_open_event = Signal(('issue', 'open'))
issue_comment_event = Signal(('issue', 'comment'))
issue_close_event = Signal(('issue', 'close'))
pipe_event = Signal(('source', 'pipeline'))
"""A pipeline has changed status.
Caller is project name (group if available, otherwise 'default').
Details are:
* Pipeline ID #
* Source branch
* Status
* URL
"""
def register_in(plugin):
......
......@@ -56,7 +56,11 @@ class GitLab:
pipe_info = {}
pipe_info['branch'] = json['object_attributes'].get('ref', 'Unknown')
pipe_info['status'] = json['object_attributes'].get('status')
pipe_info['id'] = json['object_attributes'].get('id')
pipe_info['id'] = str(json['object_attributes'].get('id'))
pipe_info['url'] = json['project'].get('web_url')
if pipe_info['url']:
pipe_info['url'] = pipe_info['url'] + '/pipelines/'
pipe_info['url'] = pipe_info['url'] + pipe_info['id']
project = request.match_info.get('grp', 'default') + '/' + \
request.match_info.get('project')
......
......@@ -6,7 +6,7 @@ from PyIRC.signal import event
from PyIRC.util.version import VERSIONSTR
from emily import config
from emily.core import push_event, merge_event
from emily.core import push_event, merge_event, pipe_event
class IRCNetwork(IRCProtocol):
......@@ -38,7 +38,7 @@ class IRC:
def __init__(self, loop):
push_event.add(self.push)
merge_event.add(self.merge)
pipe_event.add(self.pipe)
pipe_event.add(self.pipe)
myconf = config['irc']
self.networks = [network.strip()
......@@ -135,8 +135,8 @@ class IRC:
channels = set(self.projects[project] +
self.projects[project.split('/', 1)[0] + '/*'] +
self.projects['*/*'])
msg = '\x02{}\x02: Pipeline #{} for branch \x02{}\x02 status: {}'
msg = msg.format(project, pipe['id'], pipe['branch'], pipe['status'])
msg = '\x02{}\x02: Pipeline #{} for branch \x02{}\x02 status: {} - {}'
msg = msg.format(project, pipe['id'], pipe['branch'], pipe['status'], pipe['url'])
for channel in channels:
network, irc_chan = channel.split(':', 1)
......
Supports Markdown
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