Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 49 lines (41 sloc) 1.833 kb
f1ae7b7 @technicalpickles Update "t" help comments
technicalpickles authored
1 # Description:
2 # Post
3 # This script used in conjunction with tcWebHooks: http://tcplugins.sourceforge.net/info/tcWebHooks makes Hubot to send you build status messages.
4 #
5 # Install web hooks, set this sucker up with Hubot, make sure you have a port configured for him, and set the HUBOT_ROOM_TO_RECEIVE_TEAM_CITY_BUILD_RESULTS
6 # environment variable and Bob's your uncle you'll get build status messages from Hubot in your chat rooms.
7 #
8 # Dependencies:
9 # None
10 #
11 # Configuration:
12 # HUBOT_ROOM_TO_RECEIVE_TEAM_CITY_BUILD_RESULTS
13 #
14 # Commands:
15 # None
16 #
17 # Notes:
52a6790 fix typo
Abraham authored
18 # All the properties available on the build object can be found at the properties list at the top of this file:
f1ae7b7 @technicalpickles Update "t" help comments
technicalpickles authored
19 # http://sourceforge.net/apps/trac/tcplugins/browser/tcWebHooks/trunk/src/main/java/webhook/teamcity/payload/format/WebHookPayloadJsonContent.java
2e1951c @tombell Trim blank line comments, and fix up issues
tombell authored
20 #
21 # Author:
22 # cubanx
cc2a59d @cubanx Adjusting pathing for robot.coffee
cubanx authored
23
a7e9294 @Eibwen Fix TextMessage creation in team-city-listener
Eibwen authored
24 TextMessage = require('hubot').TextMessage
48656c0 @cubanx First cut at team city listener
cubanx authored
25
26 room = process.env.HUBOT_ROOM_TO_RECEIVE_TEAM_CITY_BUILD_RESULTS
27 unless room
28 throw "Need a room to send build status messages to once we receive the web hook call"
29 module.exports = (robot)->
30 robot.router.post "/hubot/build/", (req, res)->
46e6478 @robertfwest Update calls of the user* functions
robertfwest authored
31 user = robot.brain.userForId 'broadcast'
48656c0 @cubanx First cut at team city listener
cubanx authored
32 user.room = room
33 user.type = 'groupchat'
34 build = req.body.build
35
c933d0b @cubanx Changed require line per @tombell suggestion
cubanx authored
36 robot.send user, "#{build.message} and ran on agent:#{build.agentName}"
37
48656c0 @cubanx First cut at team city listener
cubanx authored
38 soundToPlay = 'http://soundfxnow.com/soundfx/Human-Cheer-SmallCrowd01.mp3'
39
40 if build.buildResult == 'failure'
41 failList = ["dog", "cat", "baby"]
42 soundToPlay = 'http://soundfxnow.com/soundfx/Sad-Trombone.mp3'
43 message = 'bing image fail ' + failList[Math.floor(Math.random() * failList.length)]
a7e9294 @Eibwen Fix TextMessage creation in team-city-listener
Eibwen authored
44 robot.receive new TextMessage user, message
48656c0 @cubanx First cut at team city listener
cubanx authored
45
a7e9294 @Eibwen Fix TextMessage creation in team-city-listener
Eibwen authored
46 robot.receive new TextMessage user, "hubot sound #{soundToPlay}"
48656c0 @cubanx First cut at team city listener
cubanx authored
47
48 res.end "that tickles:" + process.env.PORT
Something went wrong with that request. Please try again.