Skip to content

Commit d1a65ae

Browse files
authored
Fix flaky opampProtoDownload (#2454)
1 parent 20591cd commit d1a65ae

File tree

6 files changed

+15
-1
lines changed

6 files changed

+15
-1
lines changed

.github/workflows/build-common.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ jobs:
5959
run: ./gradlew build -x spotlessCheck -x test ${{ inputs.no-build-cache && '--no-build-cache' || '' }}
6060
env:
6161
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
62+
GITHUB_TOKEN: ${{ github.token }}
6263

6364
- name: Check for jApiCmp diffs
6465
# The jApiCmp diff compares current to latest, which isn't appropriate for release branches
@@ -123,6 +124,7 @@ jobs:
123124
${{ inputs.no-build-cache && '--no-build-cache' || '' }}
124125
env:
125126
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
127+
GITHUB_TOKEN: ${{ github.token }}
126128

127129
- name: Build scan
128130
if: ${{ !cancelled() && hashFiles('build-scan.txt') != '' }}

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@ jobs:
4646
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
4747
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
4848
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
49+
GITHUB_TOKEN: ${{ github.token }}

.github/workflows/codeql.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ jobs:
6565
run: ./gradlew assemble --no-build-cache --no-daemon
6666
env:
6767
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
68+
GITHUB_TOKEN: ${{ github.token }}
6869

6970
- name: Perform CodeQL analysis
7071
uses: github/codeql-action/analyze@014f16e7ab1402f30e7c3329d33797e7948572db # v4.31.3

.github/workflows/copilot-setup-steps.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@ jobs:
3434
run: ./gradlew build -x test
3535
env:
3636
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
37+
GITHUB_TOKEN: ${{ github.token }}

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ jobs:
100100
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
101101
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
102102
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
103+
GITHUB_TOKEN: ${{ github.token }}
103104

104105
- name: Download artifacts from Maven Central (when already published)
105106
if: ${{ inputs.already-published }}
@@ -244,6 +245,7 @@ jobs:
244245
VERSION: ${{ needs.release.outputs.version }}
245246
PRIOR_VERSION: ${{ needs.release.outputs.prior-version }}
246247
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
248+
GITHUB_TOKEN: ${{ github.token }}
247249
run: |
248250
./gradlew japicmp -PapiBaseVersion=$PRIOR_VERSION -PapiNewVersion=$VERSION
249251
./gradlew --refresh-dependencies japicmp

opamp-client/build.gradle.kts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,14 @@ abstract class DownloadAndExtractOpampProtos @Inject constructor(
6767
val url = URI.create(zipUrl.get()).toURL()
6868
downloadedZipFile.get().asFile.parentFile.mkdirs()
6969

70-
url.openStream().use { input: InputStream ->
70+
val connection = url.openConnection()
71+
// Use GitHub token if available to avoid rate limiting
72+
val githubToken = System.getenv("GITHUB_TOKEN")
73+
if (githubToken != null && githubToken.isNotEmpty()) {
74+
connection.setRequestProperty("Authorization", "Bearer $githubToken")
75+
}
76+
77+
connection.getInputStream().use { input: InputStream ->
7178
downloadedZipFile.get().asFile.outputStream().use { output: FileOutputStream ->
7279
input.copyTo(output)
7380
}

0 commit comments

Comments
 (0)