This is an automated email from the ASF dual-hosted git repository.

davidarthur pushed a commit to branch jun-29-enable-remote-gradle-caching
in repository https://gitbox.apache.org/repos/asf/kafka.git

commit 3fee34003a6ce03f876b0d34f1db92a83a2338b4
Author: Clay Johnson <[email protected]>
AuthorDate: Thu Jun 26 15:35:48 2025 -0500

    Enable Gradle remote caching
---
 .github/workflows/build.yml       | 4 ++--
 .github/workflows/ci-complete.yml | 2 +-
 .github/workflows/deflake.yml     | 2 +-
 settings.gradle                   | 7 ++++++-
 4 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index fc5ee1bd755..da1ba0a9e85 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -130,7 +130,7 @@ jobs:
           java-version: 23
           gradle-cache-read-only: ${{ !inputs.is-trunk }}
           gradle-cache-write-only: ${{ inputs.is-trunk }}
-          develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
+          develocity-access-key: ${{ secrets.KAFKA_DEVELOCITY_ACCESS_KEY }}
       - name: Compile and validate
         env:
           SCAN_ARG: ${{ inputs.is-public-fork && '--no-scan' || '--scan' }}
@@ -204,7 +204,7 @@ jobs:
           java-version: ${{ matrix.java }}
           gradle-cache-read-only: ${{ !inputs.is-trunk }}
           gradle-cache-write-only: ${{ inputs.is-trunk }}
-          develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
+          develocity-access-key: ${{ secrets.KAFKA_DEVELOCITY_ACCESS_KEY }}
 
       # If the load-catalog job failed, we won't be able to download the 
artifact. Since we don't want this to fail
       # the overall workflow, so we'll continue here without a test catalog.
diff --git a/.github/workflows/ci-complete.yml 
b/.github/workflows/ci-complete.yml
index 8855c998df2..4b8b7c36b00 100644
--- a/.github/workflows/ci-complete.yml
+++ b/.github/workflows/ci-complete.yml
@@ -69,7 +69,7 @@ jobs:
         uses: ./.github/actions/setup-gradle
         with:
           java-version: ${{ matrix.java }}
-          develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
+          develocity-access-key: ${{ secrets.KAFKA_DEVELOCITY_ACCESS_KEY }}
       - name: Download build scan archive
         id: download-build-scan
         uses: actions/download-artifact@v4
diff --git a/.github/workflows/deflake.yml b/.github/workflows/deflake.yml
index f58408a0473..a0534a851ee 100644
--- a/.github/workflows/deflake.yml
+++ b/.github/workflows/deflake.yml
@@ -54,7 +54,7 @@ jobs:
         with:
           java-version: ${{ inputs.java-version }}
           gradle-cache-read-only: true
-          develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
+          develocity-access-key: ${{ secrets.KAFKA_DEVELOCITY_ACCESS_KEY }}
 
       - name: Test
         timeout-minutes: 60
diff --git a/settings.gradle b/settings.gradle
index 906ea1f8f7d..1614948e195 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -59,7 +59,12 @@ buildCache {
     }
 
     remote(develocity.buildCache) {
-        enabled = false
+        enabled = true
+
+        // Check for the presence of the DEVELOCITY_ACCESS_KEY environment 
variable as a proxy for whether this is a fork or not.
+        // Forks should not try to push to the remote cache as they will not 
have permission to do so.
+        def accessKey = System.getenv('DEVELOCITY_ACCESS_KEY')
+        push = isGithubActions && accessKey
     }
 }
 

Reply via email to