Comparing version 5.0.2 to 5.0.3
60
index.js
@@ -7,36 +7,36 @@ 'use strict'; | ||
const services = { | ||
appveyor: require('./services/appveyor'), | ||
bamboo: require('./services/bamboo'), | ||
bitbucket: require('./services/bitbucket'), | ||
bitrise: require('./services/bitrise'), | ||
buddy: require('./services/buddy'), | ||
buildkite: require('./services/buildkite'), | ||
circleci: require('./services/circleci'), | ||
cirrus: require('./services/cirrus'), | ||
codebuild: require('./services/codebuild'), | ||
codefresh: require('./services/codefresh'), | ||
codeship: require('./services/codeship'), | ||
drone: require('./services/drone'), | ||
github: require('./services/github'), | ||
gitlab: require('./services/gitlab'), | ||
jenkins: require('./services/jenkins'), | ||
puppet: require('./services/puppet'), | ||
sail: require('./services/sail'), | ||
scrutinizer: require('./services/scrutinizer'), | ||
semaphore: require('./services/semaphore'), | ||
shippable: require('./services/shippable'), | ||
teamcity: require('./services/teamcity'), | ||
travis: require('./services/travis'), | ||
vsts: require('./services/vsts'), | ||
wercker: require('./services/wercker'), | ||
appveyor: require('./services/appveyor'), | ||
bamboo: require('./services/bamboo'), | ||
bitbucket: require('./services/bitbucket'), | ||
bitrise: require('./services/bitrise'), | ||
buddy: require('./services/buddy'), | ||
buildkite: require('./services/buildkite'), | ||
circleci: require('./services/circleci'), | ||
cirrus: require('./services/cirrus'), | ||
codebuild: require('./services/codebuild'), | ||
codefresh: require('./services/codefresh'), | ||
codeship: require('./services/codeship'), | ||
drone: require('./services/drone'), | ||
github: require('./services/github'), | ||
gitlab: require('./services/gitlab'), | ||
jenkins: require('./services/jenkins'), | ||
puppet: require('./services/puppet'), | ||
sail: require('./services/sail'), | ||
scrutinizer: require('./services/scrutinizer'), | ||
semaphore: require('./services/semaphore'), | ||
shippable: require('./services/shippable'), | ||
teamcity: require('./services/teamcity'), | ||
travis: require('./services/travis'), | ||
vsts: require('./services/vsts'), | ||
wercker: require('./services/wercker'), | ||
}; | ||
module.exports = ({env = process.env, cwd = process.cwd()} = {}) => { | ||
for (const name of Object.keys(services)) { | ||
if (services[name].detect({env, cwd})) { | ||
return {isCi: true, ...services[name].configuration({env, cwd})}; | ||
} | ||
} | ||
for (const name of Object.keys(services)) { | ||
if (services[name].detect({env, cwd})) { | ||
return {isCi: true, ...services[name].configuration({env, cwd})}; | ||
} | ||
} | ||
return {isCi: Boolean(env.CI), ...git.configuration({env, cwd})}; | ||
return {isCi: Boolean(env.CI), ...git.configuration({env, cwd})}; | ||
}; |
const execa = require('execa'); | ||
function head(options) { | ||
try { | ||
return execa.sync('git', ['rev-parse', 'HEAD'], options).stdout; | ||
} catch (_) { | ||
return undefined; | ||
} | ||
try { | ||
return execa.sync('git', ['rev-parse', 'HEAD'], options).stdout; | ||
} catch (_) { | ||
return undefined; | ||
} | ||
} | ||
function branch(options) { | ||
try { | ||
const headRef = execa.sync('git', ['rev-parse', '--abbrev-ref', 'HEAD'], options).stdout; | ||
try { | ||
const headRef = execa.sync('git', ['rev-parse', '--abbrev-ref', 'HEAD'], options).stdout; | ||
if (headRef === 'HEAD') { | ||
const branch = execa | ||
.sync('git', ['show', '-s', '--pretty=%d', 'HEAD'], options) | ||
.stdout.replace(/^\(|\)$/g, '') | ||
.split(', ') | ||
.find(branch => branch.startsWith('origin/')); | ||
return branch ? branch.match(/^origin\/(?<branch>.+)/)[1] : undefined; | ||
} | ||
if (headRef === 'HEAD') { | ||
const branch = execa | ||
.sync('git', ['show', '-s', '--pretty=%d', 'HEAD'], options) | ||
.stdout.replace(/^\(|\)$/g, '') | ||
.split(', ') | ||
.find(branch => branch.startsWith('origin/')); | ||
return branch ? branch.match(/^origin\/(?<branch>.+)/)[1] : undefined; | ||
} | ||
return headRef; | ||
} catch (_) { | ||
return undefined; | ||
} | ||
return headRef; | ||
} catch (_) { | ||
return undefined; | ||
} | ||
} | ||
module.exports = {head, branch}; |
function prNumber(pr) { | ||
return (/\d+(?!.*\d+)/.exec(pr) || [])[0]; | ||
return (/\d+(?!.*\d+)/.exec(pr) || [])[0]; | ||
} | ||
function parseBranch(branch) { | ||
return branch ? /^(?:refs\/heads\/)?(?<branch>.+)$/i.exec(branch)[1] : undefined; | ||
return branch ? /^(?:refs\/heads\/)?(?<branch>.+)$/i.exec(branch)[1] : undefined; | ||
} | ||
module.exports = {prNumber, parseBranch}; |
{ | ||
"name": "env-ci", | ||
"description": "Get environment variables exposed by CI services", | ||
"version": "5.0.2", | ||
"version": "5.0.3", | ||
"author": "Pierre Vanduynslager (https://github.com/pvdlg)", | ||
@@ -12,3 +12,3 @@ "ava": { | ||
"bugs": { | ||
"url": "https://github.com/pvdlg/github-parser/issues" | ||
"url": "https://github.com/semantic-release/env-ci/issues" | ||
}, | ||
@@ -27,3 +27,3 @@ "dependencies": { | ||
"tempy": "^0.5.0", | ||
"xo": "^0.27.0" | ||
"xo": "^0.28.0" | ||
}, | ||
@@ -38,3 +38,3 @@ "engines": { | ||
], | ||
"homepage": "https://github.com/pvdlg/env-ci#readme", | ||
"homepage": "https://github.com/semantic-release/env-ci#readme", | ||
"keywords": [ | ||
@@ -94,3 +94,3 @@ "appveyor", | ||
"type": "git", | ||
"url": "https://github.com/pvdlg/env-ci.git" | ||
"url": "https://github.com/semantic-release/env-ci.git" | ||
}, | ||
@@ -104,4 +104,8 @@ "scripts": { | ||
"xo": { | ||
"prettier": true | ||
"prettier": true, | ||
"space": true, | ||
"rules": { | ||
"unicorn/string-content": "off" | ||
} | ||
} | ||
} |
@@ -5,5 +5,5 @@ # env-ci | ||
[![Travis](https://img.shields.io/travis/pvdlg/env-ci.svg)](https://travis-ci.org/pvdlg/env-ci) | ||
[![Codecov](https://img.shields.io/codecov/c/github/pvdlg/env-ci.svg)](https://codecov.io/gh/pvdlg/env-ci) | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/pvdlg/env-ci.svg)](https://greenkeeper.io/) | ||
[![Travis](https://img.shields.io/travis/semantic-release/env-ci.svg)](https://travis-ci.org/semantic-release/env-ci) | ||
[![Codecov](https://img.shields.io/codecov/c/github/semantic-release/env-ci.svg)](https://codecov.io/gh/semantic-release/env-ci) | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/semantic-release/env-ci.svg)](https://greenkeeper.io/) | ||
@@ -21,5 +21,6 @@ Adapted from [codecov-node](https://github.com/codecov/codecov-node/blob/master/lib/detect.js). | ||
```js | ||
const envCi = require('env-ci'); | ||
const envCi = require("env-ci"); | ||
const {name, service, isCi, branch, commit, tag, build, buildUrl, job, jobUrl, isPr, pr, prBranch, slug, root} = envCi(); | ||
const { name, service, isCi, branch, commit, tag, build, buildUrl, job, jobUrl, isPr, pr, prBranch, slug, root } = | ||
envCi(); | ||
@@ -35,3 +36,3 @@ if (isCI) { | ||
if (service === 'travis') { | ||
if (service === "travis") { | ||
// Do something specific to Travis CI | ||
@@ -45,3 +46,3 @@ } | ||
| Variable | Description | | ||
|------------|--------------------------------------------------------------------------------------------------------| | ||
| ---------- | ------------------------------------------------------------------------------------------------------ | | ||
| `name` | CI service Commercial name (e.g. `Travis CI`, `CircleCI`, `GitLab CI/CD`) | | ||
@@ -70,3 +71,3 @@ | `service` | Standardized CI service name (e.g. `travis`, `circleci`, `gitlab`) | | ||
| CI Service (`name`) | `service` | `isCi` | `branch` | `commit` | `tag` | `build` | `buildUrl` | `job` | `jobUrl` | `isPr` | `pr` | `prBranch` | `slug` | `root` | | ||
|----------------------------------------------------------------------------------------------------------------------------------------|:-------------:|:------------------:|:---------------------------:|:------------------:|:-----------------------:|:------------------:|:------------------:|:------------------:|:------------------:|:---------------------:|:---------------------:|:---------------------:|:------------------:|:------------------:| | ||
| -------------------------------------------------------------------------------------------------------------------------------------- | :-----------: | :----------------: | :-------------------------: | :----------------: | :---------------------: | :----------------: | :----------------: | :----------------: | :----------------: | :-------------------: | :-------------------: | :-------------------: | :----------------: | :----------------: | | ||
| [AppVeyor](https://www.appveyor.com/docs/environment-variables) | `appveyor` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | ||
@@ -73,0 +74,0 @@ | [Bamboo](https://confluence.atlassian.com/bamboo/bamboo-variables-289277087.html) | `bamboo` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :white_check_mark: | |
// https://www.appveyor.com/docs/environment-variables | ||
module.exports = { | ||
detect({env}) { | ||
return Boolean(env.APPVEYOR); | ||
}, | ||
configuration({env}) { | ||
const pr = env.APPVEYOR_PULL_REQUEST_NUMBER; | ||
const isPr = Boolean(pr); | ||
detect({env}) { | ||
return Boolean(env.APPVEYOR); | ||
}, | ||
configuration({env}) { | ||
const pr = env.APPVEYOR_PULL_REQUEST_NUMBER; | ||
const isPr = Boolean(pr); | ||
return { | ||
name: 'Appveyor', | ||
service: 'appveyor', | ||
commit: env.APPVEYOR_REPO_COMMIT, | ||
tag: env.APPVEYOR_REPO_TAG_NAME, | ||
build: env.APPVEYOR_BUILD_NUMBER, | ||
buildUrl: `https://ci.appveyor.com/project/${env.APPVEYOR_PROJECT_SLUG}/build/${env.APPVEYOR_BUILD_VERSION}`, | ||
branch: env.APPVEYOR_REPO_BRANCH, | ||
job: env.APPVEYOR_JOB_NUMBER, | ||
jobUrl: `https://ci.appveyor.com/project/${env.APPVEYOR_PROJECT_SLUG}/build/job/${env.APPVEYOR_JOB_ID}`, | ||
pr, | ||
isPr, | ||
prBranch: env.APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH, | ||
slug: env.APPVEYOR_REPO_NAME, | ||
root: env.APPVEYOR_BUILD_FOLDER, | ||
}; | ||
}, | ||
return { | ||
name: 'Appveyor', | ||
service: 'appveyor', | ||
commit: env.APPVEYOR_REPO_COMMIT, | ||
tag: env.APPVEYOR_REPO_TAG_NAME, | ||
build: env.APPVEYOR_BUILD_NUMBER, | ||
buildUrl: `https://ci.appveyor.com/project/${env.APPVEYOR_PROJECT_SLUG}/build/${env.APPVEYOR_BUILD_VERSION}`, | ||
branch: env.APPVEYOR_REPO_BRANCH, | ||
job: env.APPVEYOR_JOB_NUMBER, | ||
jobUrl: `https://ci.appveyor.com/project/${env.APPVEYOR_PROJECT_SLUG}/build/job/${env.APPVEYOR_JOB_ID}`, | ||
pr, | ||
isPr, | ||
prBranch: env.APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH, | ||
slug: env.APPVEYOR_REPO_NAME, | ||
root: env.APPVEYOR_BUILD_FOLDER, | ||
}; | ||
}, | ||
}; |
// https://confluence.atlassian.com/bamboo/bamboo-variables-289277087.html | ||
module.exports = { | ||
detect({env}) { | ||
return Boolean(env.bamboo_agentId); | ||
}, | ||
configuration({env}) { | ||
return { | ||
name: 'Bamboo', | ||
service: 'bamboo', | ||
commit: env.bamboo_planRepository_1_revision, | ||
build: env.bamboo_buildNumber, | ||
buildUrl: env.bamboo_buildResultsUrl, | ||
branch: env.bamboo_planRepository_1_branchName, | ||
job: env.bamboo_buildKey, | ||
root: env.bamboo_build_working_directory, | ||
}; | ||
}, | ||
detect({env}) { | ||
return Boolean(env.bamboo_agentId); | ||
}, | ||
configuration({env}) { | ||
return { | ||
name: 'Bamboo', | ||
service: 'bamboo', | ||
commit: env.bamboo_planRepository_1_revision, | ||
build: env.bamboo_buildNumber, | ||
buildUrl: env.bamboo_buildResultsUrl, | ||
branch: env.bamboo_planRepository_1_branchName, | ||
job: env.bamboo_buildKey, | ||
root: env.bamboo_build_working_directory, | ||
}; | ||
}, | ||
}; |
// https://confluence.atlassian.com/bitbucket/environment-variables-794502608.html | ||
module.exports = { | ||
detect({env}) { | ||
return Boolean(env.BITBUCKET_BUILD_NUMBER); | ||
}, | ||
configuration({env}) { | ||
return { | ||
name: 'Bitbucket Pipelines', | ||
service: 'bitbucket', | ||
commit: env.BITBUCKET_COMMIT, | ||
tag: env.BITBUCKET_TAG, | ||
build: env.BITBUCKET_BUILD_NUMBER, | ||
buildUrl: `https://bitbucket.org/${env.BITBUCKET_REPO_SLUG}/addon/pipelines/home#!/results/${env.BITBUCKET_BUILD_NUMBER}`, | ||
branch: env.BITBUCKET_BRANCH, | ||
slug: env.BITBUCKET_REPO_SLUG, | ||
root: env.BITBUCKET_CLONE_DIR, | ||
}; | ||
}, | ||
detect({env}) { | ||
return Boolean(env.BITBUCKET_BUILD_NUMBER); | ||
}, | ||
configuration({env}) { | ||
return { | ||
name: 'Bitbucket Pipelines', | ||
service: 'bitbucket', | ||
commit: env.BITBUCKET_COMMIT, | ||
tag: env.BITBUCKET_TAG, | ||
build: env.BITBUCKET_BUILD_NUMBER, | ||
buildUrl: `https://bitbucket.org/${env.BITBUCKET_REPO_SLUG}/addon/pipelines/home#!/results/${env.BITBUCKET_BUILD_NUMBER}`, | ||
branch: env.BITBUCKET_BRANCH, | ||
slug: env.BITBUCKET_REPO_SLUG, | ||
root: env.BITBUCKET_CLONE_DIR, | ||
}; | ||
}, | ||
}; |
// https://devcenter.bitrise.io/builds/available-environment-variables/#exposed-by-bitriseio | ||
module.exports = { | ||
detect({env}) { | ||
return Boolean(env.BITRISE_IO); | ||
}, | ||
configuration({env}) { | ||
const pr = env.BITRISE_PULL_REQUEST === 'false' ? undefined : env.BITRISE_PULL_REQUEST; | ||
const isPr = Boolean(pr); | ||
detect({env}) { | ||
return Boolean(env.BITRISE_IO); | ||
}, | ||
configuration({env}) { | ||
const pr = env.BITRISE_PULL_REQUEST === 'false' ? undefined : env.BITRISE_PULL_REQUEST; | ||
const isPr = Boolean(pr); | ||
return { | ||
name: 'Bitrise', | ||
service: 'bitrise', | ||
commit: env.BITRISE_GIT_COMMIT, | ||
tag: env.BITRISE_GIT_TAG, | ||
build: env.BITRISE_BUILD_NUMBER, | ||
buildUrl: env.BITRISE_BUILD_URL, | ||
branch: isPr ? env.BITRISEIO_GIT_BRANCH_DEST : env.BITRISE_GIT_BRANCH, | ||
pr, | ||
isPr, | ||
prBranch: isPr ? env.BITRISE_GIT_BRANCH : undefined, | ||
slug: env.BITRISE_APP_SLUG, | ||
}; | ||
}, | ||
return { | ||
name: 'Bitrise', | ||
service: 'bitrise', | ||
commit: env.BITRISE_GIT_COMMIT, | ||
tag: env.BITRISE_GIT_TAG, | ||
build: env.BITRISE_BUILD_NUMBER, | ||
buildUrl: env.BITRISE_BUILD_URL, | ||
branch: isPr ? env.BITRISEIO_GIT_BRANCH_DEST : env.BITRISE_GIT_BRANCH, | ||
pr, | ||
isPr, | ||
prBranch: isPr ? env.BITRISE_GIT_BRANCH : undefined, | ||
slug: env.BITRISE_APP_SLUG, | ||
}; | ||
}, | ||
}; |
@@ -6,22 +6,22 @@ // https://buddy.works/knowledge/deployments/how-use-environment-variables#default-environment-variables | ||
module.exports = { | ||
detect({env}) { | ||
return Boolean(env.BUDDY_WORKSPACE_ID); | ||
}, | ||
configuration({env}) { | ||
const pr = prNumber(env.BUDDY_EXECUTION_PULL_REQUEST_ID); | ||
const isPr = Boolean(pr); | ||
detect({env}) { | ||
return Boolean(env.BUDDY_WORKSPACE_ID); | ||
}, | ||
configuration({env}) { | ||
const pr = prNumber(env.BUDDY_EXECUTION_PULL_REQUEST_ID); | ||
const isPr = Boolean(pr); | ||
return { | ||
name: 'Buddy', | ||
service: 'buddy', | ||
commit: env.BUDDY_EXECUTION_REVISION, | ||
tag: env.BUDDY_EXECUTION_TAG, | ||
build: env.BUDDY_EXECUTION_ID, | ||
buildUrl: env.BUDDY_EXECUTION_URL, | ||
branch: isPr ? undefined : env.BUDDY_EXECUTION_BRANCH, | ||
pr, | ||
isPr, | ||
slug: env.BUDDY_REPO_SLUG, | ||
}; | ||
}, | ||
return { | ||
name: 'Buddy', | ||
service: 'buddy', | ||
commit: env.BUDDY_EXECUTION_REVISION, | ||
tag: env.BUDDY_EXECUTION_TAG, | ||
build: env.BUDDY_EXECUTION_ID, | ||
buildUrl: env.BUDDY_EXECUTION_URL, | ||
branch: isPr ? undefined : env.BUDDY_EXECUTION_BRANCH, | ||
pr, | ||
isPr, | ||
slug: env.BUDDY_REPO_SLUG, | ||
}; | ||
}, | ||
}; |
// https://buildkite.com/docs/builds/environment-variables | ||
module.exports = { | ||
detect({env}) { | ||
return Boolean(env.BUILDKITE); | ||
}, | ||
configuration({env}) { | ||
const pr = env.BUILDKITE_PULL_REQUEST === 'false' ? undefined : env.BUILDKITE_PULL_REQUEST; | ||
const isPr = Boolean(pr); | ||
detect({env}) { | ||
return Boolean(env.BUILDKITE); | ||
}, | ||
configuration({env}) { | ||
const pr = env.BUILDKITE_PULL_REQUEST === 'false' ? undefined : env.BUILDKITE_PULL_REQUEST; | ||
const isPr = Boolean(pr); | ||
return { | ||
name: 'Buildkite', | ||
service: 'buildkite', | ||
build: env.BUILDKITE_BUILD_NUMBER, | ||
buildUrl: env.BUILDKITE_BUILD_URL, | ||
commit: env.BUILDKITE_COMMIT, | ||
tag: env.BUILDKITE_TAG, | ||
branch: isPr ? env.BUILDKITE_PULL_REQUEST_BASE_BRANCH : env.BUILDKITE_BRANCH, | ||
slug: `${env.BUILDKITE_ORGANIZATION_SLUG}/${env.BUILDKITE_PROJECT_SLUG}`, | ||
pr, | ||
isPr, | ||
prBranch: isPr ? env.BUILDKITE_BRANCH : undefined, | ||
root: env.BUILDKITE_BUILD_CHECKOUT_PATH, | ||
}; | ||
}, | ||
return { | ||
name: 'Buildkite', | ||
service: 'buildkite', | ||
build: env.BUILDKITE_BUILD_NUMBER, | ||
buildUrl: env.BUILDKITE_BUILD_URL, | ||
commit: env.BUILDKITE_COMMIT, | ||
tag: env.BUILDKITE_TAG, | ||
branch: isPr ? env.BUILDKITE_PULL_REQUEST_BASE_BRANCH : env.BUILDKITE_BRANCH, | ||
slug: `${env.BUILDKITE_ORGANIZATION_SLUG}/${env.BUILDKITE_PROJECT_SLUG}`, | ||
pr, | ||
isPr, | ||
prBranch: isPr ? env.BUILDKITE_BRANCH : undefined, | ||
root: env.BUILDKITE_BUILD_CHECKOUT_PATH, | ||
}; | ||
}, | ||
}; |
@@ -6,24 +6,24 @@ // https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables | ||
module.exports = { | ||
detect({env}) { | ||
return Boolean(env.CIRCLECI); | ||
}, | ||
configuration({env}) { | ||
const pr = env.CIRCLE_PR_NUMBER || prNumber(env.CIRCLE_PULL_REQUEST || env.CI_PULL_REQUEST); | ||
const isPr = Boolean(pr); | ||
detect({env}) { | ||
return Boolean(env.CIRCLECI); | ||
}, | ||
configuration({env}) { | ||
const pr = env.CIRCLE_PR_NUMBER || prNumber(env.CIRCLE_PULL_REQUEST || env.CI_PULL_REQUEST); | ||
const isPr = Boolean(pr); | ||
return { | ||
name: 'CircleCI', | ||
service: 'circleci', | ||
build: env.CIRCLE_BUILD_NUM, | ||
buildUrl: env.CIRCLE_BUILD_URL, | ||
job: `${env.CIRCLE_BUILD_NUM}.${env.CIRCLE_NODE_INDEX}`, | ||
commit: env.CIRCLE_SHA1, | ||
tag: env.CIRCLE_TAG, | ||
branch: isPr ? undefined : env.CIRCLE_BRANCH, | ||
pr, | ||
isPr, | ||
prBranch: isPr ? env.CIRCLE_BRANCH : undefined, | ||
slug: `${env.CIRCLE_PROJECT_USERNAME}/${env.CIRCLE_PROJECT_REPONAME}`, | ||
}; | ||
}, | ||
return { | ||
name: 'CircleCI', | ||
service: 'circleci', | ||
build: env.CIRCLE_BUILD_NUM, | ||
buildUrl: env.CIRCLE_BUILD_URL, | ||
job: `${env.CIRCLE_BUILD_NUM}.${env.CIRCLE_NODE_INDEX}`, | ||
commit: env.CIRCLE_SHA1, | ||
tag: env.CIRCLE_TAG, | ||
branch: isPr ? undefined : env.CIRCLE_BRANCH, | ||
pr, | ||
isPr, | ||
prBranch: isPr ? env.CIRCLE_BRANCH : undefined, | ||
slug: `${env.CIRCLE_PROJECT_USERNAME}/${env.CIRCLE_PROJECT_REPONAME}`, | ||
}; | ||
}, | ||
}; |
@@ -6,25 +6,25 @@ // https://cirrus-ci.org/guide/writing-tasks/#environment-variables | ||
module.exports = { | ||
detect({env}) { | ||
return Boolean(env.CIRRUS_CI); | ||
}, | ||
configuration({env}) { | ||
const pr = env.CIRRUS_PR; | ||
const isPr = Boolean(pr); | ||
detect({env}) { | ||
return Boolean(env.CIRRUS_CI); | ||
}, | ||
configuration({env}) { | ||
const pr = env.CIRRUS_PR; | ||
const isPr = Boolean(pr); | ||
return { | ||
name: 'Cirrus CI', | ||
service: 'cirrus', | ||
commit: env.CIRRUS_CHANGE_IN_REPO, | ||
tag: env.CIRRUS_TAG, | ||
build: env.CIRRUS_BUILD_ID, | ||
buildUrl: `${CIRRUS_CI_DASHBOARD}/build/${env.CIRRUS_BUILD_ID}`, | ||
job: env.CIRRUS_TASK_ID, | ||
jobUrl: `${CIRRUS_CI_DASHBOARD}/task/${env.CIRRUS_TASK_ID}`, | ||
branch: isPr ? env.CIRRUS_BASE_BRANCH : env.CIRRUS_BRANCH, | ||
pr, | ||
isPr, | ||
slug: env.CIRRUS_REPO_FULL_NAME, | ||
root: env.CIRRUS_WORKING_DIR, | ||
}; | ||
}, | ||
return { | ||
name: 'Cirrus CI', | ||
service: 'cirrus', | ||
commit: env.CIRRUS_CHANGE_IN_REPO, | ||
tag: env.CIRRUS_TAG, | ||
build: env.CIRRUS_BUILD_ID, | ||
buildUrl: `${CIRRUS_CI_DASHBOARD}/build/${env.CIRRUS_BUILD_ID}`, | ||
job: env.CIRRUS_TASK_ID, | ||
jobUrl: `${CIRRUS_CI_DASHBOARD}/task/${env.CIRRUS_TASK_ID}`, | ||
branch: isPr ? env.CIRRUS_BASE_BRANCH : env.CIRRUS_BRANCH, | ||
pr, | ||
isPr, | ||
slug: env.CIRRUS_REPO_FULL_NAME, | ||
root: env.CIRRUS_WORKING_DIR, | ||
}; | ||
}, | ||
}; |
@@ -6,16 +6,16 @@ const {head, branch} = require('../lib/git'); | ||
module.exports = { | ||
detect({env}) { | ||
return Boolean(env.CODEBUILD_BUILD_ID); | ||
}, | ||
configuration({env, cwd}) { | ||
return { | ||
name: 'AWS CodeBuild', | ||
service: 'codebuild', | ||
commit: head({env, cwd}), | ||
build: env.CODEBUILD_BUILD_ID, | ||
branch: branch({env, cwd}), | ||
buildUrl: `https://console.aws.amazon.com/codebuild/home?region=${env.AWS_REGION}#/builds/${env.CODEBUILD_BUILD_ID}/view/new`, | ||
root: env.PWD, | ||
}; | ||
}, | ||
detect({env}) { | ||
return Boolean(env.CODEBUILD_BUILD_ID); | ||
}, | ||
configuration({env, cwd}) { | ||
return { | ||
name: 'AWS CodeBuild', | ||
service: 'codebuild', | ||
commit: head({env, cwd}), | ||
build: env.CODEBUILD_BUILD_ID, | ||
branch: branch({env, cwd}), | ||
buildUrl: `https://console.aws.amazon.com/codebuild/home?region=${env.AWS_REGION}#/builds/${env.CODEBUILD_BUILD_ID}/view/new`, | ||
root: env.PWD, | ||
}; | ||
}, | ||
}; |
// https://codefresh.io/docs/docs/codefresh-yaml/variables#system-provided-variables | ||
module.exports = { | ||
detect({env}) { | ||
return Boolean(env.CF_BUILD_ID); | ||
}, | ||
configuration({env}) { | ||
const pr = env.CF_PULL_REQUEST_NUMBER; | ||
const isPr = Boolean(pr); | ||
detect({env}) { | ||
return Boolean(env.CF_BUILD_ID); | ||
}, | ||
configuration({env}) { | ||
const pr = env.CF_PULL_REQUEST_NUMBER; | ||
const isPr = Boolean(pr); | ||
return { | ||
name: 'Codefresh', | ||
service: 'codefresh', | ||
commit: env.CF_REVISION, | ||
build: env.CF_BUILD_ID, | ||
buildUrl: env.CF_BUILD_URL, | ||
branch: isPr ? env.CF_PULL_REQUEST_TARGET : env.CF_BRANCH, | ||
pr, | ||
isPr, | ||
prBranch: isPr ? env.CF_BRANCH : undefined, | ||
slug: `${env.CF_REPO_OWNER}/${env.CF_REPO_NAME}`, | ||
root: env.CF_VOLUME_PATH, | ||
}; | ||
}, | ||
return { | ||
name: 'Codefresh', | ||
service: 'codefresh', | ||
commit: env.CF_REVISION, | ||
build: env.CF_BUILD_ID, | ||
buildUrl: env.CF_BUILD_URL, | ||
branch: isPr ? env.CF_PULL_REQUEST_TARGET : env.CF_BRANCH, | ||
pr, | ||
isPr, | ||
prBranch: isPr ? env.CF_BRANCH : undefined, | ||
slug: `${env.CF_REPO_OWNER}/${env.CF_REPO_NAME}`, | ||
root: env.CF_VOLUME_PATH, | ||
}; | ||
}, | ||
}; |
// https://documentation.codeship.com/basic/builds-and-configuration/set-environment-variables/#default-environment-variables | ||
module.exports = { | ||
detect({env}) { | ||
return env.CI_NAME && env.CI_NAME === 'codeship'; | ||
}, | ||
configuration({env}) { | ||
return { | ||
name: 'Codeship', | ||
service: 'codeship', | ||
build: env.CI_BUILD_NUMBER, | ||
buildUrl: env.CI_BUILD_URL, | ||
commit: env.CI_COMMIT_ID, | ||
branch: env.CI_BRANCH, | ||
slug: env.CI_REPO_NAME, | ||
}; | ||
}, | ||
detect({env}) { | ||
return env.CI_NAME && env.CI_NAME === 'codeship'; | ||
}, | ||
configuration({env}) { | ||
return { | ||
name: 'Codeship', | ||
service: 'codeship', | ||
build: env.CI_BUILD_NUMBER, | ||
buildUrl: env.CI_BUILD_URL, | ||
commit: env.CI_COMMIT_ID, | ||
branch: env.CI_BRANCH, | ||
slug: env.CI_REPO_NAME, | ||
}; | ||
}, | ||
}; |
// https://readme.drone.io/reference/environ | ||
module.exports = { | ||
detect({env}) { | ||
return Boolean(env.DRONE); | ||
}, | ||
configuration({env}) { | ||
const isPr = env.DRONE_BUILD_EVENT === 'pull_request'; | ||
detect({env}) { | ||
return Boolean(env.DRONE); | ||
}, | ||
configuration({env}) { | ||
const isPr = env.DRONE_BUILD_EVENT === 'pull_request'; | ||
return { | ||
name: 'Drone', | ||
service: 'drone', | ||
commit: env.DRONE_COMMIT_SHA, | ||
tag: env.DRONE_TAG, | ||
build: env.DRONE_BUILD_NUMBER, | ||
buildUrl: env.DRONE_BUILD_LINK, | ||
branch: isPr ? env.DRONE_TARGET_BRANCH : env.DRONE_BRANCH, | ||
job: env.DRONE_JOB_NUMBER, | ||
jobUrl: env.DRONE_BUILD_LINK, | ||
pr: env.DRONE_PULL_REQUEST, | ||
isPr, | ||
prBranch: isPr ? env.DRONE_SOURCE_BRANCH : undefined, | ||
slug: `${env.DRONE_REPO_OWNER}/${env.DRONE_REPO_NAME}`, | ||
root: env.DRONE_WORKSPACE, | ||
}; | ||
}, | ||
return { | ||
name: 'Drone', | ||
service: 'drone', | ||
commit: env.DRONE_COMMIT_SHA, | ||
tag: env.DRONE_TAG, | ||
build: env.DRONE_BUILD_NUMBER, | ||
buildUrl: env.DRONE_BUILD_LINK, | ||
branch: isPr ? env.DRONE_TARGET_BRANCH : env.DRONE_BRANCH, | ||
job: env.DRONE_JOB_NUMBER, | ||
jobUrl: env.DRONE_BUILD_LINK, | ||
pr: env.DRONE_PULL_REQUEST, | ||
isPr, | ||
prBranch: isPr ? env.DRONE_SOURCE_BRANCH : undefined, | ||
slug: `${env.DRONE_REPO_OWNER}/${env.DRONE_REPO_NAME}`, | ||
root: env.DRONE_WORKSPACE, | ||
}; | ||
}, | ||
}; |
const {head, branch} = require('../lib/git'); | ||
module.exports = { | ||
configuration(options) { | ||
return {commit: head(options), branch: branch(options)}; | ||
}, | ||
configuration(options) { | ||
return {commit: head(options), branch: branch(options)}; | ||
}, | ||
}; |
@@ -5,38 +5,38 @@ // https://help.github.com/en/articles/virtual-environments-for-github-actions#environment-variables | ||
const getPrEvent = ({env}) => { | ||
try { | ||
const event = env.GITHUB_EVENT_PATH ? require(env.GITHUB_EVENT_PATH) : undefined; | ||
try { | ||
const event = env.GITHUB_EVENT_PATH ? require(env.GITHUB_EVENT_PATH) : undefined; | ||
if (event && event.pull_request) { | ||
return { | ||
branch: event.pull_request.base ? parseBranch(event.pull_request.base.ref) : undefined, | ||
pr: event.pull_request.number, | ||
}; | ||
} | ||
} catch (_) { | ||
// Noop | ||
} | ||
if (event && event.pull_request) { | ||
return { | ||
branch: event.pull_request.base ? parseBranch(event.pull_request.base.ref) : undefined, | ||
pr: event.pull_request.number, | ||
}; | ||
} | ||
} catch (_) { | ||
// Noop | ||
} | ||
return {pr: undefined, branch: undefined}; | ||
return {pr: undefined, branch: undefined}; | ||
}; | ||
module.exports = { | ||
detect({env}) { | ||
return Boolean(env.GITHUB_ACTION); | ||
}, | ||
configuration({env, cwd}) { | ||
const isPr = env.GITHUB_EVENT_NAME === 'pull_request'; | ||
const branch = parseBranch(env.GITHUB_REF); | ||
detect({env}) { | ||
return Boolean(env.GITHUB_ACTION); | ||
}, | ||
configuration({env, cwd}) { | ||
const isPr = env.GITHUB_EVENT_NAME === 'pull_request'; | ||
const branch = parseBranch(env.GITHUB_REF); | ||
return { | ||
name: 'GitHub Actions', | ||
service: 'github', | ||
commit: env.GITHUB_SHA, | ||
isPr, | ||
branch, | ||
prBranch: isPr ? branch : undefined, | ||
slug: env.GITHUB_REPOSITORY, | ||
root: env.GITHUB_WORKSPACE, | ||
...(isPr ? getPrEvent({env, cwd}) : undefined), | ||
}; | ||
}, | ||
return { | ||
name: 'GitHub Actions', | ||
service: 'github', | ||
commit: env.GITHUB_SHA, | ||
isPr, | ||
branch, | ||
prBranch: isPr ? branch : undefined, | ||
slug: env.GITHUB_REPOSITORY, | ||
root: env.GITHUB_WORKSPACE, | ||
...(isPr ? getPrEvent({env, cwd}) : undefined), | ||
}; | ||
}, | ||
}; |
// https://docs.gitlab.com/ce/ci/variables/README.html | ||
module.exports = { | ||
detect({env}) { | ||
return Boolean(env.GITLAB_CI); | ||
}, | ||
configuration({env}) { | ||
const pr = env.CI_MERGE_REQUEST_ID; | ||
const isPr = Boolean(pr); | ||
detect({env}) { | ||
return Boolean(env.GITLAB_CI); | ||
}, | ||
configuration({env}) { | ||
const pr = env.CI_MERGE_REQUEST_ID; | ||
const isPr = Boolean(pr); | ||
return { | ||
name: 'GitLab CI/CD', | ||
service: 'gitlab', | ||
commit: env.CI_COMMIT_SHA, | ||
tag: env.CI_COMMIT_TAG, | ||
build: env.CI_PIPELINE_ID, | ||
buildUrl: `${env.CI_PROJECT_URL}/pipelines/${env.CI_PIPELINE_ID}`, | ||
job: env.CI_JOB_ID, | ||
jobUrl: `${env.CI_PROJECT_URL}/-/jobs/${env.CI_JOB_ID}`, | ||
branch: isPr ? env.CI_MERGE_REQUEST_TARGET_BRANCH_NAME : env.CI_COMMIT_REF_NAME, | ||
pr, | ||
isPr, | ||
prBranch: env.CI_MERGE_REQUEST_SOURCE_BRANCH_NAME, | ||
slug: env.CI_PROJECT_PATH, | ||
root: env.CI_PROJECT_DIR, | ||
}; | ||
}, | ||
return { | ||
name: 'GitLab CI/CD', | ||
service: 'gitlab', | ||
commit: env.CI_COMMIT_SHA, | ||
tag: env.CI_COMMIT_TAG, | ||
build: env.CI_PIPELINE_ID, | ||
buildUrl: `${env.CI_PROJECT_URL}/pipelines/${env.CI_PIPELINE_ID}`, | ||
job: env.CI_JOB_ID, | ||
jobUrl: `${env.CI_PROJECT_URL}/-/jobs/${env.CI_JOB_ID}`, | ||
branch: isPr ? env.CI_MERGE_REQUEST_TARGET_BRANCH_NAME : env.CI_COMMIT_REF_NAME, | ||
pr, | ||
isPr, | ||
prBranch: env.CI_MERGE_REQUEST_SOURCE_BRANCH_NAME, | ||
slug: env.CI_PROJECT_PATH, | ||
root: env.CI_PROJECT_DIR, | ||
}; | ||
}, | ||
}; |
@@ -6,23 +6,23 @@ const {head} = require('../lib/git'); | ||
module.exports = { | ||
detect({env}) { | ||
return Boolean(env.JENKINS_URL); | ||
}, | ||
configuration({env, cwd}) { | ||
const pr = env.ghprbPullId || env.gitlabMergeRequestId || env.CHANGE_ID; | ||
const isPr = Boolean(pr); | ||
const localBranch = env.GIT_LOCAL_BRANCH || env.GIT_BRANCH || env.gitlabBranch || env.BRANCH_NAME; | ||
detect({env}) { | ||
return Boolean(env.JENKINS_URL); | ||
}, | ||
configuration({env, cwd}) { | ||
const pr = env.ghprbPullId || env.gitlabMergeRequestId || env.CHANGE_ID; | ||
const isPr = Boolean(pr); | ||
const localBranch = env.GIT_LOCAL_BRANCH || env.GIT_BRANCH || env.gitlabBranch || env.BRANCH_NAME; | ||
return { | ||
name: 'Jenkins', | ||
service: 'jenkins', | ||
commit: env.ghprbActualCommit || env.GIT_COMMIT || head({env, cwd}), | ||
branch: isPr ? env.ghprbTargetBranch || env.gitlabTargetBranch : localBranch, | ||
build: env.BUILD_NUMBER, | ||
buildUrl: env.BUILD_URL, | ||
root: env.WORKSPACE, | ||
pr, | ||
isPr, | ||
prBranch: isPr ? env.ghprbSourceBranch || env.gitlabSourceBranch || localBranch : undefined, | ||
}; | ||
}, | ||
return { | ||
name: 'Jenkins', | ||
service: 'jenkins', | ||
commit: env.ghprbActualCommit || env.GIT_COMMIT || head({env, cwd}), | ||
branch: isPr ? env.ghprbTargetBranch || env.gitlabTargetBranch : localBranch, | ||
build: env.BUILD_NUMBER, | ||
buildUrl: env.BUILD_URL, | ||
root: env.WORKSPACE, | ||
pr, | ||
isPr, | ||
prBranch: isPr ? env.ghprbSourceBranch || env.gitlabSourceBranch || localBranch : undefined, | ||
}; | ||
}, | ||
}; |
// https://puppet.com/docs/pipelines-for-apps/enterprise/environment-variable.html | ||
module.exports = { | ||
detect({env}) { | ||
return Boolean(env.DISTELLI_APPNAME); | ||
}, | ||
configuration({env}) { | ||
return { | ||
name: 'Puppet', | ||
service: 'puppet', | ||
build: env.DISTELLI_BUILDNUM, | ||
buildUrl: env.DISTELLI_RELEASE, | ||
commit: env.DISTELLI_RELREVISION, | ||
branch: env.DISTELLI_RELBRANCH, | ||
root: env.DISTELLI_INSTALLHOME, | ||
}; | ||
}, | ||
detect({env}) { | ||
return Boolean(env.DISTELLI_APPNAME); | ||
}, | ||
configuration({env}) { | ||
return { | ||
name: 'Puppet', | ||
service: 'puppet', | ||
build: env.DISTELLI_BUILDNUM, | ||
buildUrl: env.DISTELLI_RELEASE, | ||
commit: env.DISTELLI_RELREVISION, | ||
branch: env.DISTELLI_RELBRANCH, | ||
root: env.DISTELLI_INSTALLHOME, | ||
}; | ||
}, | ||
}; |
// https://sail.ci/docs/environment-variables | ||
module.exports = { | ||
detect({env}) { | ||
return Boolean(env.SAILCI); | ||
}, | ||
configuration({env}) { | ||
const pr = env.SAIL_PULL_REQUEST_NUMBER; | ||
const isPr = Boolean(pr); | ||
detect({env}) { | ||
return Boolean(env.SAILCI); | ||
}, | ||
configuration({env}) { | ||
const pr = env.SAIL_PULL_REQUEST_NUMBER; | ||
const isPr = Boolean(pr); | ||
return { | ||
name: 'Sail CI', | ||
service: 'sail', | ||
commit: env.SAIL_COMMIT_SHA, | ||
branch: isPr ? undefined : env.SAIL_COMMIT_BRANCH, | ||
pr, | ||
isPr, | ||
slug: `${env.SAIL_REPO_OWNER}/${env.SAIL_REPO_NAME}`, | ||
root: env.SAIL_CLONE_DIR, | ||
}; | ||
}, | ||
return { | ||
name: 'Sail CI', | ||
service: 'sail', | ||
commit: env.SAIL_COMMIT_SHA, | ||
branch: isPr ? undefined : env.SAIL_COMMIT_BRANCH, | ||
pr, | ||
isPr, | ||
slug: `${env.SAIL_REPO_OWNER}/${env.SAIL_REPO_NAME}`, | ||
root: env.SAIL_CLONE_DIR, | ||
}; | ||
}, | ||
}; |
// https://scrutinizer-ci.com/docs/build/environment-variables | ||
module.exports = { | ||
detect({env}) { | ||
return Boolean(env.SCRUTINIZER); | ||
}, | ||
configuration({env}) { | ||
const pr = env.SCRUTINIZER_PR_NUMBER; | ||
const isPr = Boolean(pr); | ||
detect({env}) { | ||
return Boolean(env.SCRUTINIZER); | ||
}, | ||
configuration({env}) { | ||
const pr = env.SCRUTINIZER_PR_NUMBER; | ||
const isPr = Boolean(pr); | ||
return { | ||
name: 'Scrutinizer', | ||
service: 'scrutinizer', | ||
commit: env.SCRUTINIZER_SHA1, | ||
build: env.SCRUTINIZER_INSPECTION_UUID, | ||
branch: env.SCRUTINIZER_BRANCH, | ||
pr, | ||
isPr, | ||
prBranch: env.SCRUTINIZER_PR_SOURCE_BRANCH, | ||
}; | ||
}, | ||
return { | ||
name: 'Scrutinizer', | ||
service: 'scrutinizer', | ||
commit: env.SCRUTINIZER_SHA1, | ||
build: env.SCRUTINIZER_INSPECTION_UUID, | ||
branch: env.SCRUTINIZER_BRANCH, | ||
pr, | ||
isPr, | ||
prBranch: env.SCRUTINIZER_PR_SOURCE_BRANCH, | ||
}; | ||
}, | ||
}; |
@@ -7,23 +7,23 @@ const {head} = require('../lib/git'); | ||
module.exports = { | ||
detect({env}) { | ||
return Boolean(env.SEMAPHORE); | ||
}, | ||
configuration({env, cwd}) { | ||
const pr = env.SEMAPHORE_GIT_PR_NUMBER || env.PULL_REQUEST_NUMBER; | ||
const isPr = Boolean(pr); | ||
detect({env}) { | ||
return Boolean(env.SEMAPHORE); | ||
}, | ||
configuration({env, cwd}) { | ||
const pr = env.SEMAPHORE_GIT_PR_NUMBER || env.PULL_REQUEST_NUMBER; | ||
const isPr = Boolean(pr); | ||
return { | ||
name: 'Semaphore', | ||
service: 'semaphore', | ||
commit: env.SEMAPHORE_GIT_SHA || head({env, cwd}), | ||
tag: env.SEMAPHORE_GIT_TAG_NAME, | ||
build: env.SEMAPHORE_JOB_ID || env.SEMAPHORE_BUILD_NUMBER, | ||
branch: env.SEMAPHORE_GIT_BRANCH || (isPr ? undefined : env.BRANCH_NAME), | ||
pr, | ||
isPr, | ||
prBranch: env.SEMAPHORE_GIT_PR_BRANCH || (isPr ? env.BRANCH_NAME : undefined), | ||
slug: env.SEMAPHORE_GIT_REPO_SLUG || env.SEMAPHORE_REPO_SLUG, | ||
root: env.SEMAPHORE_GIT_DIR || env.SEMAPHORE_PROJECT_DIR, | ||
}; | ||
}, | ||
return { | ||
name: 'Semaphore', | ||
service: 'semaphore', | ||
commit: env.SEMAPHORE_GIT_SHA || head({env, cwd}), | ||
tag: env.SEMAPHORE_GIT_TAG_NAME, | ||
build: env.SEMAPHORE_JOB_ID || env.SEMAPHORE_BUILD_NUMBER, | ||
branch: env.SEMAPHORE_GIT_BRANCH || (isPr ? undefined : env.BRANCH_NAME), | ||
pr, | ||
isPr, | ||
prBranch: env.SEMAPHORE_GIT_PR_BRANCH || (isPr ? env.BRANCH_NAME : undefined), | ||
slug: env.SEMAPHORE_GIT_REPO_SLUG || env.SEMAPHORE_REPO_SLUG, | ||
root: env.SEMAPHORE_GIT_DIR || env.SEMAPHORE_PROJECT_DIR, | ||
}; | ||
}, | ||
}; |
// http://docs.shippable.com/ci/env-vars/#stdEnv | ||
module.exports = { | ||
detect({env}) { | ||
return Boolean(env.SHIPPABLE); | ||
}, | ||
configuration({env}) { | ||
const pr = env.IS_PULL_REQUEST === 'true' ? env.PULL_REQUEST : undefined; | ||
const isPr = Boolean(pr); | ||
detect({env}) { | ||
return Boolean(env.SHIPPABLE); | ||
}, | ||
configuration({env}) { | ||
const pr = env.IS_PULL_REQUEST === 'true' ? env.PULL_REQUEST : undefined; | ||
const isPr = Boolean(pr); | ||
return { | ||
name: 'Shippable', | ||
service: 'shippable', | ||
commit: env.COMMIT, | ||
tag: env.GIT_TAG_NAME, | ||
build: env.BUILD_NUMBER, | ||
buildUrl: env.BUILD_URL, | ||
branch: isPr ? env.BASE_BRANCH : env.BRANCH, | ||
job: env.JOB_NUMBER, | ||
pr, | ||
isPr, | ||
prBranch: isPr ? env.HEAD_BRANCH : undefined, | ||
slug: env.SHIPPABLE_REPO_SLUG, | ||
root: env.SHIPPABLE_BUILD_DIR, | ||
}; | ||
}, | ||
return { | ||
name: 'Shippable', | ||
service: 'shippable', | ||
commit: env.COMMIT, | ||
tag: env.GIT_TAG_NAME, | ||
build: env.BUILD_NUMBER, | ||
buildUrl: env.BUILD_URL, | ||
branch: isPr ? env.BASE_BRANCH : env.BRANCH, | ||
job: env.JOB_NUMBER, | ||
pr, | ||
isPr, | ||
prBranch: isPr ? env.HEAD_BRANCH : undefined, | ||
slug: env.SHIPPABLE_REPO_SLUG, | ||
root: env.SHIPPABLE_BUILD_DIR, | ||
}; | ||
}, | ||
}; |
@@ -9,42 +9,42 @@ // https://confluence.jetbrains.com/display/TCD10/Predefined+Build+Parameters | ||
const safeReadProperties = filePath => { | ||
try { | ||
return javaProperties.of(filePath); | ||
} catch (_) { | ||
return undefined; | ||
} | ||
try { | ||
return javaProperties.of(filePath); | ||
} catch (_) { | ||
return undefined; | ||
} | ||
}; | ||
const getProperties = ({env, cwd}) => { | ||
const buildProperties = env.TEAMCITY_BUILD_PROPERTIES_FILE | ||
? safeReadProperties(env.TEAMCITY_BUILD_PROPERTIES_FILE) | ||
: undefined; | ||
const configFile = buildProperties ? buildProperties.get('teamcity.configuration.properties.file') : undefined; | ||
const configProperties = configFile ? safeReadProperties(configFile) : configFile; | ||
const buildProperties = env.TEAMCITY_BUILD_PROPERTIES_FILE | ||
? safeReadProperties(env.TEAMCITY_BUILD_PROPERTIES_FILE) | ||
: undefined; | ||
const configFile = buildProperties ? buildProperties.get('teamcity.configuration.properties.file') : undefined; | ||
const configProperties = configFile ? safeReadProperties(configFile) : configFile; | ||
return Object.keys(PROPERTIES_MAPPING).reduce( | ||
(result, key) => | ||
Object.assign(result, { | ||
[key]: | ||
(buildProperties ? buildProperties.get(PROPERTIES_MAPPING[key]) : undefined) || | ||
(configProperties ? configProperties.get(PROPERTIES_MAPPING[key]) : undefined) || | ||
(key === 'branch' ? branch({env, cwd}) : undefined), | ||
}), | ||
{} | ||
); | ||
return Object.keys(PROPERTIES_MAPPING).reduce( | ||
(result, key) => | ||
Object.assign(result, { | ||
[key]: | ||
(buildProperties ? buildProperties.get(PROPERTIES_MAPPING[key]) : undefined) || | ||
(configProperties ? configProperties.get(PROPERTIES_MAPPING[key]) : undefined) || | ||
(key === 'branch' ? branch({env, cwd}) : undefined), | ||
}), | ||
{} | ||
); | ||
}; | ||
module.exports = { | ||
detect({env}) { | ||
return Boolean(env.TEAMCITY_VERSION); | ||
}, | ||
configuration({env, cwd}) { | ||
return { | ||
name: 'TeamCity', | ||
service: 'teamcity', | ||
commit: env.BUILD_VCS_NUMBER, | ||
build: env.BUILD_NUMBER, | ||
slug: env.TEAMCITY_BUILDCONF_NAME, | ||
...getProperties({env, cwd}), | ||
}; | ||
}, | ||
detect({env}) { | ||
return Boolean(env.TEAMCITY_VERSION); | ||
}, | ||
configuration({env, cwd}) { | ||
return { | ||
name: 'TeamCity', | ||
service: 'teamcity', | ||
commit: env.BUILD_VCS_NUMBER, | ||
build: env.BUILD_NUMBER, | ||
slug: env.TEAMCITY_BUILDCONF_NAME, | ||
...getProperties({env, cwd}), | ||
}; | ||
}, | ||
}; |
// https://docs.travis-ci.com/user/environment-variables#default-environment-variables | ||
module.exports = { | ||
detect({env}) { | ||
return Boolean(env.TRAVIS); | ||
}, | ||
configuration({env}) { | ||
const pr = env.TRAVIS_PULL_REQUEST === 'false' ? undefined : env.TRAVIS_PULL_REQUEST; | ||
const isPr = Boolean(pr); | ||
detect({env}) { | ||
return Boolean(env.TRAVIS); | ||
}, | ||
configuration({env}) { | ||
const pr = env.TRAVIS_PULL_REQUEST === 'false' ? undefined : env.TRAVIS_PULL_REQUEST; | ||
const isPr = Boolean(pr); | ||
return { | ||
name: 'Travis CI', | ||
service: 'travis', | ||
commit: env.TRAVIS_COMMIT, | ||
tag: env.TRAVIS_TAG, | ||
build: env.TRAVIS_BUILD_NUMBER, | ||
buildUrl: env.TRAVIS_BUILD_WEB_URL, | ||
branch: env.TRAVIS_BRANCH, | ||
job: env.TRAVIS_JOB_NUMBER, | ||
jobUrl: env.TRAVIS_JOB_WEB_URL, | ||
pr, | ||
isPr, | ||
prBranch: env.TRAVIS_PULL_REQUEST_BRANCH, | ||
slug: env.TRAVIS_REPO_SLUG, | ||
root: env.TRAVIS_BUILD_DIR, | ||
}; | ||
}, | ||
return { | ||
name: 'Travis CI', | ||
service: 'travis', | ||
commit: env.TRAVIS_COMMIT, | ||
tag: env.TRAVIS_TAG, | ||
build: env.TRAVIS_BUILD_NUMBER, | ||
buildUrl: env.TRAVIS_BUILD_WEB_URL, | ||
branch: env.TRAVIS_BRANCH, | ||
job: env.TRAVIS_JOB_NUMBER, | ||
jobUrl: env.TRAVIS_JOB_WEB_URL, | ||
pr, | ||
isPr, | ||
prBranch: env.TRAVIS_PULL_REQUEST_BRANCH, | ||
slug: env.TRAVIS_REPO_SLUG, | ||
root: env.TRAVIS_BUILD_DIR, | ||
}; | ||
}, | ||
}; |
@@ -6,21 +6,21 @@ // https://docs.microsoft.com/en-us/vsts/pipelines/build/variables | ||
module.exports = { | ||
detect({env}) { | ||
return Boolean(env.BUILD_BUILDURI); | ||
}, | ||
configuration({env}) { | ||
const pr = env.SYSTEM_PULLREQUEST_PULLREQUESTID; | ||
const isPr = Boolean(pr); | ||
detect({env}) { | ||
return Boolean(env.BUILD_BUILDURI); | ||
}, | ||
configuration({env}) { | ||
const pr = env.SYSTEM_PULLREQUEST_PULLREQUESTID; | ||
const isPr = Boolean(pr); | ||
return { | ||
name: 'Visual Studio Team Services', | ||
service: 'vsts', | ||
commit: env.BUILD_SOURCEVERSION, | ||
build: env.BUILD_BUILDNUMBER, | ||
branch: parseBranch(isPr ? env.SYSTEM_PULLREQUEST_TARGETBRANCH : env.BUILD_SOURCEBRANCH), | ||
pr, | ||
isPr, | ||
prBranch: parseBranch(isPr ? env.SYSTEM_PULLREQUEST_SOURCEBRANCH : undefined), | ||
root: env.BUILD_REPOSITORY_LOCALPATH, | ||
}; | ||
}, | ||
return { | ||
name: 'Visual Studio Team Services', | ||
service: 'vsts', | ||
commit: env.BUILD_SOURCEVERSION, | ||
build: env.BUILD_BUILDNUMBER, | ||
branch: parseBranch(isPr ? env.SYSTEM_PULLREQUEST_TARGETBRANCH : env.BUILD_SOURCEBRANCH), | ||
pr, | ||
isPr, | ||
prBranch: parseBranch(isPr ? env.SYSTEM_PULLREQUEST_SOURCEBRANCH : undefined), | ||
root: env.BUILD_REPOSITORY_LOCALPATH, | ||
}; | ||
}, | ||
}; |
// http://devcenter.wercker.com/docs/environment-variables/available-env-vars#hs_cos_wrapper_name | ||
module.exports = { | ||
detect({env}) { | ||
return Boolean(env.WERCKER_MAIN_PIPELINE_STARTED); | ||
}, | ||
configuration({env}) { | ||
return { | ||
name: 'Wercker', | ||
service: 'wercker', | ||
commit: env.WERCKER_GIT_COMMIT, | ||
build: env.WERCKER_MAIN_PIPELINE_STARTED, | ||
buildUrl: env.WERCKER_RUN_URL, | ||
branch: env.WERCKER_GIT_BRANCH, | ||
slug: `${env.WERCKER_GIT_OWNER}/${env.WERCKER_GIT_REPOSITORY}`, | ||
root: env.WERCKER_ROOT, | ||
}; | ||
}, | ||
detect({env}) { | ||
return Boolean(env.WERCKER_MAIN_PIPELINE_STARTED); | ||
}, | ||
configuration({env}) { | ||
return { | ||
name: 'Wercker', | ||
service: 'wercker', | ||
commit: env.WERCKER_GIT_COMMIT, | ||
build: env.WERCKER_MAIN_PIPELINE_STARTED, | ||
buildUrl: env.WERCKER_RUN_URL, | ||
branch: env.WERCKER_GIT_BRANCH, | ||
slug: `${env.WERCKER_GIT_OWNER}/${env.WERCKER_GIT_REPOSITORY}`, | ||
root: env.WERCKER_ROOT, | ||
}; | ||
}, | ||
}; |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
42905
165
1