From 2f68fe8e55a55adcf3ea1bbbbd5b1883e6de9188 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Fri, 5 Jan 2024 10:44:30 +0100 Subject: [PATCH 1/2] Only push to remote build cache when access key is present --- settings.gradle.kts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/settings.gradle.kts b/settings.gradle.kts index 30c7882b..25d6db56 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -44,7 +44,8 @@ buildCache { if (ciTeamCityBuild) { remote(gradleEnterprise.buildCache) { isEnabled = true - isPush = true + def accessKey = System.getenv("GRADLE_ENTERPRISE_ACCESS_KEY") + isPush = accessKey server = System.getenv("GRADLE_CACHE_REMOTE_URL") } } From 1d56b014c765cb9cb33151b251cf6afc444cd951 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Fri, 5 Jan 2024 10:49:21 +0100 Subject: [PATCH 2/2] Edit for kts --- settings.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/settings.gradle.kts b/settings.gradle.kts index 25d6db56..70fc722b 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -44,8 +44,8 @@ buildCache { if (ciTeamCityBuild) { remote(gradleEnterprise.buildCache) { isEnabled = true - def accessKey = System.getenv("GRADLE_ENTERPRISE_ACCESS_KEY") - isPush = accessKey + val accessKey = System.getenv("GRADLE_ENTERPRISE_ACCESS_KEY") + isPush = !accessKey.isNullOrEmpty() server = System.getenv("GRADLE_CACHE_REMOTE_URL") } }