Skip to content

Publish SNAPSHOTs to maven.descoped.io, as the Descoped SNAPSHOT standard - #10

Merged
oranheim merged 2 commits into
masterfrom
ci/descoped-snapshots
Nov 23, 2026
Merged

oranheim merged 2 commits into
masterfrom
ci/descoped-snapshots

Conversation

@oranheim

Copy link
Copy Markdown
Member

Applies the Descoped Maven SNAPSHOT standard (reference: rawdata-client-project). SNAPSHOTs go only to Descoped's AWS CodeArtifact repository, read publicly at https://maven.descoped.io/; releases go only to Maven Central.

pom.xml

  • Reads SNAPSHOTs from descoped-snapshots-public (https://maven.descoped.io/, snapshots only). Maven Central stays the implicit default.
  • Profile descoped-snapshots: snapshot repository descoped-snapshots at ${descoped.snapshots.url}; enforcer requireSnapshotVersion and requireProperty (https://\S+/); sources (jar-no-fork); deployAtEnd.
  • Profile central: enforcer requireReleaseVersion and requireReleaseDeps.
  • The Central Portal snapshot repository is removed: a SNAPSHOT never goes to Central.
  • maven-help-plugin 3.6.0 and versions-maven-plugin 2.25.3 pinned in pluginManagement (CI uses them).

ci.yml

  • The snapshot job from rawdata-client-project, unchanged. It runs after the build, on a push to master (X.Y.Z-SNAPSHOT) or a workflow_dispatch on a branch (X.Y.Z-<branch>-SNAPSHOT), never on pull requests or tags. Only this job has id-token: write.
  • Only pull requests cancel an earlier run, so an upload never stops halfway.

.claude/CLAUDE.md: the Publishing rule says where SNAPSHOTs and releases go, and that no account ID or endpoint goes into a public file.

Checked

  • Locally on JDK 17: verify javadoc:javadoc passes. -P central on a SNAPSHOT fails with "Only releases go to Maven Central". -P descoped-snapshots without the URL fails with "descoped.snapshots.url is not set", and passes with one.
  • Test publish by workflow_dispatch on this branch (run 45187573864): build and "Publish SNAPSHOTs" succeeded.
    • 0.1.1-ci-descoped-snapshots-SNAPSHOT: maven-metadata.xml, the pom, the jar and the sources jar all read back with 200 from maven.descoped.io.
    • The job log has no 12-digit number and no CodeArtifact host.
    • The deployed pom has no account ID or endpoint; ${descoped.snapshots.url} stays unexpanded.

…dard

SNAPSHOTs go only to Descoped's AWS CodeArtifact repository, read publicly at
https://maven.descoped.io/; releases go only to Maven Central.

- pom.xml: read SNAPSHOTs from descoped-snapshots-public; a descoped-snapshots
  profile (snapshot repository from descoped.snapshots.url, enforcer
  requireSnapshotVersion and requireProperty, sources, deployAtEnd); the
  central profile gets requireReleaseVersion and requireReleaseDeps; the Central
  Portal snapshot repository is removed; maven-help-plugin and
  versions-maven-plugin pinned for CI.
- ci.yml: the snapshot job from rawdata-client-project, after the build, on a
  push to master or a workflow_dispatch on a branch. Only pull requests cancel
  an earlier run, so an upload never stops halfway.
- .claude/CLAUDE.md: the Publishing rule says where SNAPSHOTs and releases go.
@claude

claude Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Claude finished @oranheim's task in 1m 3s —— View job


PR review: Publish SNAPSHOTs to maven.descoped.io

  • Read .claude/CLAUDE.md invariants
  • Review pom.xml, ci.yml, .claude/CLAUDE.md diff
  • Post review

I found nothing that blocks the merge. No Java code changed, so the Java 17, JPMS, wire-compatibility, immutability, malformed-input and Javadoc rules are not affected.

Invariant: Publishing

This PR changes the rule "CI publishes nothing: no SNAPSHOTs and never a release." It does not break it by accident: the rule is rewritten in the same PR (.claude/CLAUDE.md:59-64) and the PR comes from the owner. The parts that matter still hold:

  • CI never releases.
  • requireReleaseVersion in the central profile (pom.xml:119-121) stops a SNAPSHOT from reaching Central. It replaces the removed Central snapshot repository.
  • The if: on the snapshot job (ci.yml:80-82) leaves out PRs and tags.
  • requireSnapshotVersion (pom.xml:194-196) checks the version a second time.

Approving this PR also approves the new rule.

Security and secrets

I found no leaked secrets or hardcoded endpoints:

  • The role ARN is a secret.
  • The account ID, token, URL and origin are each masked before anything could print them (ci.yml:141-150).
  • AWS credentials go only to the Deploy step (output-env-credentials: false).
  • Only the snapshot job gets id-token: write.
  • persist-credentials: false is set.
  • The <<'XML' heredoc is quoted, so the token never lands in settings.xml in plain text.
  • The server id descoped-snapshots is kept apart from the public read repository descoped-snapshots-public, so the publishing token is never sent on reads.

SUGGESTIONS (non-blocking)

  1. <repositories> ends up in every released POM (pom.xml:54-65). The project has no SNAPSHOT dependency, and no runtime dependency at all. So the only effect of this block is that every consumer's build, and every Central release POM, carries a third-party repository. If reading SNAPSHOTs is only meant for this project's own builds, you could:

    • drop the block, or
    • move it into a profile, or document it for consumers in the README instead.

    Nothing breaks if it stays: releases are disabled and the URL is public.

  2. The OIDC trust policy is the real guard for workflow_dispatch. Anyone with write access can dispatch on any branch. The Deploy step then runs that branch's ./mvnw and plugins while holding the AWS credentials (ci.yml:170-171). The if: cannot stop that. Make sure the IAM role trust policy limits token.actions.githubusercontent.com:sub to repo:descoped/java-tuple:*, and that the role can do nothing beyond publishing to maven-snapshots. I can't check this from the repository.

  3. The README says nothing about SNAPSHOTs. It is the user documentation, and maven.descoped.io is now a public channel users can rely on. Consider a short note in the Install section with the repository URL and the X.Y.Z-SNAPSHOT and X.Y.Z-<branch>-SNAPSHOT naming.

  4. Duplicated maven-source-plugin 3.4.0 (pom.xml:131-133 and pom.xml:210-212). Its version could move into the new pluginManagement (pom.xml:307), so a Renovate bump changes it in one place.

Checked and fine

  • cancel-in-progress: ${{ github.event_name == 'pull_request' }}: an upload is not cancelled halfway. The job-level snapshot-${{ github.ref }} group keeps uploads of maven-metadata.xml on the same branch from interleaving.
  • deployAtEnd means a failed build uploads nothing.
  • The requireProperty regex https://\S+/ catches an unset property and an unexpanded ${env...}.
  • Branch names are sanitized with tr -c 'A-Za-z0-9.' '-', and the branch name reaches the shell through env:, not by interpolation into the script, so a branch name cannot inject shell commands.
  • Actions are pinned to commit SHAs.
  • Enforcer 3.7.0 and deploy-plugin 3.2.0 versions come from the main <build>.
  • Maven 3.10.1 from the wrapper.

I couldn't check from here that maven-help-plugin 3.6.0 and versions-maven-plugin 2.25.3 are the latest stable versions: the request to Maven Central needed an approval this run doesn't have. Renovate will catch it if they aren't. Tests were not run here; CI runs them on JDK 17.

- maven-source-plugin's version moves to pluginManagement, so the central and
  descoped-snapshots profiles share one version.
- README: the Install section says where SNAPSHOTs are and how they are named.
@oranheim

Copy link
Copy Markdown
Member Author

Review findings addressed

No blocking findings. The suggestions, each triaged:

# Suggestion Outcome
1 <repositories> ends up in every released POM Not changed. The Descoped SNAPSHOT standard requires this block in every root POM. It is SNAPSHOTs only and the URL is public, so it changes no release resolution for consumers.
2 The OIDC trust policy is the real guard for workflow_dispatch Outside this repository. The IAM role and its trust policy belong to the aws-platform setup. The test publish confirmed that the role works for descoped/java-tuple. Whether the trust is limited to Descoped repositories and the role to maven-snapshots is for the platform owner to confirm. Reported to them.
3 The README says nothing about SNAPSHOTs Fixed in fb39af0. The Install section names https://maven.descoped.io/, the two SNAPSHOT version forms, and the repository element.
4 maven-source-plugin 3.4.0 is declared twice Fixed in fb39af0. The version is now in pluginManagement, and both profiles inherit it (checked with help:effective-pom for each profile).

The pinned maven-help-plugin 3.6.0 and versions-maven-plugin 2.25.3 are the latest releases on Maven Central (checked in maven-metadata.xml).

@oranheim

Copy link
Copy Markdown
Member Author

Follow-up on suggestion 2 (OIDC trust): the aws-platform side has confirmed it from live AWS.

  • Trust policy of the publisher role:
    • aud must be sts.amazonaws.com;
    • sub must be a branch ref in a Descoped repository;
    • pull requests, tags, and renovate/* and dependabot/* branches are excluded.
  • Permissions:
    • a CodeArtifact token for the descoped domain;
    • reading the maven-snapshots endpoint;
    • publishing only io.descoped* packages to maven-snapshots;
    • nothing on any other repository or AWS service.

A dispatched branch can therefore do no more than a push by someone with write access already can. Write access is the trust boundary, as intended.

@oranheim
oranheim merged commit 96c7658 into master Nov 23, 2026
2 checks passed
@oranheim
oranheim deleted the ci/descoped-snapshots branch November 23, 2026 13:57
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.

1 participant