@lifeomic/bitrise
Advanced tools
Comparing version 0.2.0 to 0.3.0
{ | ||
"name": "@lifeomic/bitrise", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Bitrise API client", | ||
@@ -23,3 +23,4 @@ "main": "src/client.js", | ||
"dependencies": { | ||
"axios": "^0.18.0" | ||
"axios": "^0.18.0", | ||
"lodash": "^4.17.10" | ||
}, | ||
@@ -31,3 +32,2 @@ "devDependencies": { | ||
"eslint": "^5.0.1", | ||
"lodash": "^4.17.10", | ||
"luxon": "^1.3.1", | ||
@@ -34,0 +34,0 @@ "nyc": "^12.0.2", |
@@ -44,2 +44,4 @@ bitrise | ||
- **disableStatusReporting** — disable sending status reports to SCM. | ||
- **environment** — an object of key value pairs representing environment | ||
variables to provide to the build. | ||
- **pullRequest** — the ID of the pull request being built. | ||
@@ -46,0 +48,0 @@ - **target** — the destination branch of the pull request. |
@@ -7,4 +7,16 @@ const build = require('./build'); | ||
const buildEnvironment = (environment) => { | ||
if (!environment) { | ||
return null; | ||
} | ||
const environments = []; | ||
for (const [ name, value ] of Object.entries(environment)) { | ||
environments.push({ mapped_to: name, value }); | ||
} | ||
return environments; | ||
}; | ||
const buildParameters = ( | ||
{ branch, commitHash, commitMessage, disableStatusReporting, pullRequest, target, workflow } | ||
{ branch, commitHash, commitMessage, disableStatusReporting, environment, pullRequest, target, workflow } | ||
) => pickBy( | ||
@@ -16,2 +28,3 @@ { | ||
commit_message: commitMessage, | ||
environments: buildEnvironment(environment), | ||
pull_request_id: pullRequest, | ||
@@ -18,0 +31,0 @@ skip_git_status_report: disableStatusReporting, |
@@ -188,1 +188,31 @@ const app = require('../src/app'); | ||
}); | ||
test('environment variables can be supplied to a build', async (test) => { | ||
const { app, client, slug } = test.context; | ||
const stub = stubTriggerBuild({ appSlug: slug, axios: client }); | ||
const environment = { | ||
VARIABLE_ONE: uuid(), | ||
VARIABLE_TWO: uuid() | ||
}; | ||
const build = await app.triggerBuild({ environment }); | ||
test.is(build.appSlug, slug); | ||
test.is(build.buildSlug, stub.build.build_slug); | ||
sinon.assert.calledOnce(client.post); | ||
sinon.assert.calledWithExactly( | ||
client.post, | ||
sinon.match.string, | ||
sinon.match({ | ||
build_params: { | ||
environments: [ | ||
{ mapped_to: 'VARIABLE_ONE', value: environment.VARIABLE_ONE }, | ||
{ mapped_to: 'VARIABLE_TWO', value: environment.VARIABLE_TWO } | ||
] | ||
}, | ||
hook_info: { type: 'bitrise' }, | ||
triggered_by: '@lifeomic/bitrise' | ||
}) | ||
); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
183502
8
636
98
2
+ Addedlodash@^4.17.10
+ Addedlodash@4.17.21(transitive)