Skip to content

Commit

Permalink
add buildkite to ci-services
Browse files Browse the repository at this point in the history
  • Loading branch information
jdowning committed Oct 20, 2017
1 parent e4ba1a3 commit a2aaf16
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ci-services/buildkite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use strict'

const gitHelpers = require('../lib/git-helpers')

const env = process.env

module.exports = {
repoSlug: gitHelpers.getRepoSlug(env.BUILDKITE_REPO),
branchName: env.BUILDKITE_BRANCH,
firstPush: gitHelpers.getNumberOfCommitsOnBranch(env.BUILDKITE_BRANCH) === 1,
correctBuild: env.BUILDKITE_PULL_REQUEST === 'false',
uploadBuild: true
}
1 change: 1 addition & 0 deletions ci-services/tests.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const env = process.env

module.exports = {
buildkite: () => env.BUILDKITE === 'true',
circleci: () => env.CIRCLECI === 'true',
jenkins: () => env.JENKINS_URL !== undefined,
travis: () => env.TRAVIS === 'true',
Expand Down
8 changes: 8 additions & 0 deletions lib/git-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,12 @@ module.exports = {
).toString()
)
}

getRepoSlug: function getRepoSlug (githubUrl) {
var ghRegex = /\S+[:|/](\w+(?:[-]\w+)*)\/(\w+(?:[-]\w+)*)/g
var parsed = ghRegex.exec(githubUrl)
return(
`${parsed[1]}/${parsed[2]}`
)
}
}

0 comments on commit a2aaf16

Please sign in to comment.