|
| 1 | +# CI Architecture |
| 2 | + |
| 3 | +Overview of the GitHub Actions CI/CD ecosystem for Apache Camel. |
| 4 | + |
| 5 | +## Workflow Overview |
| 6 | + |
| 7 | +``` |
| 8 | +PR opened/updated |
| 9 | + │ |
| 10 | + ├──► pr-id.yml ──► pr-commenter.yml (welcome message) |
| 11 | + │ |
| 12 | + └──► pr-build-main.yml (Build and test) |
| 13 | + │ |
| 14 | + ├── regen.sh (full build, no tests) |
| 15 | + ├── incremental-build (test affected modules) |
| 16 | + │ ├── File-path analysis |
| 17 | + │ ├── POM dependency analysis |
| 18 | + │ └── Extra modules (/component-test) |
| 19 | + │ |
| 20 | + └──► pr-test-commenter.yml (post unified comment) |
| 21 | +
|
| 22 | +PR comment: /component-test kafka http |
| 23 | + │ |
| 24 | + └──► pr-manual-component-test.yml |
| 25 | + │ |
| 26 | + └── dispatches "Build and test" with extra_modules |
| 27 | +``` |
| 28 | + |
| 29 | +## Workflows |
| 30 | + |
| 31 | +### `pr-build-main.yml` — Build and test |
| 32 | +- **Trigger**: `pull_request` (main branch), `workflow_dispatch` |
| 33 | +- **Matrix**: JDK 17, 21, 25 (25 is experimental) |
| 34 | +- **Steps**: |
| 35 | + 1. Full build via `regen.sh` (`mvn install -DskipTests -Pregen`) |
| 36 | + 2. Check for uncommitted generated files |
| 37 | + 3. Run incremental tests (only affected modules) |
| 38 | + 4. Upload test comment as artifact |
| 39 | +- **Inputs** (workflow_dispatch): `pr_number`, `pr_ref`, `extra_modules`, |
| 40 | + `skip_full_build` |
| 41 | + |
| 42 | +### `pr-test-commenter.yml` — Post CI test comment |
| 43 | +- **Trigger**: `workflow_run` on "Build and test" completion |
| 44 | +- **Purpose**: Posts the unified test summary comment on the PR |
| 45 | +- **Why separate**: Uses `workflow_run` to run in base repo context, allowing |
| 46 | + comment posting on fork PRs (where `GITHUB_TOKEN` is read-only) |
| 47 | + |
| 48 | +### `pr-manual-component-test.yml` — /component-test handler |
| 49 | +- **Trigger**: `issue_comment` with `/component-test` prefix |
| 50 | +- **Who**: MEMBER, OWNER, or CONTRIBUTOR only |
| 51 | +- **What**: Resolves component names to module paths, dispatches the main |
| 52 | + "Build and test" workflow with `extra_modules` and `skip_full_build=true` |
| 53 | +- **Build**: Uses a quick targeted build (`-Dquickly`) of the requested |
| 54 | + modules and their dependencies instead of the full `regen.sh` build |
| 55 | + |
| 56 | +### `pr-id.yml` + `pr-commenter.yml` — Welcome message |
| 57 | +- **Trigger**: `pull_request` (all branches) |
| 58 | +- **Purpose**: Posts the one-time welcome message on new PRs |
| 59 | +- **Why two workflows**: `pr-id.yml` runs in PR context (uploads PR number), |
| 60 | + `pr-commenter.yml` runs via `workflow_run` with write permissions |
| 61 | + |
| 62 | +### `main-build.yml` — Main branch build |
| 63 | +- **Trigger**: `push` to main, camel-4.14.x, camel-4.18.x |
| 64 | +- **Steps**: Same as PR build but without comment posting |
| 65 | + |
| 66 | +### Other workflows |
| 67 | +- `pr-labeler.yml` — Auto-labels PRs based on changed files |
| 68 | +- `pr-doc-validation.yml` — Validates documentation changes |
| 69 | +- `pr-cleanup-branches.yml` — Cleans up merged PR branches |
| 70 | +- `alternative-os-build-main.yml` — Tests on non-Linux OSes |
| 71 | +- `check-container-versions.yml` — Checks test container version updates |
| 72 | +- `generate-sbom-main.yml` — Generates SBOM for releases |
| 73 | +- `security-scan.yml` — Security vulnerability scanning |
| 74 | + |
| 75 | +## Actions |
| 76 | + |
| 77 | +### `incremental-build` |
| 78 | +The core test runner. Determines which modules to test using: |
| 79 | +1. **File-path analysis**: Maps changed files to Maven modules |
| 80 | +2. **POM dependency analysis**: For `parent/pom.xml` changes, detects property |
| 81 | + changes and finds modules that reference the affected properties in their |
| 82 | + `pom.xml` files (uses simple grep, not Maveniverse Toolbox — see Known |
| 83 | + Limitations below) |
| 84 | +3. **Extra modules**: Additional modules passed via `/component-test` |
| 85 | + |
| 86 | +Results are merged, deduplicated, and tested. The script also: |
| 87 | +- Detects tests disabled in CI (`@DisabledIfSystemProperty(named = "ci.env.name")`) |
| 88 | +- Applies an exclusion list for generated/meta modules |
| 89 | +- Generates a unified PR comment with all test information |
| 90 | + |
| 91 | +### `install-mvnd` |
| 92 | +Installs the Maven Daemon (mvnd) for faster builds. |
| 93 | + |
| 94 | +### `install-packages` |
| 95 | +Installs system packages required for the build. |
| 96 | + |
| 97 | +## PR Labels |
| 98 | + |
| 99 | +| Label | Effect | |
| 100 | +|-------|--------| |
| 101 | +| `skip-tests` | Skip all tests | |
| 102 | +| `test-dependents` | Force testing dependent modules even if threshold exceeded | |
| 103 | + |
| 104 | +## CI Environment |
| 105 | + |
| 106 | +The CI sets `-Dci.env.name=github.com` via `MVND_OPTS` (in `install-mvnd`). |
| 107 | +Tests can use `@DisabledIfSystemProperty(named = "ci.env.name")` to skip |
| 108 | +flaky tests in CI. The test comment warns about these skipped tests. |
| 109 | + |
| 110 | +## Known Limitations of POM Dependency Detection |
| 111 | + |
| 112 | +The property-grep approach has structural limitations that can cause missed modules: |
| 113 | + |
| 114 | +1. **Managed dependencies without explicit `<version>`** — Most Camel modules |
| 115 | + inherit dependency versions via `<dependencyManagement>` in the parent POM |
| 116 | + and do not declare `<version>${property}</version>` themselves. When a managed |
| 117 | + dependency version property changes, only modules that explicitly reference |
| 118 | + the property are detected — modules relying on inheritance are missed. |
| 119 | + |
| 120 | +2. **Maven plugin version changes are completely invisible** — Plugin version |
| 121 | + properties (e.g. `<maven-surefire-plugin-version>`) are both defined and |
| 122 | + consumed in `parent/pom.xml` via `<pluginManagement>`. Since the module |
| 123 | + search excludes `parent/pom.xml`, no modules are found and **no tests run |
| 124 | + at all** for plugin updates. Modules inherit plugins from the parent without |
| 125 | + any `${property}` reference in their own `pom.xml`. |
| 126 | + |
| 127 | +3. **BOM imports** — When a BOM version property changes (e.g. |
| 128 | + `<spring-boot-bom-version>`), modules using artifacts from that BOM are not |
| 129 | + detected because they reference the BOM's artifacts, not the BOM property. |
| 130 | + |
| 131 | +4. **Transitive dependency changes** — Modules affected only via transitive |
| 132 | + dependencies are not detected. |
| 133 | + |
| 134 | +5. **Non-property version changes** — Direct edits to `<version>` values (not |
| 135 | + using `${property}` substitution) or structural changes to |
| 136 | + `<dependencyManagement>` sections are not caught. |
| 137 | + |
| 138 | +These limitations mean the incremental build may under-test when parent POM |
| 139 | +properties change. A future improvement could use |
| 140 | +[Maveniverse Toolbox](https://github.com/maveniverse/toolbox) `tree-find` or |
| 141 | +[Scalpel](https://github.com/maveniverse/scalpel) to resolve the full |
| 142 | +dependency graph and detect all affected modules. |
| 143 | + |
| 144 | +## Multi-JDK Artifact Behavior |
| 145 | + |
| 146 | +All non-experimental JDK matrix entries (17, 21) upload the CI comment |
| 147 | +artifact with `overwrite: true`. This ensures a comment is posted even if |
| 148 | +one JDK build fails. Since the comment content is identical across JDKs |
| 149 | +(same modules are tested regardless of JDK version), last writer wins. |
| 150 | + |
| 151 | +## Comment Markers |
| 152 | + |
| 153 | +PR comments use HTML markers for upsert (create-or-update) behavior: |
| 154 | +- `<!-- ci-tested-modules -->` — Unified test summary comment |
0 commit comments