Commit d058285c authored by Pietro Albini's avatar Pietro Albini

Improve messages on GitLab merge requests

parent 37cac7ca
...@@ -149,7 +149,10 @@ class TestsManager: ...@@ -149,7 +149,10 @@ class TestsManager:
# Send an alert on the merge request, if this branch has one # Send an alert on the merge request, if this branch has one
if mr is not None: if mr is not None:
self.gitlab.post_command(mr, "Istanza live aggiornata.") self.gitlab.post_command(mr, "L'[istanza live]"
"(http://wwwtest.ubuntu-it.org/%s/) "
"per il branch **%s** è stata "
"aggiornata." % (branch, branch))
def _process_merge_request_hook(self, data): def _process_merge_request_hook(self, data):
"""Process a merge request hook received from GitLab""" """Process a merge request hook received from GitLab"""
...@@ -158,11 +161,14 @@ class TestsManager: ...@@ -158,11 +161,14 @@ class TestsManager:
# The branch was loaded but the merge request is now closed # The branch was loaded but the merge request is now closed
if branch in self.branches and obj["state"] != "opened": if branch in self.branches and obj["state"] != "opened":
self.gitlab.post_comment(obj["id"], "L'istanza live per il branch "
"**%s** è stata rimossa." % branch)
self.remove_branch(branch) self.remove_branch(branch)
self.gitlab.post_comment(obj["id"], "L'istanza è stata rimossa.")
# The instance should be created # The instance should be created
elif branch not in self.branches and obj["state"] == "opened": elif branch not in self.branches and obj["state"] == "opened":
self.load_branch(branch, obj["id"]) self.load_branch(branch, obj["id"])
self.gitlab.post_comment(obj["id"], "Istanza live disponibile su " self.gitlab.post_comment(obj["id"], "Istanza live per il branch "
"http://wwwtest.ubuntu-it.org/%s." % branch) "**%s** disponibile sul [server di test]"
"(http://wwwtest.ubuntu-it.org/%s/)."
% (branch, branch))
...@@ -55,4 +55,4 @@ class GitLabAPI: ...@@ -55,4 +55,4 @@ class GitLabAPI:
def post_comment(self, id, text): def post_comment(self, id, text):
"""Post a comment on a merge request""" """Post a comment on a merge request"""
return self.call("post", "projects/%s/merge_request/%s/comments" % ( return self.call("post", "projects/%s/merge_request/%s/comments" % (
self.project, id), args={"note": text}) self.project, id), data={"note": text})
Markdown is supported
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