Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI environment variables to user-agent #249

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions AUTHORS
Expand Up @@ -656,3 +656,5 @@ Olivier Chevet <olivr70@outlook.fr>
Maël Nison <nison.mael@gmail.com>
Sara Ahbabou <ahbabousara@gmail.com>
Gareth Jones <Jones258@Gmail.com>
Ruy Adorno <ruyadorno@hotmail.com>
Michael Perrotte <mike@npmjs.com>
24 changes: 24 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,27 @@
## 6.12.0 (2019-10-01):

Now `npm ci` runs prepare scripts for git dependencies, and respects the `--no-optional` argument.

### BUG FIXES

* [`890b245dc`](https://github.com/npm/cli/commit/890b245dc1f609590d8ab993fac7cf5a37ed46a5)
[#252](https://github.com/npm/cli/pull/252)
chore(ci): add dirPacker to options
([@claudiahdz](https://github.com/claudiahdz))

### DEPENDENCIES

* [`0ca063c5d`](https://github.com/npm/cli/commit/0ca063c5dc961c4aa17373f4b33fb54c51c8c8d6)
`npm-lifecycle@3.1.4`:
- fix: filter functions and undefined out of makeEnv ([@isaacs](https://github.com/isaacs))
* [`5df6b0ea2`](https://github.com/npm/cli/commit/5df6b0ea2e3106ba65bba649cc8d7f02f4738236)
`libcipm@4.0.4`:
- fix: pack git directories properly ([@claudiahdz](https://github.com/claudiahdz))
- respect no-optional argument ([@cruzdanilo](https://github.com/cruzdanilo))
* [`7e04f728c`](https://github.com/npm/cli/commit/7e04f728cc4cd4853a8fc99e2df0a12988897589)
`tar@4.4.12`


## 6.11.3 (2019-09-03):

Fix npm ci regressions and npm outdated depth.
Expand Down
4 changes: 3 additions & 1 deletion lib/ci.js
Expand Up @@ -4,6 +4,7 @@ const npm = require('./npm.js')
const Installer = require('libcipm')
const log = require('npmlog')
const path = require('path')
const pack = require('./pack.js')

ci.usage = 'npm ci'

Expand All @@ -27,7 +28,8 @@ function ci (args, cb) {
fmode: npm.modes.file,
umask: npm.modes.umask,
npmVersion: npm.version,
tmp: npm.tmp
tmp: npm.tmp,
dirPacker: pack.packGitDep
}

for (const key in npm.config.list[0]) {
Expand Down
3 changes: 2 additions & 1 deletion lib/config/defaults.js
Expand Up @@ -201,7 +201,8 @@ Object.defineProperty(exports, 'defaults', {get: function () {
'user-agent': 'npm/{npm-version} ' +
'node/{node-version} ' +
'{platform} ' +
'{arch}',
'{arch} ' +
'{ci}',
'read-only': false,
'rebuild-bundle': true,
registry: 'https://registry.npmjs.org/',
Expand Down
22 changes: 21 additions & 1 deletion lib/npm.js
Expand Up @@ -281,7 +281,27 @@
ua = ua.replace(/\{npm-version\}/gi, npm.version)
ua = ua.replace(/\{platform\}/gi, process.platform)
ua = ua.replace(/\{arch\}/gi, process.arch)
config.set('user-agent', ua)

// continuous integration platforms
const ci = process.env.GERRIT_PROJECT ? 'ci/gerrit'
: process.env.GITLAB_CI ? 'ci/gitlab'
: process.env.CIRCLECI ? 'ci/circle-ci'
: process.env.SEMAPHORE ? 'ci/semaphore'
: process.env.DRONE ? 'ci/drone'
: process.env.GITHUB_ACTION ? 'ci/github-actions'
: process.env.TDDIUM ? 'ci/tddium'
: process.env.JENKINS_URL ? 'ci/jenkins'
: process.env['bamboo.buildKey'] ? 'ci/bamboo'
: process.env.GO_PIPELINE_NAME ? 'ci/gocd'
// codeship and a few others
: process.env.CI_NAME ? `ci/${process.env.CI_NAME}`
// test travis last, since many of these mimic it
: process.env.TRAVIS ? 'ci/travis-ci'
: process.env.CI === 'true' || process.env.CI === '1' ? 'ci/custom'
: ''
ua = ua.replace(/\{ci\}/gi, ci)

config.set('user-agent', ua.trim())

if (config.get('metrics-registry') == null) {
config.set('metrics-registry', config.get('registry'))
Expand Down
1 change: 0 additions & 1 deletion lib/token.js
Expand Up @@ -118,7 +118,6 @@ function config () {
})
} else {
conf = conf.concat({ auth: {} })
conf.auth = {}
}
if (conf.otp) conf.auth.otp = conf.otp
return conf
Expand Down
1 change: 1 addition & 0 deletions node_modules/fs-minipass/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.