Publish a build scan only if authenticated

Previously, anyone could publish a scan and publishing was performed
if the GRADLE_ENTERPRISE_URL environment variable was set.

ge.spring.io has now been locked down to prohibit anonymous build scan
publishing. This commit aligns with this change by only attempting to
publish a build scan when authenticated with the server.

Authentication is achieved via an access token that is made available
via an environment variable on CI and locally via a file in ~/.gradle.

One can obtain an access key by running the following command:

./gradlew provisionGradleEnterpriseAccessKey

Closes gh-24371
This commit is contained in:
Andy Wilkinson 2020-01-16 10:26:36 +00:00 committed by Sam Brannen
parent e864409c5f
commit 61d9787b98
1 changed files with 2 additions and 1 deletions

View File

@ -17,7 +17,8 @@ buildScan {
obfuscation {
ipAddresses { addresses -> addresses.collect { address -> '0.0.0.0'} }
}
publishAlwaysIf(System.getenv('GRADLE_ENTERPRISE_URL') != null)
publishAlways()
publishIfAuthenticated()
server = 'https://ge.spring.io'
}