Skip to content

Instantly share code, notes, and snippets.

@otsuarez
Created March 28, 2014 13:49
Show Gist options
  • Save otsuarez/9833225 to your computer and use it in GitHub Desktop.
Save otsuarez/9833225 to your computer and use it in GitHub Desktop.
pipeline
#### new-package.coffee
```
# Description:
# watch for new artifacts and triggers deployment
#
# Dependencies:
# None
#
# Commands:
# hubot new_artifact_available < artifact > < env >
#
# Author:
# osvaldo
exec = require('child_process').exec;
module.exports = (robot)->
robot.hear /new_artifact: ([\.a-z0-9\-\_]+)(\s+)?(.*)?/i, (msg) ->
artifact = msg.match[1]
env = msg.match[3]
env ?= "prod"
server = "server1"
script="ssh "+server+" /usr/local/bin/ansible/deploy-pkg.sh "+artifact+" "+env
child = exec script, (error,stdout,stderr) ->
console.log("deploying "+artifact+"\n")
msg.send "creating and deploying native packages for "+artifact
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment