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

epugh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr-mcp.git


The following commit(s) were added to refs/heads/main by this push:
     new 9773deef build: publish Gradle build scans to develocity.apache.org 
(#258)
9773deef is described below

commit 9773deeff6b3f50f7af113ab1638303f4055e1a2
Author: Aditya Parikh <[email protected]>
AuthorDate: Mon Nov 16 15:56:11 2026 -0500

    build: publish Gradle build scans to develocity.apache.org (#258)
    
    * build: publish Gradle build scans to develocity.apache.org
    
    Apply the Develocity and Common Custom User Data plugins in
    settings.gradle.kts, configured like apache/solr's
    gradle/develocity.gradle: the ASF server, projectId "solr-mcp", publish
    from CI or locally with -Pscan, and only when authenticated, so fork PRs
    (which receive no secrets) build normally without publishing. IP
    addresses are obfuscated; scans are tagged with the JDK version, PR and
    the workflow name.
    
    ci.yml, build-and-publish.yml and native.yml export
    DEVELOCITY_ACCESS_KEY from the repository secret of the same name.
    dev-docs/DEVELOPMENT.md links the scan and test-history views.
    
    Closes #257
    
    Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
    Signed-off-by: Aditya Parikh <[email protected]>
    
    * build: keep isCiBuild local so the develocity config is cache-safe
    
    The script-level isCiBuild val was captured by the publishing.onlyIf
    lambda as a script reference, which the configuration cache cannot
    serialize, failing every build with "cannot serialize Gradle script
    object references". Declare it inside the buildScan block instead.
    
    Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
    Signed-off-by: Aditya Parikh <[email protected]>
    
    * build: opt Jib tasks out of the configuration cache
    
    jibDockerBuild fails with "Invocation of 'Task.project' at execution time
    is unsupported with the configuration cache" now that
    org.gradle.configuration-cache=true. Jib 3.5.4 reads Task.project when it
    runs. Mark the Jib tasks not compatible so they run without the cache and
    the rest of the build keeps using it.
    
    Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
    Signed-off-by: Aditya Parikh <[email protected]>
    
    ---------
    
    Signed-off-by: Aditya Parikh <[email protected]>
    Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
    Co-authored-by: Eric Pugh <[email protected]>
---
 .github/workflows/build-and-publish.yml |  5 +++++
 .github/workflows/ci.yml                |  5 +++++
 .github/workflows/native.yml            |  5 +++++
 build.gradle.kts                        |  7 +++++++
 dev-docs/DEVELOPMENT.md                 | 13 ++++++++++++
 settings.gradle.kts                     | 35 +++++++++++++++++++++++++++++++++
 6 files changed, 70 insertions(+)

diff --git a/.github/workflows/build-and-publish.yml 
b/.github/workflows/build-and-publish.yml
index 7c9b3448..b5edab81 100644
--- a/.github/workflows/build-and-publish.yml
+++ b/.github/workflows/build-and-publish.yml
@@ -88,6 +88,11 @@ on:
             - main            # Build + test on main merges
     workflow_dispatch:        # Manual runs for maintainers
 
+# Authenticates build scan publishing to develocity.apache.org (see 
settings.gradle.kts).
+# Empty on fork PRs, which receive no secrets, so those builds don't publish.
+env:
+    DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
+
 jobs:
     # 
============================================================================
     # Job 1: Build JAR
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 27fe6bd8..f2848f1c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -40,6 +40,11 @@ concurrency:
 permissions:
     contents: read
 
+# Authenticates build scan publishing to develocity.apache.org (see 
settings.gradle.kts).
+# Empty on fork PRs, which receive no secrets, so those builds don't publish.
+env:
+    DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
+
 jobs:
     # ========================================================================
     # Job 1: Build
diff --git a/.github/workflows/native.yml b/.github/workflows/native.yml
index 7c95336c..82ec8ca3 100644
--- a/.github/workflows/native.yml
+++ b/.github/workflows/native.yml
@@ -48,6 +48,11 @@ on:
             - 'src/test/java/**/containerization/**'
             - 'src/test/java/**/BuildInfoReader.java'
 
+# Authenticates build scan publishing to develocity.apache.org (see 
settings.gradle.kts).
+# Empty on fork PRs, which receive no secrets, so those builds don't publish.
+env:
+    DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
+
 jobs:
     native-test:
         name: nativeTest
diff --git a/build.gradle.kts b/build.gradle.kts
index a9ab9a75..36072d6a 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -579,6 +579,13 @@ jib {
     }
 }
 
+// Jib's tasks read Task.project at execution time, which the configuration 
cache rejects.
+// Opt them out so jibDockerBuild/jib work with 
org.gradle.configuration-cache=true; every
+// other task keeps using the cache.
+tasks.withType<com.google.cloud.tools.jib.gradle.JibTask>().configureEach {
+    notCompatibleWithConfigurationCache("Jib reads Task.project at execution 
time")
+}
+
 tasks.bootBuildImage {
     if (nativeBuild) {
         imageName.set("solr-mcp:$version-native-$nativeProfile")
diff --git a/dev-docs/DEVELOPMENT.md b/dev-docs/DEVELOPMENT.md
index 99b7c8cc..193f9194 100644
--- a/dev-docs/DEVELOPMENT.md
+++ b/dev-docs/DEVELOPMENT.md
@@ -93,6 +93,19 @@ trivy sbom application.cdx.json
 grype sbom:application.cdx.json
 ```
 
+### Build Scans
+
+CI publishes a [Develocity](https://infra.apache.org/gradle.html) build scan 
of every Gradle run to the ASF's instance at 
[develocity.apache.org](https://develocity.apache.org), with task timings, the 
full test report, failures and the build environment. Fork PRs receive no 
secrets, so their builds run without publishing.
+
+- [Recent solr-mcp build 
scans](https://develocity.apache.org/scans?search.rootProjectNames=solr-mcp)
+- [Test history over the last 90 
days](https://develocity.apache.org/scans/tests?search.relativeStartTime=P90D&search.rootProjectNames=solr-mcp),
 useful for spotting flaky tests
+
+Local builds publish only when opted in with `-Pscan`, and only with an access 
key in `DEVELOCITY_ACCESS_KEY` or provisioned with `./gradlew 
provisionDevelocityAccessKey`:
+
+```bash
+./gradlew build -Pscan
+```
+
 ## Running Locally
 
 ### Run the Server
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 2c219b3b..311947ff 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -15,8 +15,43 @@
  * limitations under the License.
  */
 
+plugins {
+    id("com.gradle.develocity") version "4.6.0"
+    id("com.gradle.common-custom-user-data-gradle-plugin") version "2.8.0"
+}
+
 rootProject.name = "solr-mcp"
 
+// Build scans go to the ASF's shared instance; 
https://infra.apache.org/gradle.html
+develocity {
+    server = "https://develocity.apache.org";
+    projectId = "solr-mcp"
+
+    buildScan {
+        // GitHub Actions sets CI=true on every runner.
+        // Kept local to this block: a script-level val would be captured by 
the onlyIf lambda
+        // below as a script reference, which the configuration cache cannot 
serialize.
+        val isCiBuild = providers.environmentVariable("CI").isPresent
+        uploadInBackground = !isCiBuild
+
+        // Publish from CI, or locally when opted in with -Pscan, and only 
with an access key
+        // (DEVELOCITY_ACCESS_KEY). Fork PRs receive no secrets, so they never 
publish.
+        val isScanOptIn = providers.gradleProperty("scan").isPresent
+        publishing.onlyIf { (isCiBuild || isScanOptIn) && it.isAuthenticated }
+
+        obfuscation {
+            ipAddresses { addresses -> addresses.map { "0.0.0.0" } }
+        }
+
+        tag("JDK${Runtime.version().feature()}")
+        // 
https://docs.github.com/en/actions/reference/variables-reference#default-environment-variables
+        if (providers.environmentVariable("GITHUB_BASE_REF").isPresent) { // 
only set for PRs
+            tag("PR")
+        }
+        providers.environmentVariable("GITHUB_WORKFLOW").orNull?.let { tag(it) 
}
+    }
+}
+
 // Repositories are declared once here (not per project) so every project 
resolves
 // dependencies from the same place. See
 // 
https://docs.gradle.org/current/userguide/best_practices_dependencies.html#set_up_repositories_in_settings

Reply via email to