hubot-cloud66
Hubot for Cloud66
See src/cloud66.coffee
for full documentation.
Requirements
package | version |
---|---|
coffeescript | >= 1.9 |
Installation
In hubot project repo, run:
npm install hubot-cloud66 --save
Then add hubot-cloud66 to your external-scripts.json
:
Environment Variables
CLOUD66_ACCESS_TOKEN
= Cloud66 personal access token. Go to Cloud66 personal tokens page to generate one.
CLOUD66_DELAY_IN_MS
- Delay in millisecond before start polling Cloud66 for Stack status update after running redeploy
.
CLOUD66_INTERVAL_IN_MS
- Interval in millisecond between polling requests for Cloud66 Stack status update.
CLOUD66_MAX_ATTEMPTS
- Maximum attempts to poll Cloud66 for Stack status update.
CLOUD66_ENABLE_SLACK_CALLBACK
- Enable Slack callback for interactive buttons. You will need to configure your Slack app with callback url.
Commands
Stack Deployment Info
Stack latest deployment info for given environment and stack name.
user1>> hubot cloud66 deployment development backend_apphubot>> Here is the latest deployment commit hash
Stacks List
Display all available stacks.
user1>> hubot cloud66 stackshubot>>frontend_app backend_app user app
Stack Info/Status
Stack current info for given environment and stack name.
user1>> hubot cloud66 stack development backend_apphubot>> development backend_app status: Live 🚀
Stack Redeployment
Redeploy given environment and stack name.
user1>> hubot cloud66 redeploy development backend_apphubot>> Stack queued
Alias
c66
is an alias for cloud66
, so you could also run below
user1>> hubot c66 stack development backend_apphubot>> development backend_app status: Live 🚀
Slack Integration
Message Output
Stack output with Slack callback disabled
Stack output with Slack callback enabled
Enabling Slack Callback
Set CLOUD66_ENABLE_SLACK_CALLBACK
environment variable to true.
Then in your Slack App setup configure your action callback url to point
to hubot-cloud66
endpoint.
If your hubot
already has a router, you can set the action callback url to
your existing endpoint and redirect any post request with Slack callback_id
that starts with cloud66
to /hubot/cloud66
.
Below is an example code of hubot router with /hubot/slack
endpoint that
redirects request to /hubot/cloud66
endpoint.
http = require'http' = robotrouterpost '/hubot/slack' data = if requestbodypayload? then JSONparse requestbodypayload else requestbody if datacallback_idstartsWith 'cloud66' options = host: requestheadershost path: '/hubot/cloud66' method: 'POST' headers: 'Content-Type': 'application/json' 'Content-Length': JSONstringifydatalength req = httprequest options reson 'data' responsesendd reqon 'error' consoleerrorerror reqwrite JSONstringifydata reqend