diff --git a/docs/config-file.md b/docs/config-file.md index 123989c..eb80afb 100644 --- a/docs/config-file.md +++ b/docs/config-file.md @@ -22,19 +22,36 @@ Any extra parameters will be passed along to GitHub in the `payload` field. This "provider": "heroku", "auto_merge": false, "repository": "MyOrg/my-org-hubot", - "environments": ["production"], - - "heroku_production_name": "my-orgs-hubot" + "environments": [{ + "name": "live", + "production": true + }, { + "name": "production", + "provider_env_name": "my-org-www-production" + }, { + "name": "staging", + "provider_env_name": "my-org-www-staging", + "auto_inactive": false + }, { + "name": "test", + "provider_env_name": "my-org-www-test", + "transient": true + }] }, "dotcom": { "provider": "heroku", "repository": "MyOrg/www", - "environments": ["production","staging"], - "required_contexts": ["ci/janky", "security/brakeman"], - - "heroku_staging_name": "my-org-www-staging", - "heroku_production_name": "my-org-www" + "environments": [{ + "name" : "production", + "provider_env_name": "my-org-www-live" + }, + { + "name" : "staging", + "provider_env_name": "my-org-www-live", + "transient" : true + }], + "required_contexts": ["ci/janky", "security/brakeman"] } } ``` diff --git a/docs/configuration.md b/docs/configuration.md index f5de75b..9a476c4 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -15,6 +15,7 @@ In order to create deployments on GitHub you need to configure a few things. Fal | HUBOT_DEPLOY_WEBHOOK_SECRET | The shared webhook secret to check payload signatures from GitHub. | | HUBOT_DEPLOY_ENCRYPT_PAYLOAD | Encrypt the entire deployment payload in the GitHub API. | | HUBOT_DEPLOY_WEBHOOK_PREFIX | The URL prefix to be used for receiving webhooks. Default: "/hubot-deploy" +| HUBOT_DEPLOY_ADAPTER | The name of the adapter (slack, hipchat) to use. Adapter needs to be located in src/adapters. ### Robot Users diff --git a/index.coffee b/index.coffee index ccfd799..ae5c48b 100644 --- a/index.coffee +++ b/index.coffee @@ -9,3 +9,7 @@ module.exports = (robot, scripts) -> robot.loadFile(Path.resolve(__dirname, "src", "scripts"), "http.coffee") robot.loadFile(Path.resolve(__dirname, "src", "scripts"), "token.coffee") robot.loadFile(Path.resolve(__dirname, "src", "scripts"), "deploy.coffee") + + adapter = process.env.HUBOT_DEPLOY_ADAPTER + if adapter? + robot.loadFile(Path.resolve(__dirname, "src", "adapters"), "#{adapter}.coffee") diff --git a/docs/examples/hipchat.coffee b/src/adapters/hipchat.coffee similarity index 92% rename from docs/examples/hipchat.coffee rename to src/adapters/hipchat.coffee index 498313e..279e60e 100644 --- a/docs/examples/hipchat.coffee +++ b/src/adapters/hipchat.coffee @@ -7,7 +7,8 @@ module.exports = (robot) -> # This is what happens with a '/deploy' request is accepted. # # msg - The hubot message that triggered the deployment. msg.reply and msg.send post back immediately - # deployment - The deployment captured from a chat interaction. You can modify it before it's passed on to the GitHub API. + # deployment - The deployment captured from a chat interaction. + # You can modify it before it's passed on to the GitHub API. robot.on "github_deployment", (msg, deployment) -> # Handle the difference between userIds and roomIds in hipchat user = robot.brain.userForId deployment.user @@ -41,7 +42,8 @@ module.exports = (robot) -> # deployment - The deployed app that matched up with the request. # formatter - A basic formatter for the deployments that should work everywhere even though it looks gross. robot.on "hubot_deploy_available_environments", (msg, deployment) -> - msg.send "#{deployment.name} can be deployed to #{deployment.environments.join(', ')}." + environments = (envName for envName, envValue of deployment.environments) + msg.send "#{deployment.name} can be deployed to #{environments.join(', ')}." # An incoming webhook from GitHub for a deployment. # diff --git a/docs/examples/slack.coffee b/src/adapters/slack.coffee similarity index 91% rename from docs/examples/slack.coffee rename to src/adapters/slack.coffee index 0cebba8..c41d2e3 100644 --- a/docs/examples/slack.coffee +++ b/src/adapters/slack.coffee @@ -7,7 +7,8 @@ module.exports = (robot) -> # This is what happens with a '/deploy' request is accepted. # # msg - The hubot message that triggered the deployment. msg.reply and msg.send post back immediately - # deployment - The deployment captured from a chat interaction. You can modify it before it's passed on to the GitHub API. + # deployment - The deployment captured from a chat interaction. + # You can modify it before it's passed on to the GitHub API. robot.on "github_deployment", (msg, deployment) -> user = robot.brain.userForId deployment.user @@ -35,7 +36,8 @@ module.exports = (robot) -> # deployment - The deployed app that matched up with the request. # formatter - A basic formatter for the deployments that should work everywhere even though it looks gross. robot.on "hubot_deploy_available_environments", (msg, deployment) -> - msg.send "#{deployment.name} can be deployed to #{deployment.environments.join(', ')}." + environments = (envName for envName, envValue of deployment.environments) + msg.send "#{deployment.name} can be deployed to #{environments.join(', ')}." # An incoming webhook from GitHub for a deployment. # diff --git a/src/github/api/deployment.coffee b/src/github/api/deployment.coffee index a0e7b48..122557b 100644 --- a/src/github/api/deployment.coffee +++ b/src/github/api/deployment.coffee @@ -15,9 +15,12 @@ class Deployment @user = 'unknown' @adapter = 'unknown' @userName = 'unknown' - @robotName = 'hubot' - @autoMerge = true - @environments = [ "production" ] + @robotName = 'hubot' + @autoMerge = true + @transientEnvironment = undefined + @productionEnvironment = undefined + @environments = { "production" : {}} + @originalEnvValue = @env @requiredContexts = null @caFile = Fs.readFileSync(process.env['HUBOT_CA_FILE']) if process.env['HUBOT_CA_FILE'] @@ -37,6 +40,8 @@ class Deployment @configureAutoMerge() @configureRequiredContexts() @configureEnvironments() + @configureTransientEnvironment() + @configureProductionEnvironment() @allowedRooms = @application['allowed_rooms'] @@ -44,7 +49,7 @@ class Deployment @application? isValidEnv: -> - @env in @environments + @environments[@originalEnvValue]? isAllowedRoom: (room) -> !@allowedRooms? || room in @allowedRooms @@ -56,6 +61,11 @@ class Deployment if body?.payload?.config? delete(body.payload.config.github_api) delete(body.payload.config.github_token) + unless body?.transient_environment? + delete(body.transient_environment) + unless body?.production_environment? + delete(body.production_environment) + if process.env.HUBOT_DEPLOY_ENCRYPT_PAYLOAD and process.env.HUBOT_DEPLOY_FERNET_SECRETS payload = body.payload fernetSecret = new Fernet.Secret(process.env.HUBOT_DEPLOY_FERNET_SECRETS) @@ -71,6 +81,8 @@ class Deployment force: @force auto_merge: @autoMerge environment: @env + transient_environment: @transientEnvironment + production_environment: @productionEnvironment required_contexts: @requiredContexts description: "#{@task} on #{@env} from hubot-deploy-v#{Version}" payload: @@ -96,6 +108,7 @@ class Deployment api: -> api = Octonode.client(@apiConfig().token, { hostname: @apiConfig().hostname }) api.requestDefaults.agentOptions = { ca: @caFile } if @caFile + api.requestDefaults.headers.Accept = 'application/vnd.github.ant-man-preview+json' api latest: (callback) -> @@ -168,6 +181,7 @@ class Deployment env = @env ref = @ref + @api().post path, @requestBody(), (err, status, body, headers) -> callback(err, status, body, headers) @@ -185,6 +199,14 @@ class Deployment if @force @autoMerge = false + configureTransientEnvironment: -> + if @isValidEnv() and @environments[@originalEnvValue]['transient']? + @transientEnvironment = @environments[@originalEnvValue]['transient'] + + configureProductionEnvironment: -> + if @isValidEnv() and @environments[@originalEnvValue]['production']? + @productionEnvironment = @environments[@originalEnvValue]['production'] + configureRequiredContexts: -> if @application['required_contexts']? @requiredContexts = @application['required_contexts'] diff --git a/src/github/api/deployment_status.coffee b/src/github/api/deployment_status.coffee index afae0bf..0d0d457 100644 --- a/src/github/api/deployment_status.coffee +++ b/src/github/api/deployment_status.coffee @@ -16,8 +16,11 @@ class DeploymentStatus JSON.stringify(data) create: (callback) -> + #accept = "application/vnd.github+json" + accept = "application/vnd.github.ant-man-preview+json" + ScopedClient.create("https://api.github.com"). - header("Accept", "application/vnd.github+json"). + header("Accept", accept). header("User-Agent", "hubot-deploy-v#{Version}"). header("Authorization", "token #{@apiToken}"). path("/repos/#{@repoName}/deployments/#{@number}/statuses"). diff --git a/src/models/formatters.coffee b/src/models/formatters.coffee index 8ceae2b..8b01c1e 100644 --- a/src/models/formatters.coffee +++ b/src/models/formatters.coffee @@ -11,8 +11,9 @@ class WhereFormatter extends Formatter output += Sprintf "%-15s\n", "Environment" output += "-----------------------------------------------------------------\n" - for environment in @deployment.environments - output += "#{environment}\n" + for envName, envValue of @deployment.environments + console.log envName + output += "#{envName}\n" output += "-----------------------------------------------------------------\n" output diff --git a/test/fixtures/deployments.json b/test/fixtures/deployments.json index b92026c..663f5f0 100644 --- a/test/fixtures/deployments.json +++ b/test/fixtures/deployments.json @@ -1,230 +1,200 @@ -[ - { +[{ "url": "https://api.github.com/repos/MyOrg/my-org-hubot/deployments/18731", "id": 18731, "sha": "8efb8c881eae523e41717b2c3dc88703adc46666", "ref": "master", "payload": { - "name": "hubot", - "task": "deploy", - "hosts": "", - "notify": { - "room": "danger", - "user_name": "atmos", - "adapter": "slack" - }, - "config": { - "provider": "heroku", - "repository": "MyOrg/my-org-hubot", - "auto_deploy": [ - "production" - ], - "environments": [ - "production" - ], - "required_contexts": [ - "ci/circleci", - "continuous-integration/travis-ci" - ], - "heroku_production_name": "my-org-hubot", - "heroku_staging_name": "my-org-hubot-staging" - } + "name": "hubot", + "task": "deploy", + "hosts": "", + "notify": { + "room": "danger", + "user_name": "atmos", + "adapter": "slack" + }, + "config": { + "provider": "heroku", + "repository": "MyOrg/my-org-hubot", + "auto_deploy": [ + "production" + ], + "environments": { + "live" : { + "production": true, + "provider_env_name": "my-org-www-live" + }, + "production" : { + "provider_env_name": "my-org-www-prod" + }, + "staging" : { + "provider_env_name": "my-org-www-staging", + "auto_inactive": false + }, + "test" : { + "provider_env_name": "my-org-www-test", + "transient": true + } + }, + "required_contexts": [ + "ci/circleci", + "continuous-integration/travis-ci" + ] + } }, "environment": "production", "description": "deploy on production from hubot-deploy-v0.6.15", "creator": { - "login": "fakeatmos", - "id": 704696, - "avatar_url": "https://avatars.githubusercontent.com/u/704696?", - "gravatar_id": "7310f196129141a0517f1fe8f0689472", - "url": "https://api.github.com/users/fakeatmos", - "html_url": "https://github.com/fakeatmos", - "followers_url": "https://api.github.com/users/fakeatmos/followers", - "following_url": "https://api.github.com/users/fakeatmos/following{/other_user}", - "gists_url": "https://api.github.com/users/fakeatmos/gists{/gist_id}", - "starred_url": "https://api.github.com/users/fakeatmos/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/fakeatmos/subscriptions", - "organizations_url": "https://api.github.com/users/fakeatmos/orgs", - "repos_url": "https://api.github.com/users/fakeatmos/repos", - "events_url": "https://api.github.com/users/fakeatmos/events{/privacy}", - "received_events_url": "https://api.github.com/users/fakeatmos/received_events", - "type": "User", - "site_admin": false + "login": "fakeatmos", + "id": 704696, + "avatar_url": "https://avatars.githubusercontent.com/u/704696?", + "gravatar_id": "7310f196129141a0517f1fe8f0689472", + "url": "https://api.github.com/users/fakeatmos", + "html_url": "https://github.com/fakeatmos", + "followers_url": "https://api.github.com/users/fakeatmos/followers", + "following_url": "https://api.github.com/users/fakeatmos/following{/other_user}", + "gists_url": "https://api.github.com/users/fakeatmos/gists{/gist_id}", + "starred_url": "https://api.github.com/users/fakeatmos/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/fakeatmos/subscriptions", + "organizations_url": "https://api.github.com/users/fakeatmos/orgs", + "repos_url": "https://api.github.com/users/fakeatmos/repos", + "events_url": "https://api.github.com/users/fakeatmos/events{/privacy}", + "received_events_url": "https://api.github.com/users/fakeatmos/received_events", + "type": "User", + "site_admin": false }, "created_at": "2014-06-13T20:55:21Z", "updated_at": "2014-06-13T20:55:21Z", "statuses_url": "https://api.github.com/repos/MyOrg/my-org-hubot/deployments/18731/statuses" - }, - { +}, { "url": "https://api.github.com/repos/MyOrg/my-org-hubot/deployments/18730", "id": 18730, "sha": "8efb8c881eae523e41717b2c3dc88703adc46666", "ref": "8efb8c88", "payload": { - "name": "hubot", - "task": "deploy", - "hosts": "", - "notify": { - "room": "danger", - "user_name": "atmos", - "adapter": "slack" - }, - "config": { - "provider": "heroku", - "repository": "MyOrg/my-org-hubot", - "auto_deploy": [ - "production" - ], - "environments": [ - "production" - ], - "required_contexts": [ - "ci/circleci", - "continuous-integration/travis-ci" - ], - "heroku_production_name": "my-org-hubot", - "heroku_staging_name": "my-org-hubot-staging" - }, - "actor": null, - "sha": "8efb8c88" + "name": "hubot", + "task": "deploy", + "hosts": "", + "notify": { + "room": "danger", + "user_name": "atmos", + "adapter": "slack" + }, + "config": { + "provider": "heroku", + "repository": "MyOrg/my-org-hubot", + "auto_deploy": [ + "production" + ], + "environments": { + "live" : { + "production": true, + "provider_env_name": "my-org-www-live" + }, + "production" : { + "provider_env_name": "my-org-www-prod" + }, + "staging" : { + "provider_env_name": "my-org-www-staging", + "auto_inactive": false + }, + "test" : { + "provider_env_name": "my-org-www-test", + "transient": true + } + } + }, + "actor" : null, + "sha": "8efb8c88" }, "environment": "production", "description": "Heaven auto deploy triggered by a commit status change", "creator": { - "login": "fakeatmos", - "id": 704696, - "avatar_url": "https://avatars.githubusercontent.com/u/704696?", - "gravatar_id": "7310f196129141a0517f1fe8f0689472", - "url": "https://api.github.com/users/fakeatmos", - "html_url": "https://github.com/fakeatmos", - "followers_url": "https://api.github.com/users/fakeatmos/followers", - "following_url": "https://api.github.com/users/fakeatmos/following{/other_user}", - "gists_url": "https://api.github.com/users/fakeatmos/gists{/gist_id}", - "starred_url": "https://api.github.com/users/fakeatmos/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/fakeatmos/subscriptions", - "organizations_url": "https://api.github.com/users/fakeatmos/orgs", - "repos_url": "https://api.github.com/users/fakeatmos/repos", - "events_url": "https://api.github.com/users/fakeatmos/events{/privacy}", - "received_events_url": "https://api.github.com/users/fakeatmos/received_events", - "type": "User", - "site_admin": false + "login": "fakeatmos", + "id": 704696, + "avatar_url": "https://avatars.githubusercontent.com/u/704696?", + "gravatar_id": "7310f196129141a0517f1fe8f0689472", + "url": "https://api.github.com/users/fakeatmos", + "html_url": "https://github.com/fakeatmos", + "followers_url": "https://api.github.com/users/fakeatmos/followers", + "following_url": "https://api.github.com/users/fakeatmos/following{/other_user}", + "gists_url": "https://api.github.com/users/fakeatmos/gists{/gist_id}", + "starred_url": "https://api.github.com/users/fakeatmos/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/fakeatmos/subscriptions", + "organizations_url": "https://api.github.com/users/fakeatmos/orgs", + "repos_url": "https://api.github.com/users/fakeatmos/repos", + "events_url": "https://api.github.com/users/fakeatmos/events{/privacy}", + "received_events_url": "https://api.github.com/users/fakeatmos/received_events", + "type": "User", + "site_admin": false }, "created_at": "2014-06-13T20:52:13Z", "updated_at": "2014-06-13T20:52:13Z", "statuses_url": "https://api.github.com/repos/MyOrg/my-org-hubot/deployments/18730/statuses" - }, - { - "url": "https://api.github.com/repos/MyOrg/my-org-hubot/deployments/17866", - "id": 17866, - "sha": "f3d28e4c5339a6ce73f659650e4d7b371a2d795d", - "ref": "f3d28e4c", - "payload": { - "name": "hubot", - "task": "deploy", - "hosts": "", - "notify": { - "room": "danger", - "user_name": "atmos", - "adapter": "slack" - }, - "config": { - "provider": "heroku", - "repository": "MyOrg/my-org-hubot", - "auto_deploy": [ - "production" - ], - "environments": [ - "production" - ], - "required_contexts": [ - "ci/circleci", - "continuous-integration/travis-ci" - ], - "heroku_production_name": "my-org-hubot", - "heroku_staging_name": "my-org-hubot-staging" - }, - "actor": null, - "sha": "f3d28e4c" - }, - "environment": "production", - "description": "Heaven auto deploy triggered by a commit status change", - "creator": { - "login": "fakeatmos", - "id": 704696, - "avatar_url": "https://avatars.githubusercontent.com/u/704696?", - "gravatar_id": "7310f196129141a0517f1fe8f0689472", - "url": "https://api.github.com/users/fakeatmos", - "html_url": "https://github.com/fakeatmos", - "followers_url": "https://api.github.com/users/fakeatmos/followers", - "following_url": "https://api.github.com/users/fakeatmos/following{/other_user}", - "gists_url": "https://api.github.com/users/fakeatmos/gists{/gist_id}", - "starred_url": "https://api.github.com/users/fakeatmos/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/fakeatmos/subscriptions", - "organizations_url": "https://api.github.com/users/fakeatmos/orgs", - "repos_url": "https://api.github.com/users/fakeatmos/repos", - "events_url": "https://api.github.com/users/fakeatmos/events{/privacy}", - "received_events_url": "https://api.github.com/users/fakeatmos/received_events", - "type": "User", - "site_admin": false - }, - "created_at": "2014-06-11T22:50:24Z", - "updated_at": "2014-06-11T22:50:24Z", - "statuses_url": "https://api.github.com/repos/MyOrg/my-org-hubot/deployments/17866/statuses" - }, - { +}, { "url": "https://api.github.com/repos/MyOrg/my-org-hubot/deployments/17863", "id": 17863, "sha": "ffcabfea4f6de1ccb3353291f5c346178a6d847d", "ref": "master", "payload": { - "name": "hubot", - "task": "deploy", - "hosts": "", - "notify": { - "room": "danger", - "user_name": "atmos", - "adapter": "slack" - }, - "config": { - "provider": "heroku", - "repository": "MyOrg/my-org-hubot", - "auto_deploy": [ - "production" - ], - "environments": [ - "production" - ], - "required_contexts": [ - "ci/circleci", - "continuous-integration/travis-ci" - ], - "heroku_production_name": "my-org-hubot", - "heroku_staging_name": "my-org-hubot-staging" - } + "name": "hubot", + "task": "deploy", + "hosts": "", + "notify": { + "room": "danger", + "user_name": "atmos", + "adapter": "slack" + }, + "config": { + "provider": "heroku", + "repository": "MyOrg/my-org-hubot", + "auto_deploy": [ + "production" + ], + "environments": { + "live" : { + "production": true, + "provider_env_name": "my-org-www-live" + }, + "production" : { + "provider_env_name": "my-org-www-prod" + }, + "staging" : { + "provider_env_name": "my-org-www-staging", + "auto_inactive": false + }, + "test" : { + "provider_env_name": "my-org-www-test", + "transient": true + } + }, + "required_contexts": [ + "ci/circleci", + "continuous-integration/travis-ci" + ] + } }, "environment": "production", "description": "deploy on production from hubot-deploy-v0.6.13", "creator": { - "login": "atmos", - "id": 38, - "avatar_url": "https://avatars.githubusercontent.com/u/38?", - "gravatar_id": "a86224d72ce21cd9f5bee6784d4b06c7", - "url": "https://api.github.com/users/atmos", - "html_url": "https://github.com/atmos", - "followers_url": "https://api.github.com/users/atmos/followers", - "following_url": "https://api.github.com/users/atmos/following{/other_user}", - "gists_url": "https://api.github.com/users/atmos/gists{/gist_id}", - "starred_url": "https://api.github.com/users/atmos/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/atmos/subscriptions", - "organizations_url": "https://api.github.com/users/atmos/orgs", - "repos_url": "https://api.github.com/users/atmos/repos", - "events_url": "https://api.github.com/users/atmos/events{/privacy}", - "received_events_url": "https://api.github.com/users/atmos/received_events", - "type": "User", - "site_admin": true + "login": "atmos", + "id": 38, + "avatar_url": "https://avatars.githubusercontent.com/u/38?", + "gravatar_id": "a86224d72ce21cd9f5bee6784d4b06c7", + "url": "https://api.github.com/users/atmos", + "html_url": "https://github.com/atmos", + "followers_url": "https://api.github.com/users/atmos/followers", + "following_url": "https://api.github.com/users/atmos/following{/other_user}", + "gists_url": "https://api.github.com/users/atmos/gists{/gist_id}", + "starred_url": "https://api.github.com/users/atmos/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/atmos/subscriptions", + "organizations_url": "https://api.github.com/users/atmos/orgs", + "repos_url": "https://api.github.com/users/atmos/repos", + "events_url": "https://api.github.com/users/atmos/events{/privacy}", + "received_events_url": "https://api.github.com/users/atmos/received_events", + "type": "User", + "site_admin": true }, "created_at": "2014-06-11T22:47:34Z", "updated_at": "2014-06-11T22:47:34Z", "statuses_url": "https://api.github.com/repos/MyOrg/my-org-hubot/deployments/17863/statuses" - } -] +}] diff --git a/test/fixtures/deployments/staging.json b/test/fixtures/deployments/staging.json index 998dbfe..7165ef4 100644 --- a/test/fixtures/deployments/staging.json +++ b/test/fixtures/deployments/staging.json @@ -1,162 +1,175 @@ { - "deployment": { - "url": "https://api.github.com/repos/atmos/heaven/deployments/1875476", - "id": 1875476, - "sha": "3c9f42c76ce057eaabc3762e3ec46dd830976963", - "ref": "heroku", - "task": "deploy", - "payload": { - "name": "heaven", - "robotName": "hubot", - "hosts": "", - "notify": { - "room": "ops", - "user": "atmos", - "adapter": "slack", - "message_id": "unknown", - "thread_id": "unknown" - }, - "config": { - "provider": "heroku", - "auto_merge": true, - "repository": "atmos/heaven", - "environments": [ - "staging" - ], - "allowed_rooms": [], - "heroku_staging_name": "zero-fucks-hubot" - } + "deployment": { + "url": "https://api.github.com/repos/atmos/heaven/deployments/1875476", + "id": 1875476, + "sha": "3c9f42c76ce057eaabc3762e3ec46dd830976963", + "ref": "heroku", + "task": "deploy", + "payload": { + "name": "heaven", + "robotName": "hubot", + "hosts": "", + "notify": { + "room": "ops", + "user": "atmos", + "adapter": "slack", + "message_id": "unknown", + "thread_id": "unknown" + }, + "config": { + "provider": "heroku", + "auto_merge": true, + "repository": "atmos/heaven", + "environments": { + "live" : { + "production": true, + "provider_env_name": "my-org-www-live" + }, + "production" : { + "provider_env_name": "my-org-www-prod" + }, + "staging" : { + "provider_env_name": "my-org-www-staging", + "auto_inactive": false + }, + "test" : { + "provider_env_name": "my-org-www-test", + "transient": true + } + }, + "allowed_rooms": [] + } + }, + "environment": "staging", + "description": "Deploying from hubot-deploy-v0.12.5", + "creator": { + "login": "atmos", + "id": 6626297, + "avatar_url": "https://avatars.githubusercontent.com/u/6626297?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/atmos", + "html_url": "https://github.com/atmos", + "followers_url": "https://api.github.com/users/atmos/followers", + "following_url": "https://api.github.com/users/atmos/following{/other_user}", + "gists_url": "https://api.github.com/users/atmos/gists{/gist_id}", + "starred_url": "https://api.github.com/users/atmos/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/atmos/subscriptions", + "organizations_url": "https://api.github.com/users/atmos/orgs", + "repos_url": "https://api.github.com/users/atmos/repos", + "events_url": "https://api.github.com/users/atmos/events{/privacy}", + "received_events_url": "https://api.github.com/users/atmos/received_events", + "type": "User", + "site_admin": false + }, + "created_at": "2015-09-24T03:36:33Z", + "updated_at": "2015-09-24T03:36:33Z", + "statuses_url": "https://api.github.com/repos/atmos/heaven/deployments/1875476/statuses", + "repository_url": "https://api.github.com/repos/atmos/heaven" }, - "environment": "staging", - "description": "Deploying from hubot-deploy-v0.12.5", - "creator": { - "login": "atmos", - "id": 6626297, - "avatar_url": "https://avatars.githubusercontent.com/u/6626297?v=3", - "gravatar_id": "", - "url": "https://api.github.com/users/atmos", - "html_url": "https://github.com/atmos", - "followers_url": "https://api.github.com/users/atmos/followers", - "following_url": "https://api.github.com/users/atmos/following{/other_user}", - "gists_url": "https://api.github.com/users/atmos/gists{/gist_id}", - "starred_url": "https://api.github.com/users/atmos/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/atmos/subscriptions", - "organizations_url": "https://api.github.com/users/atmos/orgs", - "repos_url": "https://api.github.com/users/atmos/repos", - "events_url": "https://api.github.com/users/atmos/events{/privacy}", - "received_events_url": "https://api.github.com/users/atmos/received_events", - "type": "User", - "site_admin": false + "repository": { + "id": 42524818, + "name": "heaven", + "full_name": "atmos/heaven", + "owner": { + "login": "atmos", + "id": 6626297, + "avatar_url": "https://avatars.githubusercontent.com/u/6626297?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/atmos", + "html_url": "https://github.com/atmos", + "followers_url": "https://api.github.com/users/atmos/followers", + "following_url": "https://api.github.com/users/atmos/following{/other_user}", + "gists_url": "https://api.github.com/users/atmos/gists{/gist_id}", + "starred_url": "https://api.github.com/users/atmos/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/atmos/subscriptions", + "organizations_url": "https://api.github.com/users/atmos/orgs", + "repos_url": "https://api.github.com/users/atmos/repos", + "events_url": "https://api.github.com/users/atmos/events{/privacy}", + "received_events_url": "https://api.github.com/users/atmos/received_events", + "type": "User", + "site_admin": false + }, + "private": true, + "html_url": "https://github.com/atmos/heaven", + "description": "SlackHQ hubot for atmos", + "fork": false, + "url": "https://api.github.com/repos/atmos/heaven", + "forks_url": "https://api.github.com/repos/atmos/heaven/forks", + "keys_url": "https://api.github.com/repos/atmos/heaven/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/atmos/heaven/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/atmos/heaven/teams", + "hooks_url": "https://api.github.com/repos/atmos/heaven/hooks", + "issue_events_url": "https://api.github.com/repos/atmos/heaven/issues/events{/number}", + "events_url": "https://api.github.com/repos/atmos/heaven/events", + "assignees_url": "https://api.github.com/repos/atmos/heaven/assignees{/user}", + "branches_url": "https://api.github.com/repos/atmos/heaven/branches{/branch}", + "tags_url": "https://api.github.com/repos/atmos/heaven/tags", + "blobs_url": "https://api.github.com/repos/atmos/heaven/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/atmos/heaven/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/atmos/heaven/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/atmos/heaven/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/atmos/heaven/statuses/{sha}", + "languages_url": "https://api.github.com/repos/atmos/heaven/languages", + "stargazers_url": "https://api.github.com/repos/atmos/heaven/stargazers", + "contributors_url": "https://api.github.com/repos/atmos/heaven/contributors", + "subscribers_url": "https://api.github.com/repos/atmos/heaven/subscribers", + "subscription_url": "https://api.github.com/repos/atmos/heaven/subscription", + "commits_url": "https://api.github.com/repos/atmos/heaven/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/atmos/heaven/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/atmos/heaven/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/atmos/heaven/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/atmos/heaven/contents/{+path}", + "compare_url": "https://api.github.com/repos/atmos/heaven/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/atmos/heaven/merges", + "archive_url": "https://api.github.com/repos/atmos/heaven/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/atmos/heaven/downloads", + "issues_url": "https://api.github.com/repos/atmos/heaven/issues{/number}", + "pulls_url": "https://api.github.com/repos/atmos/heaven/pulls{/number}", + "milestones_url": "https://api.github.com/repos/atmos/heaven/milestones{/number}", + "notifications_url": "https://api.github.com/repos/atmos/heaven/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/atmos/heaven/labels{/name}", + "releases_url": "https://api.github.com/repos/atmos/heaven/releases{/id}", + "created_at": "2015-09-15T14:32:13Z", + "updated_at": "2015-09-15T15:28:11Z", + "pushed_at": "2015-09-24T02:04:35Z", + "git_url": "git://github.com/atmos/heaven.git", + "ssh_url": "git@github.com:atmos/heaven.git", + "clone_url": "https://github.com/atmos/heaven.git", + "svn_url": "https://github.com/atmos/heaven", + "homepage": null, + "size": 4924, + "stargazers_count": 0, + "watchers_count": 0, + "language": "Python", + "has_issues": true, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 1, + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "develop" }, - "created_at": "2015-09-24T03:36:33Z", - "updated_at": "2015-09-24T03:36:33Z", - "statuses_url": "https://api.github.com/repos/atmos/heaven/deployments/1875476/statuses", - "repository_url": "https://api.github.com/repos/atmos/heaven" - }, - "repository": { - "id": 42524818, - "name": "heaven", - "full_name": "atmos/heaven", - "owner": { - "login": "atmos", - "id": 6626297, - "avatar_url": "https://avatars.githubusercontent.com/u/6626297?v=3", - "gravatar_id": "", - "url": "https://api.github.com/users/atmos", - "html_url": "https://github.com/atmos", - "followers_url": "https://api.github.com/users/atmos/followers", - "following_url": "https://api.github.com/users/atmos/following{/other_user}", - "gists_url": "https://api.github.com/users/atmos/gists{/gist_id}", - "starred_url": "https://api.github.com/users/atmos/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/atmos/subscriptions", - "organizations_url": "https://api.github.com/users/atmos/orgs", - "repos_url": "https://api.github.com/users/atmos/repos", - "events_url": "https://api.github.com/users/atmos/events{/privacy}", - "received_events_url": "https://api.github.com/users/atmos/received_events", - "type": "User", - "site_admin": false - }, - "private": true, - "html_url": "https://github.com/atmos/heaven", - "description": "SlackHQ hubot for atmos", - "fork": false, - "url": "https://api.github.com/repos/atmos/heaven", - "forks_url": "https://api.github.com/repos/atmos/heaven/forks", - "keys_url": "https://api.github.com/repos/atmos/heaven/keys{/key_id}", - "collaborators_url": "https://api.github.com/repos/atmos/heaven/collaborators{/collaborator}", - "teams_url": "https://api.github.com/repos/atmos/heaven/teams", - "hooks_url": "https://api.github.com/repos/atmos/heaven/hooks", - "issue_events_url": "https://api.github.com/repos/atmos/heaven/issues/events{/number}", - "events_url": "https://api.github.com/repos/atmos/heaven/events", - "assignees_url": "https://api.github.com/repos/atmos/heaven/assignees{/user}", - "branches_url": "https://api.github.com/repos/atmos/heaven/branches{/branch}", - "tags_url": "https://api.github.com/repos/atmos/heaven/tags", - "blobs_url": "https://api.github.com/repos/atmos/heaven/git/blobs{/sha}", - "git_tags_url": "https://api.github.com/repos/atmos/heaven/git/tags{/sha}", - "git_refs_url": "https://api.github.com/repos/atmos/heaven/git/refs{/sha}", - "trees_url": "https://api.github.com/repos/atmos/heaven/git/trees{/sha}", - "statuses_url": "https://api.github.com/repos/atmos/heaven/statuses/{sha}", - "languages_url": "https://api.github.com/repos/atmos/heaven/languages", - "stargazers_url": "https://api.github.com/repos/atmos/heaven/stargazers", - "contributors_url": "https://api.github.com/repos/atmos/heaven/contributors", - "subscribers_url": "https://api.github.com/repos/atmos/heaven/subscribers", - "subscription_url": "https://api.github.com/repos/atmos/heaven/subscription", - "commits_url": "https://api.github.com/repos/atmos/heaven/commits{/sha}", - "git_commits_url": "https://api.github.com/repos/atmos/heaven/git/commits{/sha}", - "comments_url": "https://api.github.com/repos/atmos/heaven/comments{/number}", - "issue_comment_url": "https://api.github.com/repos/atmos/heaven/issues/comments{/number}", - "contents_url": "https://api.github.com/repos/atmos/heaven/contents/{+path}", - "compare_url": "https://api.github.com/repos/atmos/heaven/compare/{base}...{head}", - "merges_url": "https://api.github.com/repos/atmos/heaven/merges", - "archive_url": "https://api.github.com/repos/atmos/heaven/{archive_format}{/ref}", - "downloads_url": "https://api.github.com/repos/atmos/heaven/downloads", - "issues_url": "https://api.github.com/repos/atmos/heaven/issues{/number}", - "pulls_url": "https://api.github.com/repos/atmos/heaven/pulls{/number}", - "milestones_url": "https://api.github.com/repos/atmos/heaven/milestones{/number}", - "notifications_url": "https://api.github.com/repos/atmos/heaven/notifications{?since,all,participating}", - "labels_url": "https://api.github.com/repos/atmos/heaven/labels{/name}", - "releases_url": "https://api.github.com/repos/atmos/heaven/releases{/id}", - "created_at": "2015-09-15T14:32:13Z", - "updated_at": "2015-09-15T15:28:11Z", - "pushed_at": "2015-09-24T02:04:35Z", - "git_url": "git://github.com/atmos/heaven.git", - "ssh_url": "git@github.com:atmos/heaven.git", - "clone_url": "https://github.com/atmos/heaven.git", - "svn_url": "https://github.com/atmos/heaven", - "homepage": null, - "size": 4924, - "stargazers_count": 0, - "watchers_count": 0, - "language": "Python", - "has_issues": true, - "has_downloads": true, - "has_wiki": false, - "has_pages": false, - "forks_count": 0, - "mirror_url": null, - "open_issues_count": 1, - "forks": 0, - "open_issues": 1, - "watchers": 0, - "default_branch": "develop" - }, - "sender": { - "login": "atmos", - "id": 6626297, - "avatar_url": "https://avatars.githubusercontent.com/u/6626297?v=3", - "gravatar_id": "", - "url": "https://api.github.com/users/atmos", - "html_url": "https://github.com/atmos", - "followers_url": "https://api.github.com/users/atmos/followers", - "following_url": "https://api.github.com/users/atmos/following{/other_user}", - "gists_url": "https://api.github.com/users/atmos/gists{/gist_id}", - "starred_url": "https://api.github.com/users/atmos/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/atmos/subscriptions", - "organizations_url": "https://api.github.com/users/atmos/orgs", - "repos_url": "https://api.github.com/users/atmos/repos", - "events_url": "https://api.github.com/users/atmos/events{/privacy}", - "received_events_url": "https://api.github.com/users/atmos/received_events", - "type": "User", - "site_admin": false - } + "sender": { + "login": "atmos", + "id": 6626297, + "avatar_url": "https://avatars.githubusercontent.com/u/6626297?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/atmos", + "html_url": "https://github.com/atmos", + "followers_url": "https://api.github.com/users/atmos/followers", + "following_url": "https://api.github.com/users/atmos/following{/other_user}", + "gists_url": "https://api.github.com/users/atmos/gists{/gist_id}", + "starred_url": "https://api.github.com/users/atmos/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/atmos/subscriptions", + "organizations_url": "https://api.github.com/users/atmos/orgs", + "repos_url": "https://api.github.com/users/atmos/repos", + "events_url": "https://api.github.com/users/atmos/events{/privacy}", + "received_events_url": "https://api.github.com/users/atmos/received_events", + "type": "User", + "site_admin": false + } } diff --git a/test/test_apps.json b/test/test_apps.json index a685a04..d1388bc 100644 --- a/test/test_apps.json +++ b/test/test_apps.json @@ -2,7 +2,11 @@ "hubot": { "auto_merge": false, "repository": "MyOrg/my-org-hubot", - "environments": ["production"], + "environments": { + "production": { + "provider_env_name": "my-org-www-prod" + } + }, "required_contexts": ["ci/janky", "ci/travis-ci"], "provider": "heroku", @@ -11,21 +15,41 @@ "hubot-deploy": { "repository": "atmos/hubot-deploy", - "environments": ["production", "staging"], + "environments": { + "production": { + "provider_env_name": "my-org-www-prod" + }, + "staging": { + "provider_env_name": "my-org-www-staging", + "auto_inactive": false + } + }, "provider": "npm" }, "github": { "repository": "github/github", - "environments": ["production","staging"], + "environments": { + "production": { + "provider_env_name": "my-org-www-prod" + }, + "staging": { + "provider_env_name": "my-org-www-staging", + "auto_inactive": false + } + }, "provider": "capistrano" }, "restricted-app": { "repository": "acme/example", - "enironments": ["production"], + "enironments": { + "production": { + "provider_env_name": "my-org-www-prod" + } + }, "provider": "capistrano", "allowed_rooms": ["ops"] }