Skip to content

[Java] Replace maven-release-plugin with CI-friendly versions - #2603

Open
SandraAhlgrimm wants to merge 5 commits into
mainfrom
sandraahlgrimm-java-drop-maven-release-plugin
Open

[Java] Replace maven-release-plugin with CI-friendly versions#2603
SandraAhlgrimm wants to merge 5 commits into
mainfrom
sandraahlgrimm-java-drop-maven-release-plugin

Conversation

@SandraAhlgrimm

@SandraAhlgrimm SandraAhlgrimm commented Sep 10, 2026

Copy link
Copy Markdown

Fixes #2579

Summary

Make Java publication a read-only consumer of an immutable source commit. Remove release-plugin commits, direct pushes to main, privileged repository tokens, and rollback machinery while retaining Maven Central publication and independent Java retries.

Changes

CI-friendly Maven versions

  • Define the development default once as <revision>1.0.14-SNAPSHOT</revision> and use ${revision} throughout the POM hierarchy.
  • Remove maven-release-plugin; inject the shared release version with -Drevision=<version>.
  • Retain flattening so installed/published POMs contain literal coordinates without the unpublished parent.

Trusted, immutable release sources

  • Require Java publication to run from main.
  • Bootstrap validation from the trusted triggering commit, with full Git history. Before checking out or executing a requested source, require a full commit SHA reachable from main.
  • Pass only the validated source to all classifier builds and the primary SDK build. Historical commits on main remain valid for independent retries with the original version and SHA.
  • Disable shared Maven and automatic npm caches in this SHA-selectable release workflow; remove the unnecessary cache-enabled CLI setup step.
  • Keep repository permissions read-only and retain only Maven Central/GPG publication credentials in the Maven publisher. Snapshot publication remains read-only.

Post-publication tags and documentation

  • Create java/vX.Y.Z in the shared github-release job after package publication succeeds. Existing lightweight or annotated tags must resolve to the original release SHA; mismatches fail without overwriting tags.
  • Dispatch the standalone documentation site from a separate downstream job so a dispatch retry does not recreate releases or republish packages.
  • Document the versioning model, trusted-source retry contract, and a non-publishing mvn clean verify -Drevision=1.2.3 example. Documentation version updates remain reviewed PR changes.

Regression coverage

  • Use one synthetic non-SNAPSHOT revision (0.0.0-ci) across all native input jobs and the publication assembly.
  • Use install, not deploy, for both local artifact builds. Remove the ineffective skipPublishing profile instead of relying on it to prevent Central access.
  • Check both installed POMs for literal coordinates, no unresolved ${revision}, and no parent reference; preserve classifier, sources, Javadoc, and signature assertions.
  • Add source-trust tests covering current/historical main commits, unmerged commits, non-main dispatches, malformed/abbreviated SHAs, tag/tree objects, missing history, and CLI failure behavior.

Verification

  • Existing publication regression coverage and the new source-trust tests run in Java CI.
  • The signed native/SDK publication assembly and Java required gate passed after switching local builds to install.
  • Local source-trust tests cover historical retries and reject untrusted sources before any checkout target is emitted.
  • No real Maven Central publication or release workflow was triggered during validation. The PR checks report the latest CI and CodeQL results.

cc @edburns for review.

Make the Java release pipeline a read-only consumer of the commit being
released, consistent with the other SDKs. A Java release now creates no
commits on `main`, requires no elevated repository token or ruleset
bypass, and publishes artifacts whose version and source SHA match the
other SDK artifacts in the same release.

- POMs: adopt ${revision} CI-friendly versions (single <revision>
  property in java/pom.xml); remove maven-release-plugin.
- java-publish-maven.yml: drop preflight/prepare-release/rollback-release;
  add resolve-source; build all classifiers + deploy from one immutable
  SHA with -Drevision; contents: read only; no JAVA_RELEASE_TOKEN.
- publish.yml: publish-java contents: read + sourceSha; create the
  java/vX.Y.Z traceability tag and trigger the site deploy in
  github-release after publication succeeds.
- java/README.md: document the new versioning/release model.

Fixes #2579

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 10, 2026 09:18
@SandraAhlgrimm
SandraAhlgrimm requested a review from a team as a code owner September 10, 2026 09:18
@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Release retryability, tag validation, unsafe documentation, and automated coverage need correction.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 1 High severity · 2 Medium severity · 1 Low severity

New issues introduced by this change (4)
Severity Finding
High severity .github/​workflows/​publish.yml — The new Java tag silently accepts any pre-existing java/vX.Y.Z tag without checking its target.…
Medium severity .github/​workflows/​publish.yml — A transient failure while dispatching the site workflow is not retryable: this step now runs at the…
Medium severity java/​pom.xml — The release-only ${revision} override and flattening path is not exercised by the existing…
Low severity java/​README.md — This local-validation command runs deploy with the Central publishing extension configured with…
What changed in this PR

Reworks Java releases to use Maven CI-friendly ${revision} versions and immutable source commits without mutating main.

Changes:

  • Replaces Maven release-plugin versioning with ${revision}.
  • Makes Maven publication read-only and source-SHA pinned.
  • Moves Java tagging and site deployment into the shared release workflow.
File Description
java/​pom.xml Defines the shared revision and removes the release plugin.
java/​sdk/​pom.xml Inherits the CI-friendly parent version.
java/​copilot-native/​pom.xml Inherits the CI-friendly parent version.
java/​README.md Documents the new release model.
.github/​workflows/​java-publish-maven.yml Publishes from an immutable SHA without repository writes.
.github/​workflows/​publish.yml Passes the source SHA and handles Java tagging/site deployment.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/publish.yml Outdated
Comment thread .github/workflows/publish.yml Outdated
Comment thread java/pom.xml
Comment thread java/README.md Outdated
SandraAhlgrimm and others added 2 commits September 10, 2026 13:42
Guard existing Java tags against source mismatches and separate site dispatch into an independently retryable job. Exercise a synthetic release revision across classifier builds and both locally installed Java artifacts, validate flattened POM coordinates, and replace the README deployment example with a non-publishing build.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use Maven install for CI's local release assembly instead of invoking Central's deploy goal, and remove the ineffective skipPublishing profile. Disable dependency caching in the SHA-selectable release workflow, including automatic npm caching and the unnecessary cached CLI setup.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Java tag failures cannot be retried after the non-idempotent GitHub Release creation succeeds.

Review tier: Balanced
Findings: None

Issues resolved since last review (4)
Severity Finding
Low severity java/​README.md — This local-validation command runs deploy with the Central publishing extension configured with… View resolved comment
Medium severity java/​pom.xml — The release-only ${revision} override and flattening path is not exercised by the existing… View resolved comment
Medium severity .github/​workflows/​publish.yml — A transient failure while dispatching the site workflow is not retryable: this step now runs at the… View resolved comment
High severity .github/​workflows/​publish.yml — The new Java tag silently accepts any pre-existing java/vX.Y.Z tag without checking its target.… View resolved comment
Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

.github/workflows/publish.yml:511

  • This tag operation is still placed after the non-idempotent gh release create steps. If the tag fetch or push fails transiently after the release has been created, rerunning the failed github-release job fails immediately because that release already exists, so the Java tag is never retried. Move Java tagging to its own downstream job (as done for the site dispatch), or make release creation safely idempotent before adding a later fallible step.

Bootstrap source validation from the trusted triggering commit and require main-branch publication. Accept only full commit SHAs reachable from main before checking out or executing the requested source. Pass only the validated source to every release build, preserve historical retries, and add source-trust regression coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

SDK Consistency Review

I reviewed PR #2603 against the authoritative file list and diff from pull_request_read.

Changed files (all in .github/workflows/ and java/):

  • .github/workflows/java-publish-maven.yml, .github/workflows/java-sdk-tests.yml, .github/workflows/publish.yml
  • java/README.md
  • java/pom.xml, java/sdk/pom.xml, java/copilot-native/pom.xml
  • java/copilot-native/scripts/validate-local-publication.mjs, java/copilot-native/scripts/validate-native-artifact.test.mjs
  • java/scripts/resolve-release-source.mjs (new), java/scripts/resolve-release-source.test.mjs (new)

Assessment: This PR is entirely release/build-infrastructure work for the Java SDK — it switches the Maven release process to CI-friendly (${revision}) versioning, removes the maven-release-plugin/preflight-commit flow in favor of building from an immutable, already-merged source SHA, and updates related validation scripts and docs. No public SDK client API (java/sdk/src/main/java/**) or any other language's SDK source (nodejs/src, python/copilot, go/, dotnet/src, rust/src) is modified.

Since no feature, method, or behavior is added/changed in the SDK's public API surface, there is nothing to cross-reference for feature parity across languages here — this is a Java-specific release-tooling change and doesn't need to be mirrored in other language SDKs. ✅ No consistency issues found.

Generated by SDK Consistency Review Agent for #2603 · copilot · sonnet50 · 26.5 AIC · ⌖ 12.1 AIC · ⊞ 8.3K ·

@edburns

edburns commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

My understanding is that #2579 is a blocker to your plan to incorporate copilot-sdk into copilot-agent-runtime.

Therefore, because I was busy on another task for my management, I sought and received help from fellow Berliner @SandraAhlgrimm . She has promptly delivered PR 2603 to fix this issue.

I seek your review, in addition to the review I will provide.

After this is merged, I intend to cut a preview release to test it out.

But first, please take a close look.

Thanks,

Ed

Remove the obsolete repository push token and associate the documentation deployment token with the shared publish workflow.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: da1e04ac-3079-4aa4-b495-4358cb3c6b04

@roji roji left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Two remaining release-workflow issues: the publication test-skipping behavior with current main, and retryability of Java tagging after GitHub release creation.

"-Dmaven.repo.local=$LOCAL_REPOSITORY"
node copilot-native/scripts/validate-local-publication.mjs \
"$LOCAL_REPOSITORY" copilot-sdk-java-runtime "$VERSION" .. --signatures
mvn -B -pl sdk install -Prelease -DskipTests \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please add -DskipITs here and to the actual Java release publication command, which also intends to skip tests. The CI merge includes main's Failsafe 3.6.0 upgrade; that version no longer honors -DskipTests for integration tests. This new SDK installation step therefore runs integration tests while CLI preparation is skipped, causing the current publication assembly failure and consequently Java required. I reproduced Failsafe 3.6.0 running an integration test despite -DskipTests and confirmed that adding -DskipITs skips it. This is a deterministic interaction with main, not a failure of ${revision} versioning or a transient CI issue.

exit "$STATUS"
fi
git tag "$TAG_NAME" "$SOURCE_SHA"
git push origin "refs/tags/$TAG_NAME"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please move Java tagging into its own downstream job and make deploy-java-site depend on it, as was already done for the site dispatch itself. This fetch/push still runs after the non-idempotent gh release create steps in the same github-release job. If fetching or pushing the Java tag fails after the release has been created, rerunning the failed job stops at the already-existing release before reaching this step. The tag's existing-target check is correct, but it cannot help if the retry never reaches it; Java tagging and the dependent site deployment remain incomplete.

@roji roji left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM too - thanks @SandraAhlgrimm! - but @edburns is the Java authority here in any case.

@SandraAhlgrimm see my two comments above, one of these seems to explain why this PR is failing CI.

@roji
roji enabled auto-merge September 11, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Java] Cease using maven-release-plugin due to its opinionated mutations of git history

4 participants