1# ci-info 2 3Get details about the current Continuous Integration environment. 4 5Please [open an 6issue](https://github.com/watson/ci-info/issues/new?template=ci-server-not-detected.md) 7if your CI server isn't properly detected :) 8 9[](https://www.npmjs.com/package/ci-info) 10[](https://travis-ci.org/watson/ci-info) 11[](https://github.com/feross/standard) 12 13## Installation 14 15```bash 16npm install ci-info --save 17``` 18 19## Usage 20 21```js 22var ci = require('ci-info') 23 24if (ci.isCI) { 25 console.log('The name of the CI server is:', ci.name) 26} else { 27 console.log('This program is not running on a CI server') 28} 29``` 30 31## Supported CI tools 32 33Officially supported CI servers: 34 35| Name | Constant | 36|------|----------| 37| [AWS CodeBuild](https://aws.amazon.com/codebuild/) | `ci.CODEBUILD` | 38| [AppVeyor](http://www.appveyor.com) | `ci.APPVEYOR` | 39| [Bamboo](https://www.atlassian.com/software/bamboo) by Atlassian | `ci.BAMBOO` | 40| [Bitbucket Pipelines](https://bitbucket.org/product/features/pipelines) | `ci.BITBUCKET` | 41| [Bitrise](https://www.bitrise.io/) | `ci.BITRISE` | 42| [Buddy](https://buddy.works/) | `ci.BUDDY` | 43| [Buildkite](https://buildkite.com) | `ci.BUILDKITE` | 44| [CircleCI](http://circleci.com) | `ci.CIRCLE` | 45| [Cirrus CI](https://cirrus-ci.org) | `ci.CIRRUS` | 46| [Codeship](https://codeship.com) | `ci.CODESHIP` | 47| [Drone](https://drone.io) | `ci.DRONE` | 48| [dsari](https://github.com/rfinnie/dsari) | `ci.DSARI` | 49| [GitLab CI](https://about.gitlab.com/gitlab-ci/) | `ci.GITLAB` | 50| [GoCD](https://www.go.cd/) | `ci.GOCD` | 51| [Hudson](http://hudson-ci.org) | `ci.HUDSON` | 52| [Jenkins CI](https://jenkins-ci.org) | `ci.JENKINS` | 53| [Magnum CI](https://magnum-ci.com) | `ci.MAGNUM` | 54| [Sail CI](https://sail.ci/) | `ci.SAIL` | 55| [Semaphore](https://semaphoreci.com) | `ci.SEMAPHORE` | 56| [Shippable](https://www.shippable.com/) | `ci.SHIPPABLE` | 57| [Solano CI](https://www.solanolabs.com/) | `ci.SOLANO` | 58| [Strider CD](https://strider-cd.github.io/) | `ci.STRIDER` | 59| [TaskCluster](http://docs.taskcluster.net) | `ci.TASKCLUSTER` | 60| [Team Foundation Server](https://www.visualstudio.com/en-us/products/tfs-overview-vs.aspx) by Microsoft | `ci.TFS` | 61| [TeamCity](https://www.jetbrains.com/teamcity/) by JetBrains | `ci.TEAMCITY` | 62| [Travis CI](http://travis-ci.org) | `ci.TRAVIS` | 63 64## API 65 66### `ci.name` 67 68A string. Will contain the name of the CI server the code is running on. 69If not CI server is detected, it will be `null`. 70 71Don't depend on the value of this string not to change for a specific 72vendor. If you find your self writing `ci.name === 'Travis CI'`, you 73most likely want to use `ci.TRAVIS` instead. 74 75### `ci.isCI` 76 77A boolean. Will be `true` if the code is running on a CI server. 78Otherwise `false`. 79 80Some CI servers not listed here might still trigger the `ci.isCI` 81boolean to be set to `true` if they use certain vendor neutral 82environment variables. In those cases `ci.name` will be `null` and no 83vendor specific boolean will be set to `true`. 84 85### `ci.isPR` 86 87A boolean if PR detection is supported for the current CI server. Will 88be `true` if a PR is being tested. Otherwise `false`. If PR detection is 89not supported for the current CI server, the value will be `null`. 90 91### `ci.<VENDOR-CONSTANT>` 92 93A vendor specific boolean constants is exposed for each support CI 94vendor. A constant will be `true` if the code is determined to run on 95the given CI server. Otherwise `false`. 96 97Examples of vendor constants are `ci.TRAVIS` or `ci.APPVEYOR`. For a 98complete list, see the support table above. 99 100Deprecated vendor constants that will be removed in the next major 101release: 102 103- `ci.TDDIUM` (Solano CI) This have been renamed `ci.SOLANO` 104 105## License 106 107[MIT](LICENSE) 108