Skip to content

Commit

Permalink
Add deploy through ChatOps
Browse files Browse the repository at this point in the history
  • Loading branch information
ojacques committed Jan 24, 2017
1 parent 926c1fb commit 3f34bb7
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions vagrant/provision/roles/hubot/files/ninjabot/scripts/deploy.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Description:
# Deploy: deploy latest to test or production
#
# Commands:
# hubot deploy [test|pro] - deploy latest to test or production. Default is test.
#

JENKINS_URL = "http://ci.microservice.io:8080"
module.exports = (robot) ->
robot.respond /deploy (test|pro)/i, (msg) ->
environment = msg.match[1] or "test"

switch environment
when 'test'
msg.send "Deploying latest to **test environment**. See [this link](#{JENKINS_URL}/view/Test%20Deployment/) for status"
robot.http("#{JENKINS_URL}/job/shop-monolitic-test-deployment/build")
.post(null) (err, res, body) ->
if err
res.send "Encountered an error #{err}"
return
robot.http("#{JENKINS_URL}/job/shop-microservice-test-deployment/build")
.post(null) (err, res, body) ->
if err
res.send "Encountered an error #{err}"
return
when 'pro'
msg.send "Deploying latest to **production environment**. See [this link](#{JENKINS_URL}/view/Production%20Deployment/) for status"
robot.http("#{JENKINS_URL}/job/shop-monolitic-production-deployment/build")
.post(null) (err, res, body) ->
if err
res.send "Encountered an error #{err}"
return
robot.http("#{JENKINS_URL}/job/shop-microservice-production-deployment/build")
.post(null) (err, res, body) ->
if err
res.send "Encountered an error #{err}"
return

0 comments on commit 3f34bb7

Please sign in to comment.