From 2702f46bd7284fb303ca2119d23c52536811d705 Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Wed, 12 Sep 2018 09:53:43 -0700 Subject: [PATCH] ci-info@1.5.1 --- node_modules/ci-info/README.md | 83 ++++++++----------- node_modules/ci-info/index.js | 66 ++++++++------- node_modules/ci-info/package.json | 29 +++---- node_modules/ci-info/vendors.json | 131 ++++++++++++++++++++++++++++++ package-lock.json | 6 +- package.json | 2 +- 6 files changed, 218 insertions(+), 99 deletions(-) create mode 100644 node_modules/ci-info/vendors.json diff --git a/node_modules/ci-info/README.md b/node_modules/ci-info/README.md index a76fd2e16365..b3f677ddc497 100644 --- a/node_modules/ci-info/README.md +++ b/node_modules/ci-info/README.md @@ -32,28 +32,31 @@ if (ci.isCI) { Officially supported CI servers: -- [AWS CodeBuild](https://aws.amazon.com/codebuild/) -- [AppVeyor](http://www.appveyor.com) -- [Bamboo](https://www.atlassian.com/software/bamboo) by Atlassian -- [Bitbucket Pipelines](https://bitbucket.org/product/features/pipelines) -- [Buildkite](https://buildkite.com) -- [CircleCI](http://circleci.com) -- [Cirrus CI](https://cirrus-ci.org) -- [Codeship](https://codeship.com) -- [Drone](https://drone.io) -- [GitLab CI](https://about.gitlab.com/gitlab-ci/) -- [GoCD](https://www.go.cd/) -- [Hudson](http://hudson-ci.org) -- [Jenkins CI](https://jenkins-ci.org) -- [Magnum CI](https://magnum-ci.com) -- [Semaphore](https://semaphoreci.com) -- [Shippable](https://www.shippable.com/) -- [Solano CI](https://www.solanolabs.com/) -- [Strider CD](https://strider-cd.github.io/) -- [TaskCluster](http://docs.taskcluster.net) -- [Team Foundation Server](https://www.visualstudio.com/en-us/products/tfs-overview-vs.aspx) by Microsoft -- [TeamCity](https://www.jetbrains.com/teamcity/) by JetBrains -- [Travis CI](http://travis-ci.org) +| Name | Constant | +|------|----------| +| [AWS CodeBuild](https://aws.amazon.com/codebuild/) | `ci.CODEBUILD` | +| [AppVeyor](http://www.appveyor.com) | `ci.APPVEYOR` | +| [Bamboo](https://www.atlassian.com/software/bamboo) by Atlassian | `ci.BAMBOO` | +| [Bitbucket Pipelines](https://bitbucket.org/product/features/pipelines) | `ci.BITBUCKET` | +| [Buildkite](https://buildkite.com) | `ci.BUILDKITE` | +| [CircleCI](http://circleci.com) | `ci.CIRCLE` | +| [Cirrus CI](https://cirrus-ci.org) | `ci.CIRRUS` | +| [Codeship](https://codeship.com) | `ci.CODESHIP` | +| [Drone](https://drone.io) | `ci.DRONE` | +| [dsari](https://github.com/rfinnie/dsari) | `ci.DSARI` | +| [GitLab CI](https://about.gitlab.com/gitlab-ci/) | `ci.GITLAB` | +| [GoCD](https://www.go.cd/) | `ci.GOCD` | +| [Hudson](http://hudson-ci.org) | `ci.HUDSON` | +| [Jenkins CI](https://jenkins-ci.org) | `ci.JENKINS` | +| [Magnum CI](https://magnum-ci.com) | `ci.MAGNUM` | +| [Semaphore](https://semaphoreci.com) | `ci.SEMAPHORE` | +| [Shippable](https://www.shippable.com/) | `ci.SHIPPABLE` | +| [Solano CI](https://www.solanolabs.com/) | `ci.SOLANO` | +| [Strider CD](https://strider-cd.github.io/) | `ci.STRIDER` | +| [TaskCluster](http://docs.taskcluster.net) | `ci.TASKCLUSTER` | +| [Team Foundation Server](https://www.visualstudio.com/en-us/products/tfs-overview-vs.aspx) by Microsoft | `ci.TFS` | +| [TeamCity](https://www.jetbrains.com/teamcity/) by JetBrains | `ci.TEAMCITY` | +| [Travis CI](http://travis-ci.org) | `ci.TRAVIS` | ## API @@ -76,34 +79,20 @@ boolean to be set to `true` if they use certain vendor neutral environment variables. In those cases `ci.name` will be `null` and no vendor specific boolean will be set to `true`. +### `ci.isPR` + +A boolean if PR detection is supported for the current CI server. Will +be `true` if a PR is being tested. Otherwise `false`. If PR detection is +not supported for the current CI server, the value will be `null`. + ### `ci.` -The following vendor specific boolean constants are exposed. A constant -will be `true` if the code is determined to run on the given CI server. -Otherwise `false`. +A vendor specific boolean constants is exposed for each support CI +vendor. A constant will be `true` if the code is determined to run on +the given CI server. Otherwise `false`. -- `ci.APPVEYOR` -- `ci.BAMBOO` -- `ci.BITBUCKET` -- `ci.BUILDKITE` -- `ci.CIRCLE` -- `ci.CIRRUS` -- `ci.CODEBUILD` -- `ci.CODESHIP` -- `ci.DRONE` -- `ci.GITLAB` -- `ci.GOCD` -- `ci.HUDSON` -- `ci.JENKINS` -- `ci.MAGNUM` -- `ci.SEMAPHORE` -- `ci.SHIPPABLE` -- `ci.SOLANO` -- `ci.STRIDER` -- `ci.TASKCLUSTER` -- `ci.TEAMCITY` -- `ci.TFS` (Team Foundation Server) -- `ci.TRAVIS` +Examples of vendor constants are `ci.TRAVIS` or `ci.APPVEYOR`. For a +complete list, see the support table above. Deprecated vendor constants that will be removed in the next major release: diff --git a/node_modules/ci-info/index.js b/node_modules/ci-info/index.js index 74750a7c0609..7f742f4ed573 100644 --- a/node_modules/ci-info/index.js +++ b/node_modules/ci-info/index.js @@ -1,58 +1,56 @@ 'use strict' -var env = process.env +var vendors = require('./vendors.json') -var vendors = [ - // Constant, Name, Envs - ['APPVEYOR', 'AppVeyor', 'APPVEYOR'], - ['BAMBOO', 'Bamboo', 'bamboo_planKey'], - ['BITBUCKET', 'Bitbucket Pipelines', 'BITBUCKET_COMMIT'], - ['BUILDKITE', 'Buildkite', 'BUILDKITE'], - ['CIRCLE', 'CircleCI', 'CIRCLECI'], - ['CIRRUS', 'Cirrus CI', 'CIRRUS_CI'], - ['CODEBUILD', 'AWS CodeBuild', 'CODEBUILD_BUILD_ARN'], - ['CODESHIP', 'Codeship', {CI_NAME: 'codeship'}], - ['DRONE', 'Drone', 'DRONE'], - ['GITLAB', 'GitLab CI', 'GITLAB_CI'], - ['GOCD', 'GoCD', 'GO_PIPELINE_LABEL'], - ['HUDSON', 'Hudson', 'HUDSON_URL'], - ['JENKINS', 'Jenkins', 'JENKINS_URL', 'BUILD_ID'], - ['MAGNUM', 'Magnum CI', 'MAGNUM'], - ['SEMAPHORE', 'Semaphore', 'SEMAPHORE'], - ['SHIPPABLE', 'Shippable', 'SHIPPABLE'], - ['SOLANO', 'Solano CI', 'TDDIUM'], - ['STRIDER', 'Strider CD', 'STRIDER'], - ['TASKCLUSTER', 'TaskCluster', 'TASK_ID', 'RUN_ID'], - ['TDDIUM', 'Solano CI', 'TDDIUM'], // Deprecated - ['TEAMCITY', 'TeamCity', 'TEAMCITY_VERSION'], - ['TFS', 'Team Foundation Server', 'TF_BUILD'], - ['TRAVIS', 'Travis CI', 'TRAVIS'] -] +var env = process.env // Used for testinging only Object.defineProperty(exports, '_vendors', { - value: vendors.map(function (v) { return v[0] }) + value: vendors.map(function (v) { return v.constant }) }) exports.name = null +exports.isPR = null vendors.forEach(function (vendor) { - var constant = vendor.shift() - var name = vendor.shift() - var isCI = vendor.every(function (obj) { + var envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env] + var isCI = envs.every(function (obj) { if (typeof obj === 'string') return !!env[obj] return Object.keys(obj).every(function (k) { return env[k] === obj[k] }) }) - exports[constant] = isCI - if (isCI) exports.name = name + + exports[vendor.constant] = isCI + + if (isCI) { + exports.name = vendor.name + + if (vendor.pr) { + var val = env[vendor.pr.env] + if (val) { + switch (vendor.pr.type) { + case 'not-false': + exports.isPR = val !== 'false' + break + case 'boolean': + exports.isPR = val === 'true' + break + default: + exports.isPR = true + } + } else { + exports.isPR = false + } + } + } }) exports.isCI = !!( - env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip + env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI env.BUILD_NUMBER || // Jenkins, TeamCity + env.RUN_ID || // TaskCluster, dsari exports.name || false ) diff --git a/node_modules/ci-info/package.json b/node_modules/ci-info/package.json index 6c1f1cadab08..961f89ff33a0 100644 --- a/node_modules/ci-info/package.json +++ b/node_modules/ci-info/package.json @@ -1,29 +1,29 @@ { - "_from": "ci-info@1.4.0", - "_id": "ci-info@1.4.0", + "_from": "ci-info@1.5.1", + "_id": "ci-info@1.5.1", "_inBundle": false, - "_integrity": "sha512-Oqmw2pVfCl8sCL+1QgMywPfdxPJPkC51y4usw0iiE2S9qnEOAqXy8bwl1CpMpnoU39g4iKJTz6QZj+28FvOnjQ==", + "_integrity": "sha512-fKFIKXaYiL1exImwJ0AhR/6jxFPSKQBk2ayV5NiNoruUs2+rxC2kNw0EG+1Z9dugZRdCrppskQ8DN2cyaUM1Hw==", "_location": "/ci-info", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "ci-info@1.4.0", + "raw": "ci-info@1.5.1", "name": "ci-info", "escapedName": "ci-info", - "rawSpec": "1.4.0", + "rawSpec": "1.5.1", "saveSpec": null, - "fetchSpec": "1.4.0" + "fetchSpec": "1.5.1" }, "_requiredBy": [ "#USER", "/", "/is-ci" ], - "_resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.4.0.tgz", - "_shasum": "4841d53cad49f11b827b648ebde27a6e189b412f", - "_spec": "ci-info@1.4.0", - "_where": "/Users/zkat/Documents/code/work/npm", + "_resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.5.1.tgz", + "_shasum": "17e8eb5de6f8b2b6038f0cbb714d410bfa9f3030", + "_spec": "ci-info@1.5.1", + "_where": "/Users/rebecca/code/npm", "author": { "name": "Thomas Watson Steen", "email": "w@tson.dk", @@ -34,15 +34,16 @@ }, "bundleDependencies": false, "coordinates": [ - 55.0113914, - 14.9747494 + 55.778273, + 12.593054 ], "dependencies": {}, "deprecated": false, "description": "Get details about the current Continuous Integration environment", "devDependencies": { "clear-require": "^1.0.1", - "standard": "^11.0.1" + "standard": "^12.0.1", + "tape": "^4.9.1" }, "homepage": "https://github.com/watson/ci-info", "keywords": [ @@ -62,5 +63,5 @@ "scripts": { "test": "standard && node test.js" }, - "version": "1.4.0" + "version": "1.5.1" } diff --git a/node_modules/ci-info/vendors.json b/node_modules/ci-info/vendors.json new file mode 100644 index 000000000000..4c03de95c952 --- /dev/null +++ b/node_modules/ci-info/vendors.json @@ -0,0 +1,131 @@ +[ + { + "name": "AppVeyor", + "constant": "APPVEYOR", + "env": "APPVEYOR", + "pr": { "env": "APPVEYOR_PULL_REQUEST_NUMBER", "type": "string" } + }, + { + "name": "Bamboo", + "constant": "BAMBOO", + "env": "bamboo_planKey" + }, + { + "name": "Bitbucket Pipelines", + "constant": "BITBUCKET", + "env": "BITBUCKET_COMMIT" + }, + { + "name": "Buildkite", + "constant": "BUILDKITE", + "env": "BUILDKITE", + "pr": { "env": "BUILDKITE_PULL_REQUEST", "type": "not-false" } + }, + { + "name": "CircleCI", + "constant": "CIRCLE", + "env": "CIRCLECI", + "pr": { "env": "CIRCLE_PULL_REQUEST", "type": "string" } + }, + { + "name": "Cirrus CI", + "constant": "CIRRUS", + "env": "CIRRUS_CI", + "pr": { "env": "CIRRUS_PR", "type": "string" } + }, + { + "name": "AWS CodeBuild", + "constant": "CODEBUILD", + "env": "CODEBUILD_BUILD_ARN" + }, + { + "name": "Codeship", + "constant": "CODESHIP", + "env": { "CI_NAME": "codeship" } + }, + { + "name": "Drone", + "constant": "DRONE", + "env": "DRONE" + }, + { + "name": "dsari", + "constant": "DSARI", + "env": "DSARI" + }, + { + "name": "GitLab CI", + "constant": "GITLAB", + "env": "GITLAB_CI" + }, + { + "name": "GoCD", + "constant": "GOCD", + "env": "GO_PIPELINE_LABEL" + }, + { + "name": "Hudson", + "constant": "HUDSON", + "env": "HUDSON_URL" + }, + { + "name": "Jenkins", + "constant": "JENKINS", + "env": ["JENKINS_URL", "BUILD_ID"] + }, + { + "name": "Magnum CI", + "constant": "MAGNUM", + "env": "MAGNUM" + }, + { + "name": "Semaphore", + "constant": "SEMAPHORE", + "env": "SEMAPHORE", + "pr": { "env": "PULL_REQUEST_NUMBER", "type": "string" } + }, + { + "name": "Shippable", + "constant": "SHIPPABLE", + "env": "SHIPPABLE", + "pr": { "env": "IS_PULL_REQUEST", "type": "boolean" } + }, + { + "name": "Solano CI", + "constant": "SOLANO", + "env": "TDDIUM", + "pr": { "env": "TDDIUM_PR_ID", "type": "string" } + }, + { + "name": "Strider CD", + "constant": "STRIDER", + "env": "STRIDER" + }, + { + "name": "TaskCluster", + "constant": "TASKCLUSTER", + "env": ["TASK_ID", "RUN_ID"] + }, + { + "name": "Solano CI", + "constant": "TDDIUM", + "env": "TDDIUM", + "deprecated": true + }, + { + "name": "TeamCity", + "constant": "TEAMCITY", + "env": "TEAMCITY_VERSION" + }, + { + "name": "Team Foundation Server", + "constant": "TFS", + "env": "TF_BUILD" + }, + { + "name": "Travis CI", + "constant": "TRAVIS", + "env": "TRAVIS", + "pr": { "env": "TRAVIS_PULL_REQUEST", "type": "not-false" } + } +] diff --git a/package-lock.json b/package-lock.json index 370e25f40486..8aed6ad03bed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -471,9 +471,9 @@ "integrity": "sha1-4qdQQqlVGQi+vSW4Uj1fl2nXkYE=" }, "ci-info": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.4.0.tgz", - "integrity": "sha512-Oqmw2pVfCl8sCL+1QgMywPfdxPJPkC51y4usw0iiE2S9qnEOAqXy8bwl1CpMpnoU39g4iKJTz6QZj+28FvOnjQ==" + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.5.1.tgz", + "integrity": "sha512-fKFIKXaYiL1exImwJ0AhR/6jxFPSKQBk2ayV5NiNoruUs2+rxC2kNw0EG+1Z9dugZRdCrppskQ8DN2cyaUM1Hw==" }, "cidr-regex": { "version": "2.0.9", diff --git a/package.json b/package.json index 42b0433b23d3..93d09edd26e8 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "cacache": "^11.2.0", "call-limit": "~1.1.0", "chownr": "~1.0.1", - "ci-info": "^1.4.0", + "ci-info": "^1.5.1", "cli-columns": "^3.1.2", "cli-table3": "^0.5.0", "cmd-shim": "~2.0.2",