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 MAESTRO_CLI_NO_ANALYTICS flag #1848

Merged
merged 6 commits into from
Jul 30, 2024
Merged

Add MAESTRO_CLI_NO_ANALYTICS flag #1848

merged 6 commits into from
Jul 30, 2024

Conversation

bartekpacia
Copy link
Member

fix #1846

@@ -73,6 +77,13 @@ object Analytics {
fun maybeAskToEnableAnalytics() {
if (hasRunBefore) return

// Fix for https://github.com/mobile-dev-inc/maestro/issues/1846
if (CiUtils.getCiProvider() != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's maybe give DISABLE_ANALYTICS_ENV_VAR false by default if its CI?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only need analytics if user is sourcing from CLI

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure? We set uuid to name of the CI service if we're running on CI:

private fun generateUUID(): String {
return CiUtils.getCiProvider() ?: UUID.randomUUID().toString()
}

which then gets uploaded to our backend:

I think it can be useful knowledge to know what CI service is most used*, so we would have some data if we will have to build integrations with CIs in the future.


*A problem here may be that we don't have UUIDs of specific CI installations. We would need to have separate "UUID" and "CI" values in the AnalyticsReport.

// AnalyticsReport must match equivalent monorepo model in:
// mobile.dev/api/models/src/main/java/models/maestro/AnalyticsReport.kt
@JsonIgnoreProperties(ignoreUnknown = true)
data class AnalyticsReport(
@JsonProperty("deviceUuid") val uuid: String,
@JsonProperty("freshInstall") val freshInstall: Boolean,
@JsonProperty("version") val cliVersion: String,
@JsonProperty("os") val os: String,
@JsonProperty("osArch") val osArch: String,
@JsonProperty("osVersion") val osVersion: String,
@JsonProperty("javaVersion") val javaVersion: String?,
@JsonProperty("xcodeVersion") val xcodeVersion: String?,
@JsonProperty("flutterVersion") val flutterVersion: String?,
@JsonProperty("flutterChannel") val flutterChannel: String?,
@JsonProperty("androidVersions") val androidVersions: List<String>,
@JsonProperty("iosVersions") val iosVersions: List<String>,
)

Otherwise analytics from various runs on CI get merged together.

@bartekpacia bartekpacia merged commit 0cd8bc1 into main Jul 30, 2024
4 checks passed
@bartekpacia bartekpacia deleted the fix/analytics_on_ci branch July 30, 2024 10:02
Copy link

Make sure to run ./maestro-ios-xctest-runner/build-maestro-ios-runner.sh with every swift change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CICD asks for analytics, no way to opt out
2 participants