chore: print detected provider name for #777 (#3131)

This commit is contained in:
Gleb Bahmutov
2019-01-15 09:58:03 -05:00
committed by GitHub
parent a5a80e6153
commit 11a5a0bbf0
2 changed files with 23 additions and 5 deletions

View File

@@ -407,14 +407,22 @@ const commitDefaults = function (existingInfo) {
debug('git commit existing info')
debug(existingInfo)
const commitParamsObj = commitParams() || {}
const providerName = provider()
debug('detected provider name: %s', providerName)
let commitParamsObj = commitParams()
if (!commitParamsObj) {
debug('could not get commit param object, using empty one')
commitParamsObj = {}
}
debug('commit info from provider environment variables')
debug(commitParamsObj)
debug('%o', commitParamsObj)
//# based on the existingInfo properties
//# merge in the commitParams if null or undefined
//# defaulting back to null if all fails
// based on the existingInfo properties
// merge in the commitParams if null or undefined
// defaulting back to null if all fails
// NOTE: only properties defined in "existingInfo" will be returned
const combined = _.transform(existingInfo, (memo, value, key) => {
return memo[key] = _.defaultTo(value != null ? value : commitParamsObj[key], null)
})

View File

@@ -14,6 +14,7 @@ expectsCommitParams = (params) ->
expect(ciProvider.commitParams(), "CI providers detected commit params").to.deep.eq(params)
expectsCommitDefaults = (existing, expected) ->
expect(expected).to.be.an("object")
expect(ciProvider.commitDefaults(existing), "CI providers default git params").to.deep.eq(expected)
describe "lib/util/ci_provider", ->
@@ -198,6 +199,15 @@ describe "lib/util/ci_provider", ->
defaultBranch: "buildkitePipelineDefaultBranch"
})
# in this test only interested in branch and sha for example
expectsCommitDefaults({
sha: null,
branch: null
}, {
sha: "buildKiteCommit",
branch: "buildKiteBranch"
})
it "circle", ->
resetEnv = mockedEnv({
CIRCLECI: "true"