-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathautodeploy.coffee
More file actions
30 lines (22 loc) · 1.03 KB
/
autodeploy.coffee
File metadata and controls
30 lines (22 loc) · 1.03 KB
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
# Enables hubot to autodeploy applications.
module.exports = (robot) ->
robot.hear /.*\/(.*)#.*passed/i, (msg) ->
@exec = require('child_process').exec
application = msg.match[1]
environment = 'RC'
# command = "knife deploy --application #{application} --environment #{environment}"
if application == 'assessment'
command = "knife ssh -x deploy --attribute ipaddress 'tags:assessment AND chef_environment:rc' 'sudo /usr/local/rbenv/shims/chef-client'"
msg.send "Build #{application} passed. Deploying #{application} to #{environment}."
@exec command, (error, stdout, stderr) ->
msg.send error
msg.send stdout
msg.send stderr
robot.hear /.*optimispt\.com\/master.*pushed.*/i, (msg) ->
@exec = require('child_process').exec
# command = "knife deploy --application #{application} --environment #{environment}"
msg.send "Deploying optimispt.com for testing."
@exec command, (error, stdout, stderr) ->
msg.send error
msg.send stdout
msg.send stderr