Update Bamboo variables for CI (#6158)

* bamboo variables and test

* lint fix

* fix it better, reduce indents

* Remove agentId and planKey

Co-authored-by: jsalinas405 <57186891+jsalinas405@users.noreply.github.com>
This commit is contained in:
Jacob Salinas
2020-01-16 11:20:08 -05:00
committed by Jennifer Shehane
parent ef27efcbca
commit 1f1fed2a47
2 changed files with 30 additions and 22 deletions
+14 -10
View File
@@ -30,6 +30,10 @@ const isAzureCi = () => {
return process.env.TF_BUILD && process.env.AZURE_HTTP_USER_AGENT
}
const isBamboo = () => {
return process.env.bamboo_buildNumber
}
const isCodeshipBasic = () => {
return process.env.CI_NAME && (process.env.CI_NAME === 'codeship') && process.env.CODESHIP
}
@@ -78,7 +82,7 @@ const isWercker = () => {
const CI_PROVIDERS = {
'appveyor': 'APPVEYOR',
'azure': isAzureCi,
'bamboo': 'bamboo.buildNumber',
'bamboo': isBamboo,
'bitbucket': 'BITBUCKET_BUILD_NUMBER',
'buildkite': 'BUILDKITE',
'circle': 'CIRCLECI',
@@ -101,9 +105,9 @@ const CI_PROVIDERS = {
const _detectProviderName = () => {
const { env } = process
// return the key of the first provider
// which is truthy
return _.findKey(CI_PROVIDERS, (value) => {
if (_.isString(value)) {
return env[value]
@@ -135,10 +139,10 @@ const _providerCiParams = () => {
'BUILD_REPOSITORY_URI',
]),
bamboo: extract([
'bamboo.resultsUrl',
'bamboo.buildNumber',
'bamboo.buildResultsUrl',
'bamboo.planRepository.repositoryUrl',
'bamboo_buildNumber',
'bamboo_buildResultsUrl',
'bamboo_planRepository_repositoryUrl',
'bamboo_buildKey',
]),
bitbucket: extract([
'BITBUCKET_REPO_SLUG',
@@ -365,12 +369,12 @@ const _providerCommitParams = () => {
authorEmail: env.BUILD_REQUESTEDFOREMAIL,
},
bamboo: {
// sha: ???
branch: env['bamboo.planRepository.branch'],
sha: env.bamboo_planRepository_revision,
branch: env.bamboo_planRepository_branch,
// message: ???
// authorName: ???
authorName: env.bamboo_planRepository_username,
// authorEmail: ???
// remoteOrigin: ???
remoteOrigin: env.bamboo_planRepository_repositoryURL,
// defaultBranch: ???
},
bitbucket: {
@@ -103,24 +103,28 @@ describe "lib/util/ci_provider", ->
it "bamboo", ->
resetEnv = mockedEnv({
"bamboo.buildNumber": "123"
"bamboo.resultsUrl": "bamboo.resultsUrl"
"bamboo.buildResultsUrl": "bamboo.buildResultsUrl"
"bamboo.planRepository.repositoryUrl": "bamboo.planRepository.repositoryUrl"
"bamboo.planRepository.branch": "bamboo.planRepository.branch"
"bamboo_buildNumber": "bambooBuildNumber"
"bamboo_buildResultsUrl": "bambooBuildResultsUrl"
"bamboo_planRepository_repositoryUrl": "bambooPlanRepositoryRepositoryUrl"
"bamboo_buildKey": "bambooBuildKey"
"bamboo_planRepository_revision": "gitSha"
"bamboo_planRepository_branch": "gitBranch"
"bamboo_planRepository_username": "gitAuthor"
"bamboo_planRepository_repositoryURL": "gitRemoteOrigin"
}, {clear: true})
expectsName("bamboo")
expectsCiParams({
bambooResultsUrl: "bamboo.resultsUrl"
bambooBuildNumber: "123"
bambooBuildResultsUrl: "bamboo.buildResultsUrl"
bambooPlanRepositoryRepositoryUrl: "bamboo.planRepository.repositoryUrl"
bambooBuildNumber: "bambooBuildNumber"
bambooBuildResultsUrl: "bambooBuildResultsUrl"
bambooPlanRepositoryRepositoryUrl: "bambooPlanRepositoryRepositoryUrl"
bambooBuildKey: "bambooBuildKey"
})
expectsCommitParams({
branch: "bamboo.planRepository.branch"
sha: "gitSha"
branch: "gitBranch"
authorName: "gitAuthor"
remoteOrigin: "gitRemoteOrigin"
})
it "bitbucket", ->