diff --git a/CHANGELOG.md b/CHANGELOG.md index 1aca170..aac578b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2021-03-09: v1.9 🚀 optimize remote build cache with mark push=false + +Previously `read-only` was implemented as "skip saving the caches", +however it makes sense to configure `push=false` so Gradle skips cache entry preparation as well. + ## 2021-03-09: v1.8 🚑 support Gradle 5 Support Gradle 5 (and possibly even earlier versions). diff --git a/cache-action-entrypoint/src/main/kotlin/main.kt b/cache-action-entrypoint/src/main/kotlin/main.kt index 8f1cd0e..9eb5780 100644 --- a/cache-action-entrypoint/src/main/kotlin/main.kt +++ b/cache-action-entrypoint/src/main/kotlin/main.kt @@ -140,6 +140,7 @@ suspend fun mainInternal(stage: ActionStage) { multiCacheVersion = getInput("multi-cache-version").ifBlank { "1.0" }, multiCacheRepository = getInput("multi-cache-repository"), multiCacheGroupIdFilter = getInput("multi-cache-group-id-filter").ifBlank { "com[.]github[.]burrunan[.]multi-?cache" }, + push = !params.readOnly, ), ) } diff --git a/cache-proxy/src/main/kotlin/com/github/burrunan/gradle/proxy/CacheProxy.kt b/cache-proxy/src/main/kotlin/com/github/burrunan/gradle/proxy/CacheProxy.kt index 086128c..2812394 100644 --- a/cache-proxy/src/main/kotlin/com/github/burrunan/gradle/proxy/CacheProxy.kt +++ b/cache-proxy/src/main/kotlin/com/github/burrunan/gradle/proxy/CacheProxy.kt @@ -109,7 +109,8 @@ class CacheProxy { multiCacheEnabled: Boolean = true, multiCacheVersion: String = "1.0", multiCacheRepository: String = "", - multiCacheGroupIdFilter: String = "com[.]github[.]burrunan[.]multi-?cache" + multiCacheGroupIdFilter: String = "com[.]github[.]burrunan[.]multi-?cache", + push: Boolean = true, ): String { val multiCacheGroupIdFilterEscaped = multiCacheGroupIdFilter.replace("\\", "\\\\") //language=Groovy @@ -165,7 +166,7 @@ class CacheProxy { } remote(HttpBuildCache) { url = '$cacheUrl' - push = true + push = $push // Build cache is located on localhost, so it is fine to use http protocol if (gradle6Plus) { allowInsecureProtocol = true