nazrhyn / gitlab-slack Goto Github PK
View Code? Open in Web Editor NEWA service that receives hook notifications from GitLab and posts information to an incoming webhook on Slack.
License: MIT License
A service that receives hook notifications from GitLab and posts information to an incoming webhook on Slack.
License: MIT License
**Currently**
This markdown is being translated into...
โข_Currently_*
...because the bulleted list pass happens before the bold/italic pass. Need to shuffle those to ensure that this is not matched incorrectly.
Do you plan to listen for "Pipeline events"?
One thing I can see being useful is custom notifications on important events, such as master
build failing, etc, where the Slack integration would do an @here
to the channel.
Bug:
When one of our team members approves and MR the slack channel posts a message stating that the team member opend a merge request..:
"Name of team member" opened !1320 "name of merge request"
Users with an email that is a part of another user's email (e.g. [email protected] and [email protected]), a commit from [email protected] will return [email protected] due to gitlab's api results returning both users for the query.
It appears that sometimes it's the full name and sometimes it's the project name. It should always be the project name.
Add label change tracking by keeping track of existing issue label state and monitoring the issues on update events.
GitLab appears to be sending commits out of chronological order, now; so, they need to be manually sorted.
Currently, the message is _num_ new commits by _user_
. It should be changed to something more like _user_ pushed _num_ new commits
to stop implying that the commits are all by that user, when they often aren't.
When unrecognized messages come in, an exception happens in slack.js when it tries to access body.__kind.title
when there is no __kind
property. I forgot to add it in the default case in handlers/index.js.
Hi!
I'm trying to use your project integrating gitlab with Slack, and I've receive a 500 error after trying to make a test webhook inside the Gitlab project /yourproject/hooks.
So, here is the trace I've found in the logfile:
[2016-07-15T11:48:23.218Z](DEBUG) xx.xx.xx.98 POST -- DATA: {"object_kind":"push","event_name":"push","before":"3ebffceb071611684f8143272febfe871ca69736","after":"ca1ef66dbb057f7689922919255b001bb5e3ee1b","ref":"refs/heads/development","checkout_sha":"ca1ef66dbb057f7689922919255b001bb5e3ee1b","message":null,"user_id":392556,................"git_http_url":"https://gitlab.com/xxxxx/ourproject.git","git_ssh_url":"[email protected]:xxxxx/ourproject.git","visibility_level":0}}
[2016-07-15T11:48:23.219Z](DEBUG) xx.xx.xx.98 POST -- PROCESS: Commit
[2016-07-15T11:48:24.184Z](ERROR) xx.xx.xx.98 POST -- GITLAB: -- StatusCodeError: 500 - undefined at new StatusCodeError (/opt/gitlab-slack/node_modules/request-promise/lib/errors.js:26:15)
at Request.RP$callback [as _callback] (/opt/gitlab-slack/node_modules/request-promise/lib/rp.js:68:32)
at Request.self.callback (/opt/gitlab-slack/node_modules/request-promise/node_modules/request/request.js:187:22)
at Request.emit (events.js:98:17)
at Request.<anonymous> (/opt/gitlab-slack/node_modules/request-promise/node_modules/request/request.js:1044:10)
at Request.emit (events.js:95:17)
at IncomingMessage.<anonymous> (/opt/gitlab-slack/node_modules/request-promise/node_modules/request/request.js:965:12)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:944:16
at process._tickCallback (node.js:448:13)
Btw, I've checked that the simple request it has worked properly:
curl -X POST --data-urlencode 'payload={"channel": "#gitlab", "username": "webhookbot", "text": "This is posted to #gitlab and comes from a bot named webhookbot.", "icon_emoji": ":ghost:"}' https://hooks.slack.com/services/xxxxxxx
What we can do?
Best,
When I found the right hammer to write cacheProjectIssues
, caching the issue labels looked like a nail. In the case of cacheIssueLabels
, I know the entire range of issue IDs, so I can just send off all the requests at once using all
and drop them into the right place in the array. Should speed up the initialization process.
When GitLab starts up, the API isn't immediately available, even though the service has started. If label caching is enabled, API connection failures should result in an exponential backoff sequence capped at some amount after which the service should simply fail.
Optionally, status information about the backoff should be posted to the default channel for the Slack webhook so that there's some notification of this happening.
When a new branch is detected, examine the commit list (which is currently being discarded). If there are commits by the same user who pushed the branch that are most-recent and contiguous, preserve those, discard the rest and, in addition to the new branch notification, also push a commit notification with the altered commit list.
Currently, a huge list of commits gets notified for a branch push. We should just notify the contiguous block of commits from the author of the first commit.
Like we do with Issue references (#[0-9]+
) throughout the commit message, also look for Merge Request references (![0-9]+
) and summarize them as links in the summary line.
Group milestones can be assigned to projects within that group. We will need to perform a lookup for milestone information in two possible locations.
The modified webhook still fires when an issue is closed, but at that point, we're expecting that issue to be untracked as far as its labels go. Any label changes will probably fire as adds.
Check, during modify events, to make sure that the issue is actually still open.
Instead of including the group and repo, the links are going to /tree/. Probably some issue with where I'm getting the data from the API, or the API has changed since this was written.
If an issue is mentioned in the commit anywhere after the first line, it won't be sent to Slack. A possible feature could be to detect issue mentions in the entire commit message, and then display them with their own label alongside of the commit for easy access.
Perform a transform on some markdown formatting (at least bold and italic) to the syntax expected by Slack. This would be:
__bold__ / **bold** -> *bold*
_italic_ / *italic* -> _italic_
Possibly pick some more out of the Slack formatting syntax.
Stop futzing with logging and just switch to something like debug or winston. I know, I already was doing this and decided not to, but I can't remember why, at this point...
It's probably going to be winston, even though that one's more complicated, because I don't want to couple the log file name with the linux service definition or write some code to import the log file name from a JSON file into the service definition.
If anyone's reading this and has a better idea, I'm all ears ๐.
The commit summary is just counting up all issue references. It should also apply a distinct to that list so that if an issue is reference for more than one line item, it won't be duplicated in the commit summary notification.
UNCAUGHT EXCEPTION: TypeError: Cannot read property 'statusCode' of undefined
TypeError: Cannot read property 'statusCode' of undefined
at processResponse (/opt/gitlab-slack/server.js:486:61)
at Request._callback (/opt/gitlab-slack/server.js:155:5)
at self.callback (/opt/gitlab-slack/node_modules/request/request.js:373:22)
at Request.EventEmitter.emit (events.js:95:17)
at Request.onRequestError (/opt/gitlab-slack/node_modules/request/request.js:971:8)
at ClientRequest.EventEmitter.emit (events.js:95:17)
at CleartextStream.socketErrorListener (http.js:1547:9)
at CleartextStream.EventEmitter.emit (events.js:95:17)
at Socket.onerror (tls.js:1445:17)
at Socket.EventEmitter.emit (events.js:117:20)
If the milestone is set, display it in the issue notification, somewhere.
This will require the milestone to be set during the creation rather than after it, as we're still ignoring updates in general, unless they qualify for the label change tracking.
The user profile URL lost its /u/
at some point, so I need to fix those format strings.
Currently they're exiting with 0 when initialization fails. The _terminate
function should take an optional exit code.
First (Untracked)
Second (Tracked)
Third (Added, Untracked)
When an issue with an untracked label and a tracked label has a new untracked label added to it, it's erroneously notifying that the tracked label is added. Confirmation of ability to reproduce will be needed; this set of conditions is just being transcribed from the instance where this error was observed.
This string...
No logs are being written to **/logs/openup/openup.log**.
...was translated to italic rather than bold.
I noticed this because of spodlecki/gitlab-slack@a8811a5d. Not sure why I missed this when I was on a crusade against these hard-coded URLs.
Thanks @spodlecki ๐.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.