Skip to content
This repository was archived by the owner on Nov 19, 2025. It is now read-only.

Commit 2da04b3

Browse files
committed
Add links in build events
1 parent dc038b7 commit 2da04b3

5 files changed

Lines changed: 9 additions & 6 deletions

File tree

mattermost_gitlab/event_formatter.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,13 +253,16 @@ def __init__(self, data):
253253
def format(self):
254254

255255
icon = self.icons.get(self.data['build_status'], '')
256-
return '%s%s build %s/%s for the project [%s](%s) on commit %s.' % (
256+
homepage = self.data.get('gitlab_url', self.data.get('repository', {}).get('homepage'))
257+
build_url = '%s/builds/%s' % (homepage, self.data['build_id'])
258+
return '%s%s [build %s/%s](%s) for the project [%s](%s) on commit %s.' % (
257259
(icon + ' ') if icon else '',
258260
self.data['build_status'].title(),
259261
self.data['build_stage'],
260262
self.data['build_name'],
263+
build_url,
261264
self.data['project_name'],
262-
self.data.get('gitlab_url', self.data.get('repository', {}).get('homepage')),
265+
homepage,
263266
self.data['sha'],
264267
)
265268

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Created build test/success for the project [Example User / example repository](http://gitlab.example.com/root/example-repository) on commit 92a9bc78346f6cf9db958eec07a530920ac1bcbd.
1+
Created [build test/success](http://gitlab.example.com/root/example-repository/builds/131) for the project [Example User / example repository](http://gitlab.example.com/root/example-repository) on commit 92a9bc78346f6cf9db958eec07a530920ac1bcbd.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
:x: Failed build test/fail for the project [Example User / example repository](http://gitlab.example.com/root/example-repository) on commit 92a9bc78346f6cf9db958eec07a530920ac1bcbd.
1+
:x: Failed [build test/fail](http://gitlab.example.com/root/example-repository/builds/132) for the project [Example User / example repository](http://gitlab.example.com/root/example-repository) on commit 92a9bc78346f6cf9db958eec07a530920ac1bcbd.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Running build test/success for the project [Example User / example repository](http://gitlab.example.com/root/example-repository) on commit 92a9bc78346f6cf9db958eec07a530920ac1bcbd.
1+
Running [build test/success](http://gitlab.example.com/root/example-repository/builds/131) for the project [Example User / example repository](http://gitlab.example.com/root/example-repository) on commit 92a9bc78346f6cf9db958eec07a530920ac1bcbd.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
:white_check_mark: Success build test/success for the project [Example User / example repository](http://gitlab.example.com/root/example-repository) on commit 92a9bc78346f6cf9db958eec07a530920ac1bcbd.
1+
:white_check_mark: Success [build test/success](http://gitlab.example.com/root/example-repository/builds/131) for the project [Example User / example repository](http://gitlab.example.com/root/example-repository) on commit 92a9bc78346f6cf9db958eec07a530920ac1bcbd.

0 commit comments

Comments
 (0)