Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/repository-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ private admin repo.

- `GPG_PASSWORD` - stored in OpenTelemetry-Java 1Password
- `GPG_PRIVATE_KEY` - stored in OpenTelemetry-Java 1Password
- `DEVELOCITY_ACCESS_KEY` - owned by [@trask](https://github.com/trask)
- Generated at https://develocity.opentelemetry.io > My settings > Access keys
- Format of env var is `develocity.opentelemetry.io=<access key>`,
see [docs](https://docs.gradle.com/enterprise/gradle-plugin/#via_environment_variable)
- `GRADLE_PUBLISH_KEY`
- `GRADLE_PUBLISH_SECRET`
- `NVD_API_KEY` - stored in OpenTelemetry-Java 1Password
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/build-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ on:
type: boolean
required: false
secrets:
DEVELOCITY_ACCESS_KEY:
required: false
FLAKY_TEST_REPORTER_ACCESS_KEY:
required: false

Expand Down Expand Up @@ -43,6 +45,8 @@ jobs:
cache-read-only: ${{ inputs.cache-read-only }}

- name: Spotless
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
run: ./gradlew spotlessCheck ${{ inputs.no-build-cache && '--no-build-cache' || '' }}

license-check:
Expand All @@ -65,6 +69,8 @@ jobs:
cache-read-only: ${{ inputs.cache-read-only }}

- name: Generate license report
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
# with the build cache enabled occasionally produces outdated results
run: ./gradlew generateLicenseReport --no-build-cache

Expand Down Expand Up @@ -192,6 +198,8 @@ jobs:
cache-read-only: ${{ inputs.cache-read-only }}

- name: Build
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
run: ./gradlew check javadoc sourcesJar spdxSbom -x spotlessCheck -PskipTests=true ${{ inputs.no-build-cache && '--no-build-cache' || '' }}

- name: Check for jApiCmp diffs
Expand Down Expand Up @@ -296,6 +304,8 @@ jobs:
cache-read-only: ${{ inputs.cache-read-only || matrix.test-java-version != 11 || matrix.vm != 'hotspot' }}

- name: List tests
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
# "check" is needed to activate all tests for listing purposes
# listTestsInPartition writes test tasks that apply to the given partition to a file named
# "test-tasks.txt" and then disables all tasks (including tests) after it runs
Expand All @@ -310,6 +320,8 @@ jobs:
echo "test-tasks=$(cat test-tasks.txt | xargs echo | sed 's/\n/ /g')" >> $GITHUB_ENV

- name: Test
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
# spotless is checked separately since it's a common source of failure
run: >
./gradlew
Expand Down Expand Up @@ -432,11 +444,15 @@ jobs:
cache-read-only: ${{ inputs.cache-read-only || matrix.smoke-test-suite != 'tomcat' }}

- name: Build
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
# running suite "none" compiles everything needed by smoke tests without executing any tests
# --no-daemon is used to free up the memory from the build step before running the test step below
run: ./gradlew :smoke-tests:test -PsmokeTestSuite=none --no-daemon ${{ inputs.no-build-cache && ' --no-build-cache' || '' }}

- name: Test
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
run: ./gradlew :smoke-tests:test -PsmokeTestSuite=${{ matrix.smoke-test-suite }} ${{ inputs.no-build-cache && ' --no-build-cache' || '' }}

- name: Build scan
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build-daily-no-build-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ jobs:
with:
no-build-cache: true
secrets:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
FLAKY_TEST_REPORTER_ACCESS_KEY: ${{ secrets.FLAKY_TEST_REPORTER_ACCESS_KEY }}

test-latest-deps:
uses: ./.github/workflows/reusable-test-latest-deps.yml
with:
no-build-cache: true
secrets:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
FLAKY_TEST_REPORTER_ACCESS_KEY: ${{ secrets.FLAKY_TEST_REPORTER_ACCESS_KEY }}

# muzzle is not included here because it doesn't use gradle cache anyway and so is already covered
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build-daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ jobs:
common:
uses: ./.github/workflows/build-common.yml
secrets:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
FLAKY_TEST_REPORTER_ACCESS_KEY: ${{ secrets.FLAKY_TEST_REPORTER_ACCESS_KEY }}

test-latest-deps:
uses: ./.github/workflows/reusable-test-latest-deps.yml
secrets:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
FLAKY_TEST_REPORTER_ACCESS_KEY: ${{ secrets.FLAKY_TEST_REPORTER_ACCESS_KEY }}

muzzle:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
common:
uses: ./.github/workflows/build-common.yml
secrets:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
FLAKY_TEST_REPORTER_ACCESS_KEY: ${{ secrets.FLAKY_TEST_REPORTER_ACCESS_KEY }}

test-latest-deps:
Expand All @@ -23,6 +24,7 @@ jobs:
if: "!startsWith(github.ref_name, 'release/')"
uses: ./.github/workflows/reusable-test-latest-deps.yml
secrets:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
FLAKY_TEST_REPORTER_ACCESS_KEY: ${{ secrets.FLAKY_TEST_REPORTER_ACCESS_KEY }}

muzzle:
Expand Down Expand Up @@ -80,6 +82,7 @@ jobs:

- name: Build and publish artifact snapshots
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
Expand All @@ -88,6 +91,7 @@ jobs:

- name: Build and publish gradle plugin snapshots
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/reusable-test-latest-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ on:
type: boolean
required: false
secrets:
DEVELOCITY_ACCESS_KEY:
required: false
FLAKY_TEST_REPORTER_ACCESS_KEY:
required: false

Expand Down Expand Up @@ -60,6 +62,8 @@ jobs:
cache-read-only: ${{ inputs.cache-read-only }}

- name: List tests
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
run: >
./gradlew
check -x spotlessCheck
Expand All @@ -72,6 +76,8 @@ jobs:
echo "test-tasks=$(cat test-tasks.txt | xargs echo | sed 's/\n/ /g')" >> $GITHUB_ENV

- name: Test
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
run: >
./gradlew
${{ env.test-tasks }}
Expand Down
68 changes: 57 additions & 11 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ plugins {
// ./gradlew :smoke-tests:images:servlet:buildLinuxTestImages pushMatrix -PsmokeTestServer=jetty
// ./gradlew :smoke-tests:images:servlet:buildWindowsTestImages pushMatrix -PsmokeTestServer=jetty
id("com.bmuschko.docker-remote-api") version "9.4.0" apply false
id("com.gradle.develocity") version "4.2.2"
id("com.gradle.develocity") version "4.2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is fine, renovate will update this again anyway

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, yeah, will let renovate handle it

}

dependencyResolutionManagement {
Expand All @@ -47,21 +47,67 @@ dependencyResolutionManagement {
}
}

develocity {
buildScan {
publishing.onlyIf { System.getenv("CI") != null }
termsOfUseUrl.set("https://gradle.com/help/legal-terms-of-use")
termsOfUseAgree.set("yes")
val develocityServer = "https://develocity.opentelemetry.io"
val isCI = System.getenv("CI") != null
val develocityAccessKey = System.getenv("DEVELOCITY_ACCESS_KEY") ?: ""

if (!gradle.startParameter.taskNames.contains("listTestsInPartition") &&
!gradle.startParameter.taskNames.contains(":test-report:reportFlakyTests")) {
buildScanPublished {
File("build-scan.txt").printWriter().use { writer ->
writer.println(buildScanUri)
// if develocity access key is not given and we are in CI, then we publish to scans.gradle.com
val useScansGradleCom = isCI && develocityAccessKey.isEmpty()

if (useScansGradleCom) {
develocity {
buildScan {
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
termsOfUseAgree = "yes"
uploadInBackground = !isCI

capture {
fileFingerprints = true
}

if (!gradle.startParameter.taskNames.contains("listTestsInPartition") &&
!gradle.startParameter.taskNames.contains(":test-report:reportFlakyTests")) {
buildScanPublished {
File("build-scan.txt").printWriter().use { writer ->
writer.println(buildScanUri)
}
}
}
Copy link
Contributor

@laurit laurit Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this block is repeated in both branches. As a follow up could try whether

develocity {
   buildScan {
      if (!gradle.startParameter.taskNames.contains("listTestsInPartition") &&
        !gradle.startParameter.taskNames.contains(":test-report:reportFlakyTests")) {
        buildScanPublished {
          File("build-scan.txt").printWriter().use { writer ->
            writer.println(buildScanUri)
          }
        }
      }
   }
}

can be moved outside the branches

}
}
} else {
develocity {
server = develocityServer
buildScan {
uploadInBackground = !isCI
publishing.onlyIf { it.isAuthenticated }

capture {
fileFingerprints = true
}

gradle.startParameter.projectProperties["testJavaVersion"]?.let { tag(it) }
gradle.startParameter.projectProperties["testJavaVM"]?.let { tag(it) }
gradle.startParameter.projectProperties["smokeTestSuite"]?.let {
value("Smoke test suite", it)
}

if (!gradle.startParameter.taskNames.contains("listTestsInPartition") &&
!gradle.startParameter.taskNames.contains(":test-report:reportFlakyTests")) {
buildScanPublished {
File("build-scan.txt").printWriter().use { writer ->
writer.println(buildScanUri)
}
}
}
}
}

buildCache {
remote(develocity.buildCache) {
isPush = isCI && develocityAccessKey.isNotEmpty()
}
}
}

rootProject.name = "opentelemetry-java-instrumentation"
Expand Down
Loading