25
25
26
26
from __future__ import annotations
27
27
28
+ import os
28
29
import platform
29
30
from urllib .parse import urlencode
30
31
@@ -43,6 +44,10 @@ def usage_data_collection():
43
44
if _version_is_prerelease (airflow_version ):
44
45
return
45
46
47
+ # Exclude CI environments
48
+ if _is_ci_environ ():
49
+ return
50
+
46
51
scarf_domain = "https://apacheairflow.gateway.scarf.sh/scheduler"
47
52
48
53
try :
@@ -70,6 +75,26 @@ def _version_is_prerelease(version: str) -> bool:
70
75
return parse (version ).is_prerelease
71
76
72
77
78
+ def _is_ci_environ () -> bool :
79
+ """Return True if running in any known CI environment."""
80
+ if os .getenv ("CI" ) == "true" :
81
+ # Generic CI variable set by many CI systems (GH Actions, Travis, GitLab, CircleCI, Jenkins, Heroku)
82
+ return True
83
+
84
+ # Other CI variables set by specific CI systems
85
+ ci_env_vars = {
86
+ "CIRCLECI" , # CircleCI
87
+ "CODEBUILD_BUILD_ID" , # AWS CodeBuild
88
+ "GITHUB_ACTIONS" , # GitHub Actions
89
+ "GITLAB_CI" , # GitLab CI
90
+ "JENKINS_URL" , # Jenkins
91
+ "TF_BUILD" , # Azure Pipelines
92
+ "TRAVIS" , # Travis CI
93
+ }
94
+
95
+ return any (var in os .environ for var in ci_env_vars )
96
+
97
+
73
98
def get_platform_info () -> tuple [str , str ]:
74
99
return platform .system (), platform .machine ()
75
100
0 commit comments