Skip to content

WW-5872 Release build: fail the build when the documentation fetch produces no files - #2156

Open
arunmanni-ai wants to merge 2 commits into
apache:mainfrom
arunmanni-ai:ww-5872-docs-fetch-fail-on-empty
Open

arunmanni-ai wants to merge 2 commits into
apache:mainfrom
arunmanni-ai:ww-5872-docs-fetch-fail-on-empty

Conversation

@arunmanni-ai

Copy link
Copy Markdown
Contributor

The docs execution of the assembly module runs wget through an antrun <exec> with no failonerror. If the fetch fails, wget exits non-zero, the <exec> ignores it, and the build reports success with target/docs empty. all.xml and docs.xml copy that directory into docs/docs, so the all and docs assemblies would be published without documentation and nothing would flag it.

This adds an Ant <fail> after the fetch that aborts the build when target/docs contains no files.

I did not use failonerror="true": the fetch is recursive over the six trees in docs-urls.txt, and wget exits 8 when any single URL returns an error response, so one stale link on the documentation site would fail every release build. Checking the output directory tests the condition that matters and is not sensitive to wget's exit-code semantics.

Known limitation, deliberate: this catches a fetch that produced nothing, not a partial one. A stricter form could assert one retrieved page per line in docs-urls.txt, at the cost of coupling the pom to that file's contents. Happy to switch if you prefer that.

Verification

CI runs with -DskipAssembly, which deactivates the includeAssembly profile, so the assembly module is not in the reactor and these checks do not exercise this path. Verified locally in both directions (-DskipITs needed because the struts2-showcase integration tests fail independently and assembly sits after showcase in the reactor):

  • unchanged URL list: BUILD SUCCESS, 356 files fetched into assembly/target/docs, the new <fail> silent;
  • docs-urls.txt temporarily pointed at a non-resolving host: BUILD FAILURE with The documentation fetch produced no files in .../assembly/target/docs; the all and docs assemblies would be published without documentation.

Worth noting antrun already logged [ERROR] [exec] Result: 4 for the failed fetch before this change — the signal was present, it just did not stop the build.

Fixes WW-5872

Comment thread assembly/pom.xml Resolved
…s run

Nothing cleared the directory beforehand, so on a build without clean the
files from an earlier successful run were still present and the count
passed even when today's fetch produced nothing. The assemblies would then
ship stale documentation.

The directory is deleted before it is recreated, so the count only ever
sees files written by the current run. erroronmissingdir is dropped from
the fileset because the mkdir guarantees the directory exists.
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