Skip to content

Commit 6b375eb

Browse files
Remove naughty use of transitive ci-info dependency
1 parent 48d8c70 commit 6b375eb

2 files changed

Lines changed: 34 additions & 6 deletions

File tree

index.js

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,39 @@ const {warnIfUsingSecretsWithoutTheBrefDependency} = require('./plugin/secrets')
77
const fs = require('fs');
88
const path = require('path');
99

10+
const ciEnvironmentVariables = [
11+
'BUILD_ID', // Jenkins, Cloudbees
12+
'BUILD_NUMBER', // Jenkins, TeamCity
13+
'CI', // Travis CI, CircleCI, GitLab CI, etc.
14+
'CI_APP_ID', // Appflow
15+
'CI_BUILD_ID', // Appflow
16+
'CI_BUILD_NUMBER', // Appflow
17+
'CI_NAME', // Codeship and others
18+
'CONTINUOUS_INTEGRATION', // Travis CI, Cirrus CI
19+
'RUN_ID', // TaskCluster, dsari
20+
'GITHUB_ACTIONS',
21+
'GITLAB_CI',
22+
'CIRCLECI',
23+
'TRAVIS',
24+
'APPVEYOR',
25+
'BUILDKITE',
26+
'CODEBUILD_BUILD_ARN',
27+
'TF_BUILD', // Azure Pipelines
28+
'TEAMCITY_VERSION',
29+
'JENKINS_URL',
30+
'BITBUCKET_COMMIT',
31+
'DRONE',
32+
'NETLIFY',
33+
'VERCEL',
34+
'CF_PAGES', // Cloudflare Pages
35+
'RENDER',
36+
'BITRISE_IO',
37+
];
38+
39+
function isCiEnvironment(env) {
40+
return env.CI !== 'false' && ciEnvironmentVariables.some((name) => Boolean(env[name]));
41+
}
42+
1043
// Disable `sls` promoting the Serverless Console because it's not compatible with PHP, it's tripping users up
1144
if (!process.env.SLS_NOTIFICATIONS_MODE) {
1245
process.env.SLS_NOTIFICATIONS_MODE = 'upgrades-only';
@@ -281,10 +314,6 @@ class ServerlessPlugin {
281314
/** @type {{ get: (string) => string }} */
282315
// @ts-ignore
283316
const userConfig = require.main.require('@serverless/utils/config');
284-
/** @type {typeof import('ci-info')} */
285-
// @ts-ignore
286-
const ci = require.main.require('ci-info');
287-
288317
let command = 'unknown';
289318
if (this.serverless.processedInput && this.serverless.processedInput.commands) {
290319
command = this.serverless.processedInput.commands.join(' ');
@@ -301,7 +330,7 @@ class ServerlessPlugin {
301330
cli: 'sls',
302331
v: 2, // Bref version
303332
c: command,
304-
ci: ci.isCI,
333+
ci: isCiEnvironment(process.env),
305334
install: userConfig.get('meta.created_at'),
306335
uid: userConfig.get('frameworkId'), // anonymous user ID created by the Serverless Framework
307336
tz: timezone,

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
},
77
"devDependencies": {
88
"@serverless/typescript": "^3.30.1",
9-
"@types/ci-info": "^3.1.0",
109
"@types/node": "^20.3.1",
1110
"@typescript-eslint/eslint-plugin": "^5.59.11",
1211
"@typescript-eslint/parser": "^5.59.11",

0 commit comments

Comments
 (0)