Skip to content

chore(release-script): run notice:check + license:check in preflight#559

Merged
bjagg merged 1 commit into
uPortal-Project:masterfrom
bjagg:chore/harden-release-script
May 13, 2026
Merged

chore(release-script): run notice:check + license:check in preflight#559
bjagg merged 1 commit into
uPortal-Project:masterfrom
bjagg:chore/harden-release-script

Conversation

@bjagg
Copy link
Copy Markdown
Member

@bjagg bjagg commented May 13, 2026

Summary

  • Run notice:check and license:check during preflight instead of just running the formatters and trusting git diff to detect drift
  • Auto-copy target/NOTICE.expected over root NOTICE when notice:check reports drift, then re-verify (matches the documented "review changes and commit" workflow)
  • Preserve the operator-review-then-commit-then-rerun loop for any remaining auto-fixed working-tree changes

Why

The 3.4.3 release (cut today via this script) hit two failure paths that the preflight should have caught but didn't:

  1. NOTICE drift: notice:generate writes to target/, not the root NOTICE. After a dependency was dropped from pom.xml (the resource-server-content overlay in refactor: CKEditor webjar swap + drop resource-server-content overlay #554), the root NOTICE stayed stale, the script's git diff check found nothing, and the drift only surfaced when mvn release:prepare's clean verify invoked notice:check mid-release.

  2. Missing license header: license:format only updates files that have a header to update. release-portlet.sh was committed in chore: add release-portlet.sh (Maven release preflight + cut script) #557 without an Apache header at all and slipped past the script's styling pass entirely. license:check would have caught it; the script never ran it.

Both failures cost a full mvn release:clean + manual prep commit + push + retry per occurrence.

Test plan

  • On a portlet repo with deliberately stale NOTICE (e.g. delete a known-current line), run release-portlet.sh --release X --next Y and confirm Phase 5 auto-syncs target/NOTICE.expected → NOTICE and aborts with the diff for operator review
  • On a portlet repo with a file missing the Apache header, confirm Phase 5 aborts with license:check output rather than proceeding to the destructive release plugin

Problem: the styling phase ran 'mvn notice:generate license:format
javadoc:fix' and treated a clean git diff afterward as proof of no
drift. That left two failure paths uncovered:

  1. notice:generate writes to target/, not the root NOTICE. After
     a dependency was dropped from pom.xml the root NOTICE stayed
     stale, the script's diff check found nothing, and the drift
     only surfaced when mvn release:prepare's `clean verify` invoked
     notice:check mid-release.

  2. license:format only updates files that have a header to update.
     Files added without a header (the script's own omission of an
     Apache header on release-portlet.sh in PR uPortal-Project#557 is the canonical
     case) slipped through entirely. license:check would have caught
     it; the script never ran it.

Both failure modes hit the SimpleContentPortlet 3.4.3 release today
and each cost a round of mvn release:clean + manual prep commit +
push + retry.

Goal: run notice:check and license:check during preflight. If
notice:check fails and target/NOTICE.expected has the correct content,
auto-sync it to the root NOTICE and re-verify (matches the documented
'review changes and commit' workflow). If either check still fails,
abort with the log tail. If working tree has any auto-fixed changes,
abort with the diff so the operator commits 'chore: pre-release prep'
before retrying.

Changes:
- replace the diff-only styling verification with explicit invocations
  of notice:check and license:check after the formatters run
- auto-copy target/NOTICE.expected over NOTICE when notice:check
  reports drift, then re-verify
- preserve the existing operator-review-then-commit-then-rerun loop
  for any remaining auto-fixed working-tree changes
Copy link
Copy Markdown
Member

@ChristianMurphy ChristianMurphy left a comment

Choose a reason for hiding this comment

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

Script looks fine, does Maven not have a built in way to chain these commands together?

@bjagg bjagg merged commit d98554a into uPortal-Project:master May 13, 2026
5 checks passed
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.

2 participants