Skip to content

Commit da7bbc5

Browse files
committed
add process.env.ENABLE_NEW_BRANCH_BUILDS_ON_GIT_PUSH to disable
1 parent 815d659 commit da7bbc5

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

configs/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ SLACK_BOT_USERNAME="runnabot"
3939
HIPCHAT_BOT_USERNAME="runnabot"
4040
ENABLE_BUILDS_ON_GIT_PUSH=false
4141
ENABLE_NOTIFICATIONS_ON_GIT_PUSH=false
42+
ENABLE_NEW_BRANCH_BUILDS_ON_GIT_PUSH=false
4243
POLL_MONGO_TIMEOUT="30 minutes"
4344
GITHUB_SCOPE="user:email,repo,repo_deployment,read:repo_hook"
4445
GITHUB_HOOK_SECRET="3V3RYTHINGisAW3S0ME!"

configs/.env.production

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@ CAYLEY="http://cayley.runnable.io"
3030
DOCKER_IMAGE_BUILDER_CACHE="/git-cache"
3131
ENABLE_BUILDS_ON_GIT_PUSH=true
3232
ENABLE_NOTIFICATIONS_ON_GIT_PUSH=true
33+
ENABLE_NEW_BRANCH_BUILDS_ON_GIT_PUSH=false
3334
GITHUB_DEPLOY_KEYS_POOL_SIZE=100

lib/routes/actions/github.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,16 @@ function parseGitHubPushData (req, res, next) {
101101

102102
function newBranch () {
103103
return flow.series(
104+
function (req, res, next) {
105+
// our env parsing cannot parse boolean correctly atm
106+
if (process.env.ENABLE_NEW_BRANCH_BUILDS_ON_GIT_PUSH !== 'true') {
107+
res.status(202);
108+
res.send('New branch builds are disabled for now');
109+
} else {
110+
next();
111+
}
112+
},
113+
104114
// TODO: ask praful again about creating builds for all branches
105115
instances.findContextVersionsForRepo('githubPushInfo.repo'),
106116
mw.req().set('contextVersionIds', 'instances'),

0 commit comments

Comments
 (0)