Skip to content

Commit

Permalink
Use access key based authentication for Gradle build cache
Browse files Browse the repository at this point in the history
  • Loading branch information
clayburn committed Feb 22, 2024
1 parent 6c305e1 commit 21ffb8a
Show file tree
Hide file tree
Showing 13 changed files with 3 additions and 21 deletions.
1 change: 0 additions & 1 deletion .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ permissions: read-all
on: [ push, pull_request ]

env:
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
ALLOWED_ENDPOINTS: >
api.adoptium.net:443
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ permissions: read-all
on: [ push, pull_request ]

env:
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
PUBLISH_JDK: 21

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
permissions: read-all

env:
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
ALLOWED_ENDPOINTS: >
*.actions.githubusercontent.com:443
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ permissions:
security-events: write

env:
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
JAVA_VERSION: 11

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/dependency-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
permissions: read-all

env:
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
JAVA_VERSION: 21

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/dependency-submission-pr-retreive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
types: [completed]

env:
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
JAVA_VERSION: 21

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/dependency-submission-pr-submit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ permissions: read-all
on: [ pull_request ]

env:
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
JAVA_VERSION: 21

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/dependency-submission.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ permissions: read-all
on: [ push ]

env:
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
JAVA_VERSION: 21

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ permissions: read-all
on: [ push, pull_request ]

env:
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
JAVA_VERSION: 21

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/qodana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ permissions: read-all
on: [ push, pull_request ]

env:
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
JAVA_VERSION: 11

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
permissions: read-all

env:
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
JAVA_VERSION: 11

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/snyk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
permissions: read-all

env:
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}

jobs:
Expand Down
12 changes: 3 additions & 9 deletions gradle/gradle-enterprise.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,10 @@ gradleEnterprise {

buildCache {
local.enabled = true
remote(HttpBuildCache) {
url = 'https://caffeine.gradle-enterprise.cloud/cache/'
remote(gradleEnterprise.buildCache) {
enabled = true
def cachePassword = settings.ext.find('gradleEnterpriseCachePassword')
?: System.env.GRADLE_ENTERPRISE_CACHE_PASSWORD
def accessKey = System.env.GRADLE_ENTERPRISE_ACCESS_KEY
// Check cache password presence to avoid build cache errors on PR builds when not present
push = System.env.CI && cachePassword
credentials {
username = 'ci'
password = cachePassword
}
push = System.env.CI && accessKey
}
}

0 comments on commit 21ffb8a

Please sign in to comment.