Fix docs gulp race condition with dsl target directories#22292
Conversation
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
For the test plan to validate the issue, we also need to check that the website doc is still genrated will all the correct content |
|
🧪 CI tested the following changed modules:
|
|
Good point. I've verified that the website docs are still generated with all correct content: Glob pattern equivalence: Using Full gulp build: Ran CI: Green on this PR. Regarding build links: this race condition is primarily observable during local development with mvnd (where docs and dsl modules build in parallel). In CI, I've updated the PR description with the full validation details. Claude Code on behalf of Guillaume Nodet |
The ENOENT race condition fix for the docs gulp build belongs in PR #22292 (fix/docs-gulp-race-condition), not in this PR. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7ebb835 to
5539141
Compare
The gulpfile.js glob pattern '../dsl/**/src/main/docs/...' uses **
which recurses into target/ directories created by concurrent builds.
When a test process deletes target/surefire while gulp is scanning,
it causes an ENOENT error that fails the docs build.
Fix by replacing ** with explicit depth patterns:
- dsl/src/main/docs/... for depth-0 (dsl.adoc)
- dsl/{*,*/!(target)}/src/main/docs/... for depth 1-2, excluding
target directories via extglob
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5539141 to
3ec45dc
Compare
|
Note: the second commit (3ec45dc) adds a It also adds Claude Code on behalf of Guillaume Nodet |
3ec45dc to
c9ac60d
Compare
|
Dropped the second commit (resilient ENOENT handling). The Claude Code on behalf of Guillaume Nodet |
Summary
The gulpfile.js glob pattern
../dsl/**/src/main/docs/...uses**which recurses intotarget/directories created by concurrent Maven builds. When a test process deletestarget/surefirewhile gulp is scanning, it causes anENOENTerror that fails the docs build:This is a race condition that occurs intermittently when
docsanddslmodules build in parallel (e.g., with mvnd).PR #21996 added
{ ignore: ['**/target/**'] }togulp.src()calls, but theignoreoption filters after directory scanning has begun — the ENOENT can still occur during thescandircall itself, before the ignore filter runs. This PR fixes the root cause by replacing the**glob with explicit depth patterns that structurally prevent enteringtarget/directories.Fix: Replace
**with explicit depth patterns using!(target)extglob:dsl/src/main/docs/...for the root-leveldsl.adocdsl/{*,*/!(target)}/src/main/docs/...for depth 1–2 subdirectoriesNote: This race condition is primarily observable during local development with mvnd, where docs and dsl modules build in parallel. In CI,
regen.shuses./mvnw(sequential), so the race is much less likely. This is a preventive improvement, consistent with the approach in #21996.Validation
Verified that old and new glob patterns produce identical file lists (all 11 dsl doc files):
Full gulp build completes successfully with all 71 "others" doc files and all DSL entries present in the generated
nav.adoc.Test plan
npx glob@11)gulpbuild — completes with no errors, all 71 "others" pages generatedothers/nav.adoc— all DSL entries present (dsl, cli-connector, cli-debug, dsl-modeline, java-joor-dsl, kamelet-main, kamelet-main-support, java-xml-io-dsl, java-xml-jaxb-dsl, yaml-dsl, camel-yaml-dsl-validator-maven-plugin)