SLING-13253 - finalize: update the Sling website as the last step - #40
Conversation
|
@raducotescu as requested ;), did i miss anything or is everything now fully automated? |
48f5cba to
490f8e9
Compare
rombert
left a comment
There was a problem hiding this comment.
I think there are multiple changes in this PR, and it would be good to be able to review them independently. Maybe with https://docs.github.com/en/pull-requests/get-started/stacked-prs-quickstart ?
43bf3a9 to
279c7a3
Compare
279c7a3 to
f1bf432
Compare
Done :D give it a try and let me know if you find it better :) |
f1bf432 to
b02081d
Compare
Promoting a release also requires updating the website, which finalize did not do. UpdateLocalSiteCommand already edited releases.md and downloads.tpl but only printed a diff, so nothing ever landed. finalize now orchestrates that command as step 6/6, reusing its editing and commit/push helpers rather than reimplementing them, following the existing planDistRelease/publishToDistRelease pattern. The checkout is cloned from gitbox so the ASF credentials that already commit to dist.apache.org can push. downloads.tpl entries are now matched on the artifact id instead of the display name. The two routinely differ (Tracer is listed as Log Tracer, Commons Mime as Commons Mime Type Service) and one release can own several entries (Testing OSGi Mock has .core/.junit4/.junit5), so name matching silently did nothing for roughly a third of releases. Artifact ids come from the staged POMs, or from the released POMs in dist/release when the staging repository has already been dropped, so this works before and after promotion. Only entries on the same major version are rewritten. dist/release keeps several major streams published while the downloads page lists only the latest, so matching on the artifact id alone would have turned a Resource Resolver 1.12.x maintenance release into a downgrade of the 2.x entry. The news page stays a separate, manual command: the release guide only asks for a news entry when a release warrants an announcement.
The display-name based updateDownloads had no callers left once downloads.tpl entries are matched on the artifact id, which also covers the --release path because the artifact ids are then read from the released POMs in dist/release. Its tests are replaced by artifact-id equivalents.
b02081d to
a0b8671
Compare
rombert
left a comment
There was a problem hiding this comment.
Thanks, indeed easier to review
Extract the dist.apache.org access out of UpdateDistCommand into DistRepository: publishing a release and resolving a release's artifact ids from the published POMs both need it, so it does not belong to any one command, and reaching into a command for it was a layering smell. Take the site checkout as a --site-checkout option rather than an environment variable. The env var only existed because the shared helpers resolved it from global state; the path is now threaded through as a parameter instead, which also removes the system-property juggling the tests needed. Nothing else in the CLI takes an option this way - the only other environment variables are the ASF credentials, which are secrets passed through --env-file. Drive the site command tests against a real repository instead of mocking JGit. The mocks had to be taught about checkout(), setDepth() and setCommitter() one breakage at a time while continuing to pass, which is the wrong way round; these tests clone, fetch, commit and push between two local repositories, and one of them immediately caught that the committer identity is not set yet. This matches the rest of the suite, where MockJira and MockNexus are real local HTTP servers rather than mocked clients.
|
Thanks @rombert — all four points addressed in
The mocking one was worth doing: the real-repository tests immediately caught that the commit was recording the wrong committer identity, which the mocked version could not see. Note the stack has grown a layer, since the review feedback sits below the shallow-clone work: #47 (merged) → #40 → #48. |
|



Stack: 2 of 3 — builds on #47 (JGit upgrade); #48 builds on this. Review #47 first.
Promoting a release also requires updating the website, which
finalizedid not do.UpdateLocalSiteCommandalready editedreleases.mdanddownloads.tpl, but it only printed agit diff— so nothing it produced ever landed.finalizenow orchestrates that command as step 6/6, reusing its editing and commit/push helpers rather than reimplementing them, following the existingplanDistRelease/publishToDistReleasepattern. The checkout is cloned from gitbox so the same ASF credentials that already commit todist.apache.orgcan push.Downloads entries are matched on the artifact id
Matching on the display name silently did nothing for roughly a third of releases, because the name on the downloads page regularly differs from the released component name:
downloads.tplentryThe old regex also excluded digits, so
I18n,osgi-mock.junit4/5,metrics-rrd4jandauth.saml2could never match, and the change count it returned was discarded by the caller — so the no-op was invisible.Entries are now keyed on the artifact id, which is also what the site's own
renovate.jsonkeys on. Artifact ids come from the staged POMs, or from the released POMs indist/releaseonce the staging repository has been dropped, so this works both before and after promotion. Since a release name maps to its child modules only through the<parent>chain, that resolution reusesPomParserinstead of guessing.Only entries on the same major version are rewritten
dist/releasekeeps several major streams published side by side while the downloads page lists a single, latest-major entry per artifact —resourceresolveris listed at2.0.2while1.12.16is still distributed, and nine artifacts are currently in that state. Matching on the artifact id alone would therefore have turned a Resource Resolver1.12.18maintenance release into a downgrade of the2.xentry. A maintenance release of an older line now reports that the page tracks another major version and touches nothing. Composite versions (4.1.0-1.86.0,7.0.5-2.8.2) and the Groovy${starterVersion}interpolation are handled too.An artifact with no entry at all is reported so it can be added by hand — which is what the release guide asks for when a brand new module is released.
The news page stays manual
A new
release update-newscommand adds an announcement entry. It is deliberately not part offinalize, since the release guide only asks for a news entry when a release warrants an announcement.Notes
updateDownloadsis removed in the second commit; it had no callers left, since the--releasepath also resolves artifact ids.FinalizeCommandTestwas cloning the realsling-siteand attempting an actual push to gitbox — it "passed" only because the step warns rather than fails. That is now stubbed, so no test touches the network.finalize: everything irreversible has already succeeded by that point.Verification
Beyond the unit tests, the flow was replayed against a real past release (Event Impl 4.4.2, which the page lists as
Event— the display-name mismatch case): the generateddownloads.tplis byte-identical to the human commit that released it (blobc44750814…), with the push directed at a local repository standing in for gitbox.Companion docs update: apache/sling-site#286.
CI note:
continuous-integration/jenkins/pr-mergefails on this PR for an infrastructure reason, not a code one. The ASF Jenkins job merges the PR head into its target branch, but it only fetchesmaster, so a base offeature/SLING-13253-upgrade-jgitcannot be resolved:Because Jenkins also triggers the SonarCloud analysis, this PR has no fresh Sonar run either. CI will go green once its base lands on
masterand GitHub retargets this PR. Locally,mvn clean verifypasses on this branch.