-
Notifications
You must be signed in to change notification settings - Fork 1
/
strider.coffee
36 lines (30 loc) · 904 Bytes
/
strider.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Description:
# Hubot listener for Strider-CD webhook that parses results and chats to room.
#
# Dependencies:
# None
#
# URLS:
# POST /hubot/strider/:room
#
# Author:
# Matt Johansen (@mattjay)
module.exports = (robot) ->
robot.router.post '/hubot/strider/:room', (req, res) ->
room = req.params.room
data = JSON.parse req.body.payload
message = "Strider Build Finished - #{data.project}:#{data.branch}\n"
if data.test_exitcode is 0
message += "Tests passed!\n"
else
message += "Tests Failed! :(\n"
if data.deploy_exitcode is 0
message += "Deploy succeeded!\n"
else
message += "Didn't Deploy.\n"
message += "Build Details: \n" +
"Finish Time - #{data.finish_time}\n" +
"Repo URL - #{data.repo_url}\n" +
"GitHub Commit ID - #{data.github_commit_id}\n"
robot.messageRoom room, message
res.end 'OK'