mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 21:10:22 +00:00
Update telemetry.dart with the most recent environment variables from the flutter tooling. Also: a TODO has been added to check for Azure bot usage.
Change-Id: I2ead645694d599ee393a60db4880c7fa4eb8a3be Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147660 Commit-Queue: Jaime Wren <jwren@google.com> Reviewed-by: Devon Carew <devoncarew@google.com>
This commit is contained in:
parent
383a8ea857
commit
6293c3dfee
|
@ -160,34 +160,63 @@ class _DisabledAnalytics extends AnalyticsMock {
|
|||
/// Detect whether we're running on a bot or in a continuous testing
|
||||
/// environment.
|
||||
///
|
||||
/// We should periodically keep this code up to date with
|
||||
/// https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/base/utils.dart#L20.
|
||||
/// We should periodically keep this code up to date with:
|
||||
/// https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/base/bot_detector.dart#L30
|
||||
/// and
|
||||
/// https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/reporting/usage.dart#L200.
|
||||
bool isRunningOnBot() {
|
||||
final Map<String, String> env = Platform.environment;
|
||||
|
||||
return env['BOT'] != 'false' &&
|
||||
(env['BOT'] == 'true'
|
||||
// https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables
|
||||
if (
|
||||
// Explicitly stated to not be a bot.
|
||||
env['BOT'] == 'false'
|
||||
// Set by the IDEs to the IDE name, so a strong signal that this is not a bot.
|
||||
||
|
||||
env['TRAVIS'] == 'true' ||
|
||||
env['CONTINUOUS_INTEGRATION'] == 'true' ||
|
||||
env.containsKey('CI') // Travis and AppVeyor
|
||||
env.containsKey('FLUTTER_HOST')
|
||||
// When set, GA logs to a local file (normally for tests) so we don't need to filter.
|
||||
||
|
||||
env.containsKey('FLUTTER_ANALYTICS_LOG_FILE')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// https://www.appveyor.com/docs/environment-variables/
|
||||
||
|
||||
env.containsKey('APPVEYOR')
|
||||
return env['BOT'] == 'true'
|
||||
// https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables
|
||||
||
|
||||
env['TRAVIS'] == 'true' ||
|
||||
env['CONTINUOUS_INTEGRATION'] == 'true' ||
|
||||
env.containsKey('CI') // Travis and AppVeyor
|
||||
|
||||
// https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html
|
||||
||
|
||||
(env.containsKey('AWS_REGION') &&
|
||||
env.containsKey('CODEBUILD_INITIATOR'))
|
||||
// https://www.appveyor.com/docs/environment-variables/
|
||||
||
|
||||
env.containsKey('APPVEYOR')
|
||||
|
||||
// https://wiki.jenkins.io/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-belowJenkinsSetEnvironmentVariables
|
||||
||
|
||||
env.containsKey('JENKINS_URL')
|
||||
// https://cirrus-ci.org/guide/writing-tasks/#environment-variables
|
||||
||
|
||||
env.containsKey('CIRRUS_CI')
|
||||
|
||||
// Properties on Flutter's Chrome Infra bots.
|
||||
||
|
||||
env['CHROME_HEADLESS'] == '1' ||
|
||||
env.containsKey('BUILDBOT_BUILDERNAME'));
|
||||
// https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html
|
||||
||
|
||||
(env.containsKey('AWS_REGION') && env.containsKey('CODEBUILD_INITIATOR'))
|
||||
|
||||
// https://wiki.jenkins.io/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-belowJenkinsSetEnvironmentVariables
|
||||
||
|
||||
env.containsKey('JENKINS_URL')
|
||||
|
||||
// https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables
|
||||
||
|
||||
env.containsKey('GITHUB_ACTIONS')
|
||||
|
||||
// Properties on Flutter's Chrome Infra bots.
|
||||
||
|
||||
env['CHROME_HEADLESS'] == '1' ||
|
||||
env.containsKey('BUILDBOT_BUILDERNAME') ||
|
||||
env.containsKey('SWARMING_TASK_ID')
|
||||
|
||||
// Property when running on borg.
|
||||
||
|
||||
env.containsKey('BORG_ALLOC_DIR');
|
||||
|
||||
// TODO(jwren): Azure detection -- each call for this detection requires an
|
||||
// http connection, the flutter cli tool captures the result on the first
|
||||
// run, we should consider the same caching here.
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue