blob: 89e950c151de4eee8482a95b0c6fa2237ec01d1a [file] [log] [blame]
// Copyright 2022 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import * as process from 'process';
const BOT_ENVIRONMENTS = [
'TEST_ONLY_ENV',
'TF_BUILD',
'bamboo.buildKey',
'BUILDKITE',
'CIRCLECI',
'CIRRUS_CI',
'CODEBUILD_BUILD_ID',
'UNITTEST_ON_BORG',
'UNITTEST_ON_FORGE',
'SWARMING_BOT_ID',
'GITHUB_ACTIONS',
'GITLAB_CI',
'HEROKU_TEST_RUN_ID',
'BUILD_ID',
'TEAMCITY_VERSION',
'TRAVIS',
'TEST_ONLY_ENV_END'
];
/**
* See below:
* @returns whether analytics is set to be disabled by envrionment variables
*/
export function isDisabledByEnvironment(): boolean {
return process.env.hasOwnProperty('FUCHSIA_ANALYTICS_DISABLED');
}
/**
* See below:
* @returns whether we are run in a known bot envrionment
*/
export function isRunByBot(): boolean {
for (const botEnv of BOT_ENVIRONMENTS) {
if (process.env.hasOwnProperty(botEnv)) {
return true;
}
}
return false;
}
export const TEST_ONLY = { botEnvrionments: BOT_ENVIRONMENTS };