Reputation: 3029
Is it possible to add a message to the merge request discussion? (Something like notification about pipeline failure) I haven't found anything like this in .gitlab-ci.yaml reference, but maybe I just don't look for the right name of the thing.
I have found API to post a new merge request thread, but it doesn't seem be available from the docker container of the job.
Upvotes: 2
Views: 993
Reputation: 3008
It depend on how complex or detailed you want the message to be.
For something as simple as a pipeline failure, you can turn on notifications if that's what you're looking for.
To post a message, you can definitely make use of the API. If your runner/job can reach your instance, you will need to use the full link of your instance with a personal access token at least until pipeline permissions are more flexible.
Another alternative is to use a plugin or add-on. For example, GitLab itself uses danger, which is ruby gem meant to do code review as part of the pipeline.
But you can see in the danger folder of the GitLab repository that it's been extended to do things like post a message to suggest a changelog entry, suggest reviewers, etc.
So that's getting the message to the thread.
For triggering it on failure, there are a couple of different answer over in this other StackOverflow question which I think should help.
Upvotes: 2