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.

Comment From: wilkinsona

Please hold off on merging this. publishIfAuthenticated() does not appear to work as intended.

Comment From: wilkinsona

This is now ready to merge. If you want local builds to publish scans, you can obtain an access key by running ./gradlew provisionGradleEnterpriseAccessKey.

Comment From: sbrannen

This has been merged into master.

Thanks

Comment From: snicoll

@wilkinsona should the command above be invoked for every project or running it once is enough?

Comment From: wilkinsona

Once is enough for us as every project points to ge.spring.io.

Comment From: sbrannen

The instructions for that command are here.

./gradlew provisionGradleEnterpriseAccessKey adds an entry to ~/.gradle/enterprise/keys.properties for the corresponding server, in our case ge.spring.io=....

So it looks like we just need to do that once locally for all Spring projects using that server.

Comment From: etiennestuder

So it looks like we just need to do that once locally for all Spring projects using that server.

Yes, I can confirm that.