[Build] Add a property to disable usernames obfuscation for build scans
The property is `kotlin.build.scan.obfuscate.username`
This commit is contained in:
committed by
Space Team
parent
ebef67ea6a
commit
19073b96a7
+10
-3
@@ -6,7 +6,6 @@ plugins {
|
|||||||
val buildProperties = getKotlinBuildPropertiesForSettings(settings)
|
val buildProperties = getKotlinBuildPropertiesForSettings(settings)
|
||||||
|
|
||||||
val buildScanServer = buildProperties.buildScanServer
|
val buildScanServer = buildProperties.buildScanServer
|
||||||
val isTeamCity = buildProperties.isTeamcityBuild
|
|
||||||
|
|
||||||
if (buildProperties.buildScanServer != null) {
|
if (buildProperties.buildScanServer != null) {
|
||||||
plugins.apply("com.gradle.common-custom-user-data-gradle-plugin")
|
plugins.apply("com.gradle.common-custom-user-data-gradle-plugin")
|
||||||
@@ -29,11 +28,19 @@ gradleEnterprise {
|
|||||||
termsOfServiceAgree = "yes"
|
termsOfServiceAgree = "yes"
|
||||||
}
|
}
|
||||||
|
|
||||||
val username = if (isTeamCity) "TeamCity" else "concealed"
|
val overridenName = (buildProperties.getOrNull("kotlin.build.scan.username") as? String)?.trim()
|
||||||
|
val isTeamCity = buildProperties.isTeamcityBuild
|
||||||
obfuscation {
|
obfuscation {
|
||||||
ipAddresses { _ -> listOf("0.0.0.0") }
|
ipAddresses { _ -> listOf("0.0.0.0") }
|
||||||
hostname { _ -> "concealed" }
|
hostname { _ -> "concealed" }
|
||||||
username { _ -> username }
|
username { originalUsername ->
|
||||||
|
when {
|
||||||
|
isTeamCity -> "TeamCity"
|
||||||
|
overridenName == null || overridenName.isEmpty() -> "concealed"
|
||||||
|
overridenName == "<default>" -> originalUsername
|
||||||
|
else -> overridenName
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user