Skip to content

Replace p2 composite Ant tasks with a standalone bash script#292

Merged
tortmayr merged 1 commit into
masterfrom
p2-script
Jun 23, 2026
Merged

Replace p2 composite Ant tasks with a standalone bash script#292
tortmayr merged 1 commit into
masterfrom
p2-script

Conversation

@tortmayr

Copy link
Copy Markdown
Contributor

What it does

Replaces the dated packaging-p2composite.ant / rsync.ant tasks — which spun
up a full Eclipse runtime (tycho-eclipserun-plugin, pinned to the 2019-09
release repo + JavaSE-11) just to rewrite two small composite metadata files —
with a single, self-contained bash script.

  • Add releng/org.eclipse.glsp.repository/p2-composite.sh that builds the
    nightly p2 composite site by regenerating compositeContent.xml /
    compositeArtifacts.xml / p2.index from a directory scan. No Eclipse/p2
    tooling required.
  • Add a guarded prune subcommand for maintenance (e.g. drop all 2.x
    nightlies after switching to 3.x). It is dry-run by default and refuses
    unknown tokens, invalid tokens, and any prune that would empty the site.
  • Decouple publishing from Maven entirely: the repository POM now only builds
    target/repository, and the Jenkins pipeline invokes the script directly.
    The add step auto-detects the version from the build output, so the child
    directory name always matches the published bundle versions.
  • Make pulls fail-safe: the script only treats a confirmed-missing remote as
    a first run and aborts on any other pull error, so a transient failure can
    never lead to a destructive rsync --delete against production.
  • Remove the obsolete packaging-p2composite.ant and rsync.ant.

How to test

The composite/prune logic can be exercised end-to-end against local directories
acting as the "remote" (rsync does a plain local copy when the destination has
no host: prefix), using a real built repository as source:

mvn clean package -Pp2 -B            # produces releng/org.eclipse.glsp.repository/target/repository
SCRIPT=releng/org.eclipse.glsp.repository/p2-composite.sh
SRC=releng/org.eclipse.glsp.repository/target/repository
mkdir -p /tmp/t/remote /tmp/t/local

# publish (auto-detects version from the build output, as Jenkins does)
$SCRIPT add --source-repo "$SRC" \
  --local /tmp/t/local/server/p2 --remote /tmp/t/remote/server/p2

# simulate more version lines via override flags, then prune
$SCRIPT add --source-repo "$SRC" --unqualified-version 2.7.0 --build-qualifier q1 \
  --local /tmp/t/local/server/p2 --remote /tmp/t/remote/server/p2
$SCRIPT prune --local /tmp/t/local/server/p2 --remote /tmp/t/remote/server/p2 2.7   # dry-run preview
$SCRIPT prune --local /tmp/t/local/server/p2 --remote /tmp/t/remote/server/p2 --apply 2.7
  • Verified locally: multi-version publish, per-minor + top-level composite
    regeneration, and child-reference integrity (every <child> resolves to
    an existing dir).
  • Verified prune dry-run/apply and all guards (no-match, invalid token,
    refuse-total-wipe).
  • Verified pull-safety: confirmed-missing remote starts a clean first run;
    an unreachable remote aborts (exit 1) before any push.
  • Generated composite XML is well-formed (xmllint) and matches the live
    Eclipse composite format.

Follow-ups

  • The Deploy P2 stage's rm -rf/mkdir of the local mirror is now partly
    redundant with the script's own handling; left intact to keep the diff small.
  • The IDE update site (eclipse-glsp/glsp IDE repo) uses the same Ant tasks and
    could receive the same treatment.

Changelog

  • This PR should be mentioned in the changelog
  • This PR introduces a breaking change (if yes, provide more details below for the changelog and the migration guide)

@tortmayr tortmayr force-pushed the p2-script branch 2 times, most recently from aa277ce to 0fd2907 Compare June 23, 2026 13:57
- Add p2-composite.sh that builds the nightly p2 composite site by
  regenerating the composite metadata from a directory scan, dropping
  the tycho-eclipserun-plugin Eclipse runtime the old Ant task needed
- Provide a guarded 'prune' subcommand to remove old nightly version
  lines (dry-run by default, refuses unknown tokens and total wipes)
- Decouple publishing from Maven entirely: the repository pom now only
  builds target/repository, and the Jenkins pipeline invokes the script
  directly; 'add' auto-detects the version from the build output
- Remove the obsolete packaging-p2composite.ant and rsync.ant
@tortmayr tortmayr merged commit 32120de into master Jun 23, 2026
7 checks passed
@tortmayr tortmayr deleted the p2-script branch June 23, 2026 18:24
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