You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "gnodet (via GitHub)" <gi...@apache.org> on 2026/03/24 22:10:27 UTC
[PR] chore(ci): merge detect-dependencies into incremental-build [camel]
gnodet opened a new pull request, #22247:
URL: https://github.com/apache/camel/pull/22247
## Summary
- Merge the separate `detect-dependencies` action into `incremental-build` for a single unified CI test mechanism
- For dependency version bumps, the old setup produced two separate PR comments and wasted time testing `parent` (which has no tests) — now there's one comment and one test run
- Generalize POM dependency analysis from parent-only to any changed `pom.xml`
- Raise testable modules threshold to 1000 (effectively disabled, can be tuned later)
- Remove unused `build` mode (builds are handled by `regen.sh`)
## Details
Previously two independent mechanisms determined which modules to test:
1. **incremental-build**: file-path based module detection — good for source changes, but for `parent/pom.xml` changes it would identify `parent`, find everything depends on it, and give up
2. **detect-dependencies**: POM property change analysis using Maveniverse Toolbox — accurately found the 3 modules affected by a version bump, but ran separately
The merged script combines both approaches: file-path analysis for source changes, Toolbox dependency analysis for pom.xml property changes. Results are merged, deduplicated, and tested once.
## Test plan
- [ ] Verify CI runs correctly on this PR (the `.github/**` paths-ignore will skip it, so may need manual trigger)
- [ ] Test with a dependency bump PR to verify Toolbox detection works end-to-end
- [ ] Test with a component source change PR to verify file-path detection still works
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore(ci): rationalize CI into single workflow with unified comment [camel]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet merged PR #22247:
URL: https://github.com/apache/camel/pull/22247
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore(ci): rationalize CI into single workflow with unified comment [camel]
Posted by "apupier (via GitHub)" <gi...@apache.org>.
apupier commented on PR #22247:
URL: https://github.com/apache/camel/pull/22247#issuecomment-4142507821
if it is part of the code modfiied by this PR (I
> ### Test 3: skip_full_build + extra_modules (`/component-test` path) ✅ (script correct, flaky test failures)
>
> **Run:** [23615655184](https://github.com/gnodet/camel/actions/runs/23615655184) — **JDK 17/25 failed (flaky test failures)**
>
> * ✅ Quick dependency build used instead of regen.sh
>
> * ✅ Extra modules correctly merged with file-path detected modules
>
> * ✅ Dependent module count correctly calculated as 24 (< 50 threshold)
>
> * ❌ Exit code 1 from actual test failures in camel-http dependent modules (not a CI script bug)
for this pointed build, in the incremental-test logs, we can notice that it tries to launch tests on 498 modules it doesn't seems to correspond to the mentioned 24.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore(ci): unify CI test infrastructure [camel]
Posted by "apupier (via GitHub)" <gi...@apache.org>.
apupier commented on code in PR #22247:
URL: https://github.com/apache/camel/pull/22247#discussion_r2986345368
##########
.github/workflows/pr-build-main.yml:
##########
@@ -92,61 +98,30 @@ jobs:
- name: mvn test
uses: ./.github/actions/incremental-build
with:
- mode: test
pr-id: ${{ github.event.number || inputs.pr_number }}
github-token: ${{ secrets.GITHUB_TOKEN }}
skip-mvnd-install: 'true'
artifact-upload-suffix: java-${{ matrix.java }}
- - name: Post CI test summary comment
- if: always() && !matrix.experimental
- uses: actions/github-script@v8
- with:
- script: |
- const fs = require('fs');
- const commentFile = 'incremental-test-comment.md';
- if (!fs.existsSync(commentFile)) return;
- const body = fs.readFileSync(commentFile, 'utf8').trim();
- if (!body) return;
-
- const prNumber = ${{ github.event.number || inputs.pr_number || 0 }};
- if (!prNumber) {
- core.warning('Could not determine PR number, skipping test summary comment');
- return;
- }
-
- const marker = '<!-- ci-tested-modules -->';
-
- try {
- const { data: comments } = await github.rest.issues.listComments({
- owner: context.repo.owner,
- repo: context.repo.repo,
- issue_number: prNumber,
- });
- const existing = comments.find(c => c.body && c.body.includes(marker));
-
- if (existing) {
- await github.rest.issues.updateComment({
- owner: context.repo.owner,
- repo: context.repo.repo,
- comment_id: existing.id,
- body: body,
- });
- } else {
- await github.rest.issues.createComment({
- owner: context.repo.owner,
- repo: context.repo.repo,
- issue_number: prNumber,
- body: body,
- });
- }
- } catch (error) {
- core.warning(`Failed to post CI test summary comment: ${error.message}`);
- }
- - name: mvn test parent pom dependencies changed
- if: always() && !matrix.experimental
- uses: ./.github/actions/detect-dependencies
+ extra-modules: ${{ inputs.extra_modules || '' }}
+ - name: Save PR number and test comment for commenter workflow
+ if: always() && matrix.java == '21'
Review Comment:
Why is it filtering only on JDK 21?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore(ci): unify CI test infrastructure [camel]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on code in PR #22247:
URL: https://github.com/apache/camel/pull/22247#discussion_r2987164153
##########
.github/workflows/pr-build-main.yml:
##########
@@ -92,61 +98,30 @@ jobs:
- name: mvn test
uses: ./.github/actions/incremental-build
with:
- mode: test
pr-id: ${{ github.event.number || inputs.pr_number }}
github-token: ${{ secrets.GITHUB_TOKEN }}
skip-mvnd-install: 'true'
artifact-upload-suffix: java-${{ matrix.java }}
- - name: Post CI test summary comment
- if: always() && !matrix.experimental
- uses: actions/github-script@v8
- with:
- script: |
- const fs = require('fs');
- const commentFile = 'incremental-test-comment.md';
- if (!fs.existsSync(commentFile)) return;
- const body = fs.readFileSync(commentFile, 'utf8').trim();
- if (!body) return;
-
- const prNumber = ${{ github.event.number || inputs.pr_number || 0 }};
- if (!prNumber) {
- core.warning('Could not determine PR number, skipping test summary comment');
- return;
- }
-
- const marker = '<!-- ci-tested-modules -->';
-
- try {
- const { data: comments } = await github.rest.issues.listComments({
- owner: context.repo.owner,
- repo: context.repo.repo,
- issue_number: prNumber,
- });
- const existing = comments.find(c => c.body && c.body.includes(marker));
-
- if (existing) {
- await github.rest.issues.updateComment({
- owner: context.repo.owner,
- repo: context.repo.repo,
- comment_id: existing.id,
- body: body,
- });
- } else {
- await github.rest.issues.createComment({
- owner: context.repo.owner,
- repo: context.repo.repo,
- issue_number: prNumber,
- body: body,
- });
- }
- } catch (error) {
- core.warning(`Failed to post CI test summary comment: ${error.message}`);
- }
- - name: mvn test parent pom dependencies changed
- if: always() && !matrix.experimental
- uses: ./.github/actions/detect-dependencies
+ extra-modules: ${{ inputs.extra_modules || '' }}
+ - name: Save PR number and test comment for commenter workflow
+ if: always() && matrix.java == '21'
Review Comment:
_Claude Code on behalf of Guillaume Nodet_
Updated — removed the JDK 21 filter. All non-experimental matrix entries now upload the artifact with `overwrite: true`. Since the content is identical across JDKs, whichever finishes last wins.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore(ci): rationalize CI into single workflow with unified comment [camel]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on code in PR #22247:
URL: https://github.com/apache/camel/pull/22247#discussion_r3003550281
##########
.github/actions/incremental-build/incremental-build.sh:
##########
@@ -15,229 +15,553 @@
# limitations under the License.
#
+# Incremental test runner for Apache Camel PRs.
+#
+# Determines which modules to test by:
+# 1. File-path analysis: maps changed files to their Maven modules
+# 2. POM dependency analysis: for changed pom.xml files, detects property
+# changes and finds modules that reference the affected properties
+#
+# Both sets of affected modules are merged and deduplicated before testing.
+
+set -euo pipefail
+
echo "Using MVND_OPTS=$MVND_OPTS"
-maxNumberOfBuildableProjects=100
maxNumberOfTestableProjects=50
-function findProjectRoot () {
+# Modules excluded from targeted testing (generated code, meta-modules, etc.)
+EXCLUSION_LIST="!:camel-allcomponents,!:dummy-component,!:camel-catalog,!:camel-catalog-console,!:camel-catalog-lucene,!:camel-catalog-maven,!:camel-catalog-suggest,!:camel-route-parser,!:camel-csimple-maven-plugin,!:camel-report-maven-plugin,!:camel-endpointdsl,!:camel-componentdsl,!:camel-endpointdsl-support,!:camel-yaml-dsl,!:camel-kamelet-main,!:camel-yaml-dsl-deserializers,!:camel-yaml-dsl-maven-plugin,!:camel-jbang-core,!:camel-jbang-main,!:camel-jbang-plugin-generate,!:camel-jbang-plugin-edit,!:camel-jbang-plugin-kubernetes,!:camel-jbang-plugin-test,!:camel-launcher,!:camel-jbang-it,!:camel-itest,!:docs,!:apache-camel,!:coverage"
+
+# ── Utility functions ──────────────────────────────────────────────────
+
+# Walk up from a file path to find the nearest directory containing a pom.xml
+findProjectRoot() {
local path=${1}
while [[ "$path" != "." ]]; do
- if [[ ! -e "$path/pom.xml" ]] ; then
- path=$(dirname $path)
- elif [[ $(dirname $path) == */src/it ]] ; then
- path=$(dirname $(dirname $path))
+ if [[ ! -e "$path/pom.xml" ]]; then
+ path=$(dirname "$path")
+ elif [[ $(dirname "$path") == */src/it ]]; then
+ path=$(dirname "$(dirname "$path")")
else
break
fi
done
echo "$path"
}
-function hasLabel() {
- local issueNumber=${1}
- local label="incremental-${2}"
- local repository=${3}
- curl -s \
- -H "Accept: application/vnd.github+json" \
- -H "Authorization: Bearer ${GITHUB_TOKEN}"\
- -H "X-GitHub-Api-Version: 2022-11-28" \
- "https://api.github.com/repos/${repository}/issues/${issueNumber}/labels" | jq -r '.[].name' | grep -c "$label"
+# Check whether a PR label exists
+hasLabel() {
+ local issueNumber=${1}
+ local label="incremental-${2}"
+ local repository=${3}
+ curl -s \
+ -H "Accept: application/vnd.github+json" \
+ -H "Authorization: Bearer ${GITHUB_TOKEN}" \
+ -H "X-GitHub-Api-Version: 2022-11-28" \
+ "https://api.github.com/repos/${repository}/issues/${issueNumber}/labels" | jq -r '.[].name' | { grep -c "$label" || true; }
}
-function main() {
- local mavenBinary=${1}
- local mode=${2}
- local log="incremental-${mode}.log"
- local prId=${3}
- local ret=0
- local repository=${4}
- local testedDependents=""
+# Fetch the PR diff from the GitHub API. Returns the full unified diff.
+fetchDiff() {
+ local prId="$1"
+ local repository="$2"
- echo "Searching for affected projects"
- local projects
local diff_output
- diff_output=$(curl -s -w "\n%{http_code}" -H "Authorization: Bearer ${GITHUB_TOKEN}" -H "Accept: application/vnd.github.v3.diff" "https://api.github.com/repos/${repository}/pulls/${prId}")
+ diff_output=$(curl -s -w "\n%{http_code}" \
+ -H "Authorization: Bearer ${GITHUB_TOKEN}" \
+ -H "Accept: application/vnd.github.v3.diff" \
+ "https://api.github.com/repos/${repository}/pulls/${prId}")
+
local http_code
http_code=$(echo "$diff_output" | tail -n 1)
local diff_body
diff_body=$(echo "$diff_output" | sed '$d')
- if [[ "$http_code" -lt 200 || "$http_code" -ge 300 || -z "$diff_body" ]] ; then
- echo "WARNING: Failed to fetch PR diff (HTTP $http_code). Falling back to full build."
- diff_body=""
+
+ if [[ "$http_code" -lt 200 || "$http_code" -ge 300 || -z "$diff_body" ]]; then
+ echo "WARNING: Failed to fetch PR diff (HTTP $http_code). Falling back to full build." >&2
+ return
+ fi
+ echo "$diff_body"
+}
+
+# ── POM dependency analysis (previously detect-dependencies) ───────────
+#
+# Uses the pre-#22022 approach: grep for ${property-name} references in
+# module pom.xml files. The Maveniverse Toolbox approach (introduced in
+# #22022, reverted in #22279) is intentionally not used here. See
+# CI-ARCHITECTURE.md for known limitations of the grep approach.
+
+# Extract the diff section for a specific pom.xml file from the full diff
+extractPomDiff() {
+ local diff_body="$1"
+ local pom_path="$2"
+
+ echo "$diff_body" | awk -v target="a/${pom_path}" '
+ /^diff --git/ && found { exit }
+ /^diff --git/ && index($0, target) { found=1 }
+ found { print }
+ '
+}
+
+# Detect which properties changed in a pom.xml diff.
+# Returns one property name per line.
+# Filters out structural XML elements (groupId, artifactId, version, etc.)
+# to only return actual property names (e.g. openai-java-version).
+detectChangedProperties() {
+ local diff_content="$1"
+
+ # Known structural POM elements that are NOT property names
+ local structural_elements="groupId|artifactId|version|scope|type|classifier|optional|systemPath|exclusions|exclusion|dependency|dependencies|dependencyManagement|parent|modules|module|packaging|name|description|url|relativePath"
+
+ echo "$diff_content" | \
+ grep -E '^[+-][[:space:]]*<[^>]+>[^<]*</[^>]+>' | \
+ grep -vE '^\+\+\+|^---' | \
+ sed -E 's/^[+-][[:space:]]*<([^>]+)>.*/\1/' | \
+ grep -vE "^(${structural_elements})$" | \
+ sort -u || true
+}
+
+# Find modules that reference a property in their pom.xml.
+# Searches pom.xml files under catalog/, components/, core/, dsl/ for
+# ${property_name} references and extracts the module's artifactId.
+# Adds discovered artifactIds to the dep_module_ids variable
+# (which must be declared in the caller).
+findAffectedModules() {
+ local property="$1"
+
+ local matches
+ matches=$(grep -rl "\${${property}}" --include="pom.xml" . 2>/dev/null | \
+ grep -v "^\./parent/pom.xml" | \
+ grep -v "/target/" || true)
+
+ if [ -z "$matches" ]; then
+ return
+ fi
+
+ while read -r pom_file; do
+ [ -z "$pom_file" ] && continue
+
+ # Only consider catalog, components, core, dsl paths (same as original detect-test.sh)
+ if [[ "$pom_file" == */catalog/* ]] || \
+ [[ "$pom_file" == */components/* ]] || \
+ [[ "$pom_file" == */core/* ]] || \
+ ([[ "$pom_file" == */dsl/* ]] && [[ "$pom_file" != */dsl/camel-jbang* ]]); then
+ local mod_artifact
+ mod_artifact=$(sed -n '/<parent>/,/<\/parent>/!{ s/.*<artifactId>\([^<]*\)<\/artifactId>.*/\1/p }' "$pom_file" | head -1)
+ if [ -n "$mod_artifact" ] && ! echo ",$dep_module_ids," | grep -q ",:${mod_artifact},"; then
+ echo " Property '\${${property}}' referenced by: $mod_artifact"
+ dep_module_ids="${dep_module_ids:+${dep_module_ids},}:${mod_artifact}"
+ fi
+ fi
+ done <<< "$matches"
+}
+
+# Analyze pom.xml changes to find affected modules via property grep.
+# Adds discovered module artifactIds to the dep_module_ids variable
+# (which must be declared in the caller).
+analyzePomDependencies() {
+ local diff_body="$1"
+ local pom_path="$2" # e.g. "parent/pom.xml" or "components/camel-foo/pom.xml"
+
+ local pom_diff
+ pom_diff=$(extractPomDiff "$diff_body" "$pom_path")
+ if [ -z "$pom_diff" ]; then
+ return
+ fi
+
+ local changed_props
+ changed_props=$(detectChangedProperties "$pom_diff")
+ if [ -z "$changed_props" ]; then
+ return
+ fi
+
+ echo " Property changes detected in ${pom_path}:"
+ echo "$changed_props" | while read -r p; do echo " - $p"; done
+
+ while read -r prop; do
+ [ -z "$prop" ] && continue
+ findAffectedModules "$prop"
+ done <<< "$changed_props"
+}
+
+# ── Disabled-test detection ─────────────────────────────────────────────
+
+# Scan tested modules for @DisabledIfSystemProperty(named = "ci.env.name")
+# and return a markdown warning listing affected files.
+detectDisabledTests() {
+ local final_pl="$1"
+ local skipped=""
+
+ for mod_path in $(echo "$final_pl" | tr ',' '\n'); do
+ # Skip artifactId-style references (e.g. :camel-openai) — only scan paths
+ if [[ "$mod_path" == :* ]]; then
+ continue
+ fi
+ if [ -d "$mod_path" ]; then
+ local matches
+ matches=$(grep -rl 'DisabledIfSystemProperty' "$mod_path" --include="*.java" 2>/dev/null \
+ | xargs grep -l 'ci.env.name' 2>/dev/null || true)
+ if [ -n "$matches" ]; then
+ local count
+ count=$(echo "$matches" | wc -l | tr -d ' ')
+ skipped="${skipped}\n- \`${mod_path}\`: ${count} test(s) disabled on GitHub Actions"
+ fi
+ fi
+ done
+
+ if [ -n "$skipped" ]; then
+ echo -e "$skipped"
+ fi
+}
+
+# ── Comment generation ─────────────────────────────────────────────────
+
+writeComment() {
+ local comment_file="$1"
+ local pl="$2"
+ local dep_ids="$3"
+ local changed_props_summary="$4"
+ local testedDependents="$5"
+ local extra_modules="$6"
+
+ echo "<!-- ci-tested-modules -->" > "$comment_file"
+
+ # Section 1: file-path-based modules
+ if [ -n "$pl" ]; then
+ echo ":test_tube: **CI tested the following changed modules:**" >> "$comment_file"
+ echo "" >> "$comment_file"
+ for w in $(echo "$pl" | tr ',' '\n'); do
+ echo "- \`$w\`" >> "$comment_file"
+ done
+
+ if [[ "${testedDependents}" = "false" ]]; then
+ echo "" >> "$comment_file"
+ echo "> :information_source: Dependent modules were not tested because the total number of affected modules exceeded the threshold (${maxNumberOfTestableProjects}). Use the \`test-dependents\` label to force testing all dependents." >> "$comment_file"
+ fi
fi
+
+ # Section 2: pom dependency-detected modules
+ if [ -n "$dep_ids" ]; then
+ echo "" >> "$comment_file"
+ if [ -n "$changed_props_summary" ]; then
+ echo ":white_check_mark: **POM dependency changes: targeted tests included**" >> "$comment_file"
+ echo "" >> "$comment_file"
+ echo "Changed properties: ${changed_props_summary}" >> "$comment_file"
+ echo "" >> "$comment_file"
+ local dep_count
+ dep_count=$(echo "$dep_ids" | tr ',' '\n' | wc -l | tr -d ' ')
+ echo "<details><summary>Modules affected by dependency changes (${dep_count})</summary>" >> "$comment_file"
+ echo "" >> "$comment_file"
+ echo "$dep_ids" | tr ',' '\n' | while read -r m; do
+ echo "- \`$m\`" >> "$comment_file"
+ done
+ echo "" >> "$comment_file"
+ echo "</details>" >> "$comment_file"
+ fi
+ fi
+
+ # Section 3: extra modules (from /component-test)
+ if [ -n "$extra_modules" ]; then
+ echo "" >> "$comment_file"
+ echo ":heavy_plus_sign: **Additional modules tested** (via \`/component-test\`):" >> "$comment_file"
+ echo "" >> "$comment_file"
+ for w in $(echo "$extra_modules" | tr ',' '\n'); do
+ echo "- \`$w\`" >> "$comment_file"
+ done
+ fi
+
+ if [ -z "$pl" ] && [ -z "$dep_ids" ] && [ -z "$extra_modules" ]; then
+ echo ":information_source: CI did not run targeted module tests." >> "$comment_file"
+ fi
+}
+
+# ── Main ───────────────────────────────────────────────────────────────
+
+main() {
+ local mavenBinary=${1}
+ local prId=${2}
+ local repository=${3}
+ local extraModules=${4:-}
+ local log="incremental-test.log"
+ local ret=0
+ local testedDependents=""
+
+ # Check for skip-tests label (only for PR builds)
+ if [ -n "$prId" ]; then
+ local mustSkipTests
+ mustSkipTests=$(hasLabel "${prId}" "skip-tests" "${repository}")
+ if [[ ${mustSkipTests} = "1" ]]; then
+ echo "The skip-tests label has been detected, no tests will be launched"
+ echo "<!-- ci-tested-modules -->" > "incremental-test-comment.md"
+ echo ":information_source: CI did not run targeted module tests (skip-tests label detected)." >> "incremental-test-comment.md"
+ exit 0
+ fi
+ fi
+
+ # Fetch the diff (PR diff via API, or git diff for push builds)
+ local diff_body
+ if [ -n "$prId" ]; then
+ echo "Fetching PR #${prId} diff..."
+ diff_body=$(fetchDiff "$prId" "$repository")
+ else
+ echo "No PR ID, using git diff HEAD~1..."
+ diff_body=$(git diff HEAD~1 2>/dev/null || true)
+ fi
+
+ if [ -z "$diff_body" ]; then
+ echo "Could not fetch diff, skipping tests"
+ exit 0
+ fi
+
+ # ── Step 1: File-path analysis ──
+ echo "Searching for affected projects by file path..."
+ local projects
projects=$(echo "$diff_body" | sed -n -e '/^diff --git a/p' | awk '{print $3}' | cut -b 3- | sed 's|\(.*\)/.*|\1|' | uniq | sort)
+
local pl=""
local lastProjectRoot=""
- local buildAll=false
local totalAffected=0
- for project in ${projects}
- do
- if [[ ${project} == */archetype-resources ]] ; then
+ local pom_files=""
+
+ for project in ${projects}; do
+ if [[ ${project} == */archetype-resources ]]; then
continue
- elif [[ ${project} != .* ]] ; then
+ elif [[ ${project} != .* ]]; then
local projectRoot
- projectRoot=$(findProjectRoot ${project})
- if [[ ${projectRoot} = "." ]] ; then
- echo "The root project is affected, so a complete build is triggered"
- buildAll=true
- totalAffected=1
- break
- elif [[ ${projectRoot} != "${lastProjectRoot}" ]] ; then
- (( totalAffected ++ ))
+ projectRoot=$(findProjectRoot "${project}")
+ if [[ ${projectRoot} = "." ]]; then
+ echo "The root project is affected, skipping targeted module testing"
+ echo "<!-- ci-tested-modules -->" > "incremental-test-comment.md"
+ echo ":information_source: CI did not run targeted module tests (root project files changed)." >> "incremental-test-comment.md"
+ exit 0
+ elif [[ ${projectRoot} != "${lastProjectRoot}" ]]; then
+ totalAffected=$((totalAffected + 1))
pl="$pl,${projectRoot}"
lastProjectRoot=${projectRoot}
fi
fi
done
+ pl="${pl:1}" # strip leading comma
- if [[ ${totalAffected} = 0 ]] ; then
- echo "There is nothing to build"
- exit 0
- elif [[ ${totalAffected} -gt ${maxNumberOfBuildableProjects} ]] ; then
- echo "There are too many affected projects, so a complete build is triggered"
- buildAll=true
- fi
- pl="${pl:1}"
-
- if [[ ${mode} = "build" ]] ; then
- local mustBuildAll
- mustBuildAll=$(hasLabel ${prId} "build-all" ${repository})
- if [[ ${mustBuildAll} = "1" ]] ; then
- echo "The build-all label has been detected thus all projects must be built"
- buildAll=true
- fi
- if [[ ${buildAll} = "true" ]] ; then
- echo "Building all projects"
- $mavenBinary -l $log $MVND_OPTS -DskipTests install
- ret=$?
- else
- local buildDependents
- buildDependents=$(hasLabel ${prId} "build-dependents" ${repository})
- local totalTestableProjects
- if [[ ${buildDependents} = "1" ]] ; then
- echo "The build-dependents label has been detected thus the projects that depend on the affected projects will be built"
- totalTestableProjects=0
- else
- for w in $pl; do
- echo "$w"
- done
- totalTestableProjects=$(./mvnw -B -q -amd exec:exec -Dexec.executable="pwd" -pl "$pl" | wc -l)
- fi
- if [[ ${totalTestableProjects} -gt ${maxNumberOfTestableProjects} ]] ; then
- echo "Launching fast build command against the projects ${pl}, their dependencies and the projects that depend on them"
- for w in $pl; do
- echo "$w"
- done
- $mavenBinary -l $log $MVND_OPTS -DskipTests install -pl "$pl" -amd -am
- ret=$?
- else
- echo "Launching fast build command against the projects ${pl} and their dependencies"
- for w in $pl; do
- echo "$w"
- done
- $mavenBinary -l $log $MVND_OPTS -DskipTests install -pl "$pl" -am
- ret=$?
+ # Only analyze parent/pom.xml for dependency detection
+ # (matches original detect-test.sh behavior; detection improvements deferred to follow-up PR)
+ if echo "$diff_body" | grep -q '^diff --git a/parent/pom.xml'; then
+ pom_files="parent/pom.xml"
+ fi
+
+ # ── Step 2: POM dependency analysis ──
+ # Variables shared with analyzePomDependencies/findAffectedModules
+ local dep_module_ids=""
+ local all_changed_props=""
+
+ if [ -n "$pom_files" ]; then
+ echo ""
+ echo "Analyzing parent POM dependency changes..."
+ while read -r pom_file; do
+ [ -z "$pom_file" ] && continue
+
+ # Capture changed props for this pom before calling analyze
+ local pom_diff
+ pom_diff=$(extractPomDiff "$diff_body" "$pom_file")
+ if [ -n "$pom_diff" ]; then
+ local props
+ props=$(detectChangedProperties "$pom_diff")
+ if [ -n "$props" ]; then
+ all_changed_props="${all_changed_props:+${all_changed_props}, }$(echo "$props" | tr '\n' ',' | sed 's/,$//')"
+ fi
fi
+
+ analyzePomDependencies "$diff_body" "$pom_file"
+ done <<< "$pom_files"
+ fi
+
+ # ── Step 3: Merge and deduplicate ──
+ # Separate file-path modules into testable (has src/test) and pom-only.
+ # Pom-only modules (e.g. "parent") are kept in the build list but must NOT
+ # be expanded with -amd, since that would pull in every dependent module.
+ local testable_pl=""
+ local pom_only_pl=""
+ for w in $(echo "$pl" | tr ',' '\n'); do
+ if [ -d "$w/src/test" ]; then
+ testable_pl="${testable_pl:+${testable_pl},}${w}"
+ else
+ pom_only_pl="${pom_only_pl:+${pom_only_pl},}${w}"
+ echo " Pom-only module (no src/test, won't expand dependents): $w"
fi
- [[ -z $(git status --porcelain | grep -v antora.yml) ]] || { echo 'There are uncommitted changes'; git status; echo; echo; git diff; exit 1; }
- else
- local mustSkipTests
- mustSkipTests=$(hasLabel ${prId} "skip-tests" ${repository})
- if [[ ${mustSkipTests} = "1" ]] ; then
- echo "The skip-tests label has been detected thus no test will be launched"
- buildAll=true
- elif [[ ${buildAll} = "true" ]] ; then
- echo "Cannot launch the tests of all projects, so no test will be launched"
+ done
+
+ # Build final_pl: testable file-path modules + dependency-detected + pom-only + extra
+ local final_pl=""
+ if [ -n "$testable_pl" ]; then
+ final_pl="$testable_pl"
+ fi
+ if [ -n "$dep_module_ids" ]; then
+ final_pl="${final_pl:+${final_pl},}${dep_module_ids}"
+ fi
+ if [ -n "$pom_only_pl" ]; then
+ final_pl="${final_pl:+${final_pl},}${pom_only_pl}"
+ fi
+
+ # Merge extra modules (e.g. from /component-test)
+ if [ -n "$extraModules" ]; then
+ echo ""
+ echo "Extra modules requested: $extraModules"
+ final_pl="${final_pl:+${final_pl},}${extraModules}"
+ fi
+
+ if [ -z "$final_pl" ]; then
+ echo ""
+ echo "No modules to test"
+ writeComment "incremental-test-comment.md" "" "" "" "" ""
+ exit 0
+ fi
+
+ echo ""
+ echo "Modules to test:"
+ for w in $(echo "$final_pl" | tr ',' '\n'); do
+ echo " - $w"
+ done
+ echo ""
+
+ # ── Step 4: Run tests ──
+ # Decide whether to use -amd (also-make-dependents):
+ # - Use -amd when there are testable file-path modules (to test their dependents)
+ # - Subject to threshold check to avoid testing too many modules
+ # - Pom-only modules are excluded from -pl to prevent -amd from pulling in everything
+ # (Maven builds them implicitly as dependencies of child modules)
+ local use_amd=false
+ local testDependents="0"
+
+ if [ -n "$testable_pl" ]; then
+ # File-path modules with tests — use -amd to catch dependents
+ if [ -n "$prId" ]; then
+ testDependents=$(hasLabel "${prId}" "test-dependents" "${repository}")
+ fi
+
+ if [[ ${testDependents} = "1" ]]; then
+ echo "The test-dependents label has been detected, testing dependents too"
+ use_amd=true
+ testedDependents=true
else
- local testDependents
- testDependents=$(hasLabel ${prId} "test-dependents" ${repository})
local totalTestableProjects
- if [[ ${testDependents} = "1" ]] ; then
- echo "The test-dependents label has been detected thus the projects that depend on affected projects will be tested"
- testedDependents=true
- totalTestableProjects=0
- else
- totalTestableProjects=$(./mvnw -B -q -amd exec:exec -Dexec.executable="pwd" -pl "$pl" | wc -l)
- fi
- if [[ ${totalTestableProjects} -gt ${maxNumberOfTestableProjects} ]] ; then
- echo "There are too many projects to test (${totalTestableProjects} > ${maxNumberOfTestableProjects}) so only the affected projects are tested:"
+ totalTestableProjects=$(./mvnw -B -q -amd exec:exec -Dexec.executable="pwd" -pl "$testable_pl" 2>/dev/null | wc -l) || true
+ totalTestableProjects=$(echo "$totalTestableProjects" | tail -1 | tr -d '[:space:]')
+ totalTestableProjects=${totalTestableProjects:-0}
+
+ if [[ ${totalTestableProjects} -gt ${maxNumberOfTestableProjects} ]]; then
+ echo "Too many dependent modules (${totalTestableProjects} > ${maxNumberOfTestableProjects}), testing only the affected modules"
testedDependents=false
- for w in $pl; do
- echo "$w"
- done
- # This need to install, other commands like test are not enough, otherwise test-infra will fail due to jandex maven plugin
- $mavenBinary -l $log $MVND_OPTS install -pl "$pl"
- ret=$?
else
- echo "Testing the affected projects and the projects that depend on them (${totalTestableProjects} modules):"
+ echo "Testing affected modules and their dependents (${totalTestableProjects} modules)"
+ use_amd=true
testedDependents=true
- for w in $pl; do
- echo "$w"
- done
- # This need to install, other commands like test are not enough, otherwise test-infra will fail due to jandex maven plugin
- $mavenBinary -l $log $MVND_OPTS install -pl "$pl" -amd
- ret=$?
fi
fi
+ elif [ -n "$dep_module_ids" ]; then
+ # Only dependency-detected modules (no file-path code changes)
+ echo "POM dependency analysis found affected modules — testing specific modules"
+ testedDependents=true
+ else
+ # Only pom-only modules, no testable code and no dependency results
+ echo "Only pom-only modules changed with no detected dependency impact"
+ testedDependents=true
fi
- # Write the list of tested modules to the step summary and PR comment file
- local comment_file="incremental-${mode}-comment.md"
- if [[ -n "$pl" && ${buildAll} != "true" ]] ; then
- echo "### Changed modules" >> "$GITHUB_STEP_SUMMARY"
- echo "" >> "$GITHUB_STEP_SUMMARY"
- echo "<!-- ci-tested-modules -->" > "$comment_file"
- echo ":test_tube: **CI tested the following changed modules:**" >> "$comment_file"
+ # Build the -pl argument:
+ # - Exclude pom-only modules from -pl when using -amd (they'd pull in everything)
+ # - Append exclusion list when dependency-detected modules are present
+ local build_pl="$final_pl"
+ if [[ "$use_amd" = true ]] && [ -n "$pom_only_pl" ]; then
+ # Remove pom-only modules — Maven builds them implicitly as dependencies
+ build_pl=""
+ if [ -n "$testable_pl" ]; then
+ build_pl="$testable_pl"
+ fi
+ if [ -n "$dep_module_ids" ]; then
+ build_pl="${build_pl:+${build_pl},}${dep_module_ids}"
+ fi
+ if [ -n "$extraModules" ]; then
+ build_pl="${build_pl:+${build_pl},}${extraModules}"
+ fi
+ fi
+ # This needs to install, not just test, otherwise test-infra will fail due to jandex maven plugin
+ # Exclusion list is only needed with -amd (to prevent testing generated/meta modules);
+ # without -amd, only the explicitly listed modules are built.
+ if [[ "$use_amd" = true ]]; then
+ $mavenBinary -l "$log" $MVND_OPTS install -pl "${build_pl},${EXCLUSION_LIST}" -amd || ret=$?
+ else
+ $mavenBinary -l "$log" $MVND_OPTS install -pl "$build_pl" || ret=$?
+ fi
+
+ # ── Step 5: Write comment and summary ──
+ local comment_file="incremental-test-comment.md"
+ writeComment "$comment_file" "$pl" "$dep_module_ids" "$all_changed_props" "$testedDependents" "$extraModules"
+
+ # Check for tests disabled in CI via @DisabledIfSystemProperty(named = "ci.env.name")
+ local disabled_tests
+ disabled_tests=$(detectDisabledTests "$final_pl")
+ if [ -n "$disabled_tests" ]; then
echo "" >> "$comment_file"
- for w in $(echo "$pl" | tr ',' '\n'); do
- echo "- \`$w\`" >> "$GITHUB_STEP_SUMMARY"
- echo "- \`$w\`" >> "$comment_file"
- done
- echo "" >> "$GITHUB_STEP_SUMMARY"
- # Add note about dependent modules testing scope
- if [[ ${mode} = "test" && "${testedDependents:-}" = "false" ]] ; then
+ echo ":warning: **Some tests are disabled on GitHub Actions** (\`@DisabledIfSystemProperty(named = \"ci.env.name\")\`) and require manual verification:" >> "$comment_file"
+ echo "$disabled_tests" >> "$comment_file"
+ fi
+
+ # Append reactor module list from build log
+ if [[ -f "$log" ]]; then
+ local reactor_modules
+ reactor_modules=$(grep '^\[INFO\] Camel ::' "$log" | sed 's/\[INFO\] //' | sed 's/ \..*$//' | sort -u || true)
+ if [[ -n "$reactor_modules" ]]; then
+ local count
+ count=$(echo "$reactor_modules" | wc -l | tr -d ' ')
+ local reactor_label
+ if [[ "${testedDependents}" = "false" ]]; then
+ reactor_label="Build reactor — dependencies compiled but only changed modules were tested"
+ else
+ reactor_label="All tested modules"
+ fi
+
echo "" >> "$comment_file"
- echo "> :information_source: Dependent modules were not tested because the total number of affected modules exceeded the threshold (${maxNumberOfTestableProjects}). Use the \`test-dependents\` label to force testing all dependents." >> "$comment_file"
+ echo "<details><summary>${reactor_label} ($count modules)</summary>" >> "$comment_file"
echo "" >> "$comment_file"
- fi
- # Extract full reactor module list from the build log
- if [[ -f "$log" ]] ; then
- local reactor_modules
- reactor_modules=$(grep '^\[INFO\] Camel ::' "$log" | sed 's/\[INFO\] //' | sed 's/ \..*$//' | sort -u)
- if [[ -n "$reactor_modules" ]] ; then
- local count
- count=$(echo "$reactor_modules" | wc -l | tr -d ' ')
- local reactor_label
- if [[ ${mode} = "test" && "${testedDependents:-}" = "false" ]] ; then
- reactor_label="Build reactor — dependencies compiled but only changed modules were tested"
- else
- reactor_label="All tested modules"
- fi
+
+ if [ -n "${GITHUB_STEP_SUMMARY:-}" ]; then
+ echo "" >> "$GITHUB_STEP_SUMMARY"
echo "<details><summary><b>${reactor_label} ($count)</b></summary>" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
- echo "" >> "$comment_file"
- echo "<details><summary>${reactor_label} ($count modules)</summary>" >> "$comment_file"
- echo "" >> "$comment_file"
- echo "$reactor_modules" | while read -r m; do
- echo "- $m" >> "$GITHUB_STEP_SUMMARY"
- echo "- $m" >> "$comment_file"
- done
+ fi
+
+ echo "$reactor_modules" | while read -r m; do
+ [ -n "${GITHUB_STEP_SUMMARY:-}" ] && echo "- $m" >> "$GITHUB_STEP_SUMMARY"
+ echo "- $m" >> "$comment_file"
+ done
+
+ if [ -n "${GITHUB_STEP_SUMMARY:-}" ]; then
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "</details>" >> "$GITHUB_STEP_SUMMARY"
- echo "" >> "$GITHUB_STEP_SUMMARY"
- echo "" >> "$comment_file"
- echo "</details>" >> "$comment_file"
fi
+ echo "" >> "$comment_file"
+ echo "</details>" >> "$comment_file"
fi
- elif [[ ${buildAll} = "true" ]] ; then
- echo "<!-- ci-tested-modules -->" > "$comment_file"
- echo ":information_source: CI did not run targeted module tests (all projects built or tests skipped)." >> "$comment_file"
fi
- if [[ ${ret} -ne 0 ]] ; then
+ # Write step summary header
+ if [ -n "${GITHUB_STEP_SUMMARY:-}" ]; then
+ {
+ echo "### Tested modules"
Review Comment:
Good catch! Fixed — added a blank line before the `###` heading so GitHub renders it as a proper H3.
_Claude Code on behalf of Guillaume Nodet_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore(ci): rationalize CI into single workflow with unified comment [camel]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #22247:
URL: https://github.com/apache/camel/pull/22247#issuecomment-4198845508
## [](https://sonarcloud.io/dashboard?id=apache_camel&pullRequest=22247) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_camel&pullRequest=22247&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_camel&pullRequest=22247&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_camel&pullRequest=22247&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_camel&pullRequest=22247&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_camel&pullRequest=22247&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_camel&pullRequest=22247)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore(ci): unify CI test infrastructure [camel]
Posted by "apupier (via GitHub)" <gi...@apache.org>.
apupier commented on code in PR #22247:
URL: https://github.com/apache/camel/pull/22247#discussion_r2986360576
##########
.github/workflows/pr-test-commenter.yml:
##########
@@ -0,0 +1,121 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Posts the CI test summary comment on PRs.
+# Uses workflow_run trigger so it runs in the base repo context with
+# full permissions — this allows posting comments on fork PRs too.
+
+name: Post CI test comment
+
+on:
+ workflow_run:
+ workflows: ["Build and test"]
+ types:
+ - completed
+
+jobs:
+ comment:
+ runs-on: ubuntu-latest
+ if: >
+ github.event.workflow_run.event == 'pull_request' ||
+ github.event.workflow_run.event == 'workflow_dispatch'
+ permissions:
+ pull-requests: write
+ actions: read
+ steps:
+ - name: Download CI comment artifact
+ uses: actions/github-script@v8
Review Comment:
needs to use an hash
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore(ci): unify CI test infrastructure [camel]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #22247:
URL: https://github.com/apache/camel/pull/22247#issuecomment-4125262817
_Claude Code on behalf of Guillaume Nodet_
Regarding testing: since `.github/**` is in `paths-ignore`, this PR won't trigger the build workflow automatically. We can test via manual dispatch:
```
gh workflow run "Build and test" -f pr_number=22247 -f pr_ref=ci-merge-incremental-build-detect-dependencies
```
Regarding the architecture doc: added `.github/CI-ARCHITECTURE.md` with an overview of all workflows, actions, labels, and their relationships.
All review comments have been addressed:
- `actions/github-script` pinned to hash
- `check-user-permission` re-added
- JDK 21 filter explained with inline comment
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore(ci): rationalize CI into single workflow with unified comment [camel]
Posted by "apupier (via GitHub)" <gi...@apache.org>.
apupier commented on code in PR #22247:
URL: https://github.com/apache/camel/pull/22247#discussion_r3000923852
##########
.github/actions/incremental-build/incremental-build.sh:
##########
@@ -15,229 +15,553 @@
# limitations under the License.
#
+# Incremental test runner for Apache Camel PRs.
+#
+# Determines which modules to test by:
+# 1. File-path analysis: maps changed files to their Maven modules
+# 2. POM dependency analysis: for changed pom.xml files, detects property
+# changes and finds modules that reference the affected properties
+#
+# Both sets of affected modules are merged and deduplicated before testing.
+
+set -euo pipefail
+
echo "Using MVND_OPTS=$MVND_OPTS"
-maxNumberOfBuildableProjects=100
maxNumberOfTestableProjects=50
-function findProjectRoot () {
+# Modules excluded from targeted testing (generated code, meta-modules, etc.)
+EXCLUSION_LIST="!:camel-allcomponents,!:dummy-component,!:camel-catalog,!:camel-catalog-console,!:camel-catalog-lucene,!:camel-catalog-maven,!:camel-catalog-suggest,!:camel-route-parser,!:camel-csimple-maven-plugin,!:camel-report-maven-plugin,!:camel-endpointdsl,!:camel-componentdsl,!:camel-endpointdsl-support,!:camel-yaml-dsl,!:camel-kamelet-main,!:camel-yaml-dsl-deserializers,!:camel-yaml-dsl-maven-plugin,!:camel-jbang-core,!:camel-jbang-main,!:camel-jbang-plugin-generate,!:camel-jbang-plugin-edit,!:camel-jbang-plugin-kubernetes,!:camel-jbang-plugin-test,!:camel-launcher,!:camel-jbang-it,!:camel-itest,!:docs,!:apache-camel,!:coverage"
+
+# ── Utility functions ──────────────────────────────────────────────────
+
+# Walk up from a file path to find the nearest directory containing a pom.xml
+findProjectRoot() {
local path=${1}
while [[ "$path" != "." ]]; do
- if [[ ! -e "$path/pom.xml" ]] ; then
- path=$(dirname $path)
- elif [[ $(dirname $path) == */src/it ]] ; then
- path=$(dirname $(dirname $path))
+ if [[ ! -e "$path/pom.xml" ]]; then
+ path=$(dirname "$path")
+ elif [[ $(dirname "$path") == */src/it ]]; then
+ path=$(dirname "$(dirname "$path")")
else
break
fi
done
echo "$path"
}
-function hasLabel() {
- local issueNumber=${1}
- local label="incremental-${2}"
- local repository=${3}
- curl -s \
- -H "Accept: application/vnd.github+json" \
- -H "Authorization: Bearer ${GITHUB_TOKEN}"\
- -H "X-GitHub-Api-Version: 2022-11-28" \
- "https://api.github.com/repos/${repository}/issues/${issueNumber}/labels" | jq -r '.[].name' | grep -c "$label"
+# Check whether a PR label exists
+hasLabel() {
+ local issueNumber=${1}
+ local label="incremental-${2}"
+ local repository=${3}
+ curl -s \
+ -H "Accept: application/vnd.github+json" \
+ -H "Authorization: Bearer ${GITHUB_TOKEN}" \
+ -H "X-GitHub-Api-Version: 2022-11-28" \
+ "https://api.github.com/repos/${repository}/issues/${issueNumber}/labels" | jq -r '.[].name' | { grep -c "$label" || true; }
}
-function main() {
- local mavenBinary=${1}
- local mode=${2}
- local log="incremental-${mode}.log"
- local prId=${3}
- local ret=0
- local repository=${4}
- local testedDependents=""
+# Fetch the PR diff from the GitHub API. Returns the full unified diff.
+fetchDiff() {
+ local prId="$1"
+ local repository="$2"
- echo "Searching for affected projects"
- local projects
local diff_output
- diff_output=$(curl -s -w "\n%{http_code}" -H "Authorization: Bearer ${GITHUB_TOKEN}" -H "Accept: application/vnd.github.v3.diff" "https://api.github.com/repos/${repository}/pulls/${prId}")
+ diff_output=$(curl -s -w "\n%{http_code}" \
+ -H "Authorization: Bearer ${GITHUB_TOKEN}" \
+ -H "Accept: application/vnd.github.v3.diff" \
+ "https://api.github.com/repos/${repository}/pulls/${prId}")
+
local http_code
http_code=$(echo "$diff_output" | tail -n 1)
local diff_body
diff_body=$(echo "$diff_output" | sed '$d')
- if [[ "$http_code" -lt 200 || "$http_code" -ge 300 || -z "$diff_body" ]] ; then
- echo "WARNING: Failed to fetch PR diff (HTTP $http_code). Falling back to full build."
- diff_body=""
+
+ if [[ "$http_code" -lt 200 || "$http_code" -ge 300 || -z "$diff_body" ]]; then
+ echo "WARNING: Failed to fetch PR diff (HTTP $http_code). Falling back to full build." >&2
+ return
+ fi
+ echo "$diff_body"
+}
+
+# ── POM dependency analysis (previously detect-dependencies) ───────────
+#
+# Uses the pre-#22022 approach: grep for ${property-name} references in
+# module pom.xml files. The Maveniverse Toolbox approach (introduced in
+# #22022, reverted in #22279) is intentionally not used here. See
+# CI-ARCHITECTURE.md for known limitations of the grep approach.
+
+# Extract the diff section for a specific pom.xml file from the full diff
+extractPomDiff() {
+ local diff_body="$1"
+ local pom_path="$2"
+
+ echo "$diff_body" | awk -v target="a/${pom_path}" '
+ /^diff --git/ && found { exit }
+ /^diff --git/ && index($0, target) { found=1 }
+ found { print }
+ '
+}
+
+# Detect which properties changed in a pom.xml diff.
+# Returns one property name per line.
+# Filters out structural XML elements (groupId, artifactId, version, etc.)
+# to only return actual property names (e.g. openai-java-version).
+detectChangedProperties() {
+ local diff_content="$1"
+
+ # Known structural POM elements that are NOT property names
+ local structural_elements="groupId|artifactId|version|scope|type|classifier|optional|systemPath|exclusions|exclusion|dependency|dependencies|dependencyManagement|parent|modules|module|packaging|name|description|url|relativePath"
+
+ echo "$diff_content" | \
+ grep -E '^[+-][[:space:]]*<[^>]+>[^<]*</[^>]+>' | \
+ grep -vE '^\+\+\+|^---' | \
+ sed -E 's/^[+-][[:space:]]*<([^>]+)>.*/\1/' | \
+ grep -vE "^(${structural_elements})$" | \
+ sort -u || true
+}
+
+# Find modules that reference a property in their pom.xml.
+# Searches pom.xml files under catalog/, components/, core/, dsl/ for
+# ${property_name} references and extracts the module's artifactId.
+# Adds discovered artifactIds to the dep_module_ids variable
+# (which must be declared in the caller).
+findAffectedModules() {
+ local property="$1"
+
+ local matches
+ matches=$(grep -rl "\${${property}}" --include="pom.xml" . 2>/dev/null | \
+ grep -v "^\./parent/pom.xml" | \
+ grep -v "/target/" || true)
+
+ if [ -z "$matches" ]; then
+ return
+ fi
+
+ while read -r pom_file; do
+ [ -z "$pom_file" ] && continue
+
+ # Only consider catalog, components, core, dsl paths (same as original detect-test.sh)
+ if [[ "$pom_file" == */catalog/* ]] || \
+ [[ "$pom_file" == */components/* ]] || \
+ [[ "$pom_file" == */core/* ]] || \
+ ([[ "$pom_file" == */dsl/* ]] && [[ "$pom_file" != */dsl/camel-jbang* ]]); then
+ local mod_artifact
+ mod_artifact=$(sed -n '/<parent>/,/<\/parent>/!{ s/.*<artifactId>\([^<]*\)<\/artifactId>.*/\1/p }' "$pom_file" | head -1)
+ if [ -n "$mod_artifact" ] && ! echo ",$dep_module_ids," | grep -q ",:${mod_artifact},"; then
+ echo " Property '\${${property}}' referenced by: $mod_artifact"
+ dep_module_ids="${dep_module_ids:+${dep_module_ids},}:${mod_artifact}"
+ fi
+ fi
+ done <<< "$matches"
+}
+
+# Analyze pom.xml changes to find affected modules via property grep.
+# Adds discovered module artifactIds to the dep_module_ids variable
+# (which must be declared in the caller).
+analyzePomDependencies() {
+ local diff_body="$1"
+ local pom_path="$2" # e.g. "parent/pom.xml" or "components/camel-foo/pom.xml"
+
+ local pom_diff
+ pom_diff=$(extractPomDiff "$diff_body" "$pom_path")
+ if [ -z "$pom_diff" ]; then
+ return
+ fi
+
+ local changed_props
+ changed_props=$(detectChangedProperties "$pom_diff")
+ if [ -z "$changed_props" ]; then
+ return
+ fi
+
+ echo " Property changes detected in ${pom_path}:"
+ echo "$changed_props" | while read -r p; do echo " - $p"; done
+
+ while read -r prop; do
+ [ -z "$prop" ] && continue
+ findAffectedModules "$prop"
+ done <<< "$changed_props"
+}
+
+# ── Disabled-test detection ─────────────────────────────────────────────
+
+# Scan tested modules for @DisabledIfSystemProperty(named = "ci.env.name")
+# and return a markdown warning listing affected files.
+detectDisabledTests() {
+ local final_pl="$1"
+ local skipped=""
+
+ for mod_path in $(echo "$final_pl" | tr ',' '\n'); do
+ # Skip artifactId-style references (e.g. :camel-openai) — only scan paths
+ if [[ "$mod_path" == :* ]]; then
+ continue
+ fi
+ if [ -d "$mod_path" ]; then
+ local matches
+ matches=$(grep -rl 'DisabledIfSystemProperty' "$mod_path" --include="*.java" 2>/dev/null \
+ | xargs grep -l 'ci.env.name' 2>/dev/null || true)
+ if [ -n "$matches" ]; then
+ local count
+ count=$(echo "$matches" | wc -l | tr -d ' ')
+ skipped="${skipped}\n- \`${mod_path}\`: ${count} test(s) disabled on GitHub Actions"
+ fi
+ fi
+ done
+
+ if [ -n "$skipped" ]; then
+ echo -e "$skipped"
+ fi
+}
+
+# ── Comment generation ─────────────────────────────────────────────────
+
+writeComment() {
+ local comment_file="$1"
+ local pl="$2"
+ local dep_ids="$3"
+ local changed_props_summary="$4"
+ local testedDependents="$5"
+ local extra_modules="$6"
+
+ echo "<!-- ci-tested-modules -->" > "$comment_file"
+
+ # Section 1: file-path-based modules
+ if [ -n "$pl" ]; then
+ echo ":test_tube: **CI tested the following changed modules:**" >> "$comment_file"
+ echo "" >> "$comment_file"
+ for w in $(echo "$pl" | tr ',' '\n'); do
+ echo "- \`$w\`" >> "$comment_file"
+ done
+
+ if [[ "${testedDependents}" = "false" ]]; then
+ echo "" >> "$comment_file"
+ echo "> :information_source: Dependent modules were not tested because the total number of affected modules exceeded the threshold (${maxNumberOfTestableProjects}). Use the \`test-dependents\` label to force testing all dependents." >> "$comment_file"
+ fi
fi
+
+ # Section 2: pom dependency-detected modules
+ if [ -n "$dep_ids" ]; then
+ echo "" >> "$comment_file"
+ if [ -n "$changed_props_summary" ]; then
+ echo ":white_check_mark: **POM dependency changes: targeted tests included**" >> "$comment_file"
+ echo "" >> "$comment_file"
+ echo "Changed properties: ${changed_props_summary}" >> "$comment_file"
+ echo "" >> "$comment_file"
+ local dep_count
+ dep_count=$(echo "$dep_ids" | tr ',' '\n' | wc -l | tr -d ' ')
+ echo "<details><summary>Modules affected by dependency changes (${dep_count})</summary>" >> "$comment_file"
+ echo "" >> "$comment_file"
+ echo "$dep_ids" | tr ',' '\n' | while read -r m; do
+ echo "- \`$m\`" >> "$comment_file"
+ done
+ echo "" >> "$comment_file"
+ echo "</details>" >> "$comment_file"
+ fi
+ fi
+
+ # Section 3: extra modules (from /component-test)
+ if [ -n "$extra_modules" ]; then
+ echo "" >> "$comment_file"
+ echo ":heavy_plus_sign: **Additional modules tested** (via \`/component-test\`):" >> "$comment_file"
+ echo "" >> "$comment_file"
+ for w in $(echo "$extra_modules" | tr ',' '\n'); do
+ echo "- \`$w\`" >> "$comment_file"
+ done
+ fi
+
+ if [ -z "$pl" ] && [ -z "$dep_ids" ] && [ -z "$extra_modules" ]; then
+ echo ":information_source: CI did not run targeted module tests." >> "$comment_file"
+ fi
+}
+
+# ── Main ───────────────────────────────────────────────────────────────
+
+main() {
+ local mavenBinary=${1}
+ local prId=${2}
+ local repository=${3}
+ local extraModules=${4:-}
+ local log="incremental-test.log"
+ local ret=0
+ local testedDependents=""
+
+ # Check for skip-tests label (only for PR builds)
+ if [ -n "$prId" ]; then
+ local mustSkipTests
+ mustSkipTests=$(hasLabel "${prId}" "skip-tests" "${repository}")
+ if [[ ${mustSkipTests} = "1" ]]; then
+ echo "The skip-tests label has been detected, no tests will be launched"
+ echo "<!-- ci-tested-modules -->" > "incremental-test-comment.md"
+ echo ":information_source: CI did not run targeted module tests (skip-tests label detected)." >> "incremental-test-comment.md"
+ exit 0
+ fi
+ fi
+
+ # Fetch the diff (PR diff via API, or git diff for push builds)
+ local diff_body
+ if [ -n "$prId" ]; then
+ echo "Fetching PR #${prId} diff..."
+ diff_body=$(fetchDiff "$prId" "$repository")
+ else
+ echo "No PR ID, using git diff HEAD~1..."
+ diff_body=$(git diff HEAD~1 2>/dev/null || true)
+ fi
+
+ if [ -z "$diff_body" ]; then
+ echo "Could not fetch diff, skipping tests"
+ exit 0
+ fi
+
+ # ── Step 1: File-path analysis ──
+ echo "Searching for affected projects by file path..."
+ local projects
projects=$(echo "$diff_body" | sed -n -e '/^diff --git a/p' | awk '{print $3}' | cut -b 3- | sed 's|\(.*\)/.*|\1|' | uniq | sort)
+
local pl=""
local lastProjectRoot=""
- local buildAll=false
local totalAffected=0
- for project in ${projects}
- do
- if [[ ${project} == */archetype-resources ]] ; then
+ local pom_files=""
+
+ for project in ${projects}; do
+ if [[ ${project} == */archetype-resources ]]; then
continue
- elif [[ ${project} != .* ]] ; then
+ elif [[ ${project} != .* ]]; then
local projectRoot
- projectRoot=$(findProjectRoot ${project})
- if [[ ${projectRoot} = "." ]] ; then
- echo "The root project is affected, so a complete build is triggered"
- buildAll=true
- totalAffected=1
- break
- elif [[ ${projectRoot} != "${lastProjectRoot}" ]] ; then
- (( totalAffected ++ ))
+ projectRoot=$(findProjectRoot "${project}")
+ if [[ ${projectRoot} = "." ]]; then
+ echo "The root project is affected, skipping targeted module testing"
+ echo "<!-- ci-tested-modules -->" > "incremental-test-comment.md"
+ echo ":information_source: CI did not run targeted module tests (root project files changed)." >> "incremental-test-comment.md"
+ exit 0
+ elif [[ ${projectRoot} != "${lastProjectRoot}" ]]; then
+ totalAffected=$((totalAffected + 1))
pl="$pl,${projectRoot}"
lastProjectRoot=${projectRoot}
fi
fi
done
+ pl="${pl:1}" # strip leading comma
- if [[ ${totalAffected} = 0 ]] ; then
- echo "There is nothing to build"
- exit 0
- elif [[ ${totalAffected} -gt ${maxNumberOfBuildableProjects} ]] ; then
- echo "There are too many affected projects, so a complete build is triggered"
- buildAll=true
- fi
- pl="${pl:1}"
-
- if [[ ${mode} = "build" ]] ; then
- local mustBuildAll
- mustBuildAll=$(hasLabel ${prId} "build-all" ${repository})
- if [[ ${mustBuildAll} = "1" ]] ; then
- echo "The build-all label has been detected thus all projects must be built"
- buildAll=true
- fi
- if [[ ${buildAll} = "true" ]] ; then
- echo "Building all projects"
- $mavenBinary -l $log $MVND_OPTS -DskipTests install
- ret=$?
- else
- local buildDependents
- buildDependents=$(hasLabel ${prId} "build-dependents" ${repository})
- local totalTestableProjects
- if [[ ${buildDependents} = "1" ]] ; then
- echo "The build-dependents label has been detected thus the projects that depend on the affected projects will be built"
- totalTestableProjects=0
- else
- for w in $pl; do
- echo "$w"
- done
- totalTestableProjects=$(./mvnw -B -q -amd exec:exec -Dexec.executable="pwd" -pl "$pl" | wc -l)
- fi
- if [[ ${totalTestableProjects} -gt ${maxNumberOfTestableProjects} ]] ; then
- echo "Launching fast build command against the projects ${pl}, their dependencies and the projects that depend on them"
- for w in $pl; do
- echo "$w"
- done
- $mavenBinary -l $log $MVND_OPTS -DskipTests install -pl "$pl" -amd -am
- ret=$?
- else
- echo "Launching fast build command against the projects ${pl} and their dependencies"
- for w in $pl; do
- echo "$w"
- done
- $mavenBinary -l $log $MVND_OPTS -DskipTests install -pl "$pl" -am
- ret=$?
+ # Only analyze parent/pom.xml for dependency detection
+ # (matches original detect-test.sh behavior; detection improvements deferred to follow-up PR)
+ if echo "$diff_body" | grep -q '^diff --git a/parent/pom.xml'; then
+ pom_files="parent/pom.xml"
+ fi
+
+ # ── Step 2: POM dependency analysis ──
+ # Variables shared with analyzePomDependencies/findAffectedModules
+ local dep_module_ids=""
+ local all_changed_props=""
+
+ if [ -n "$pom_files" ]; then
+ echo ""
+ echo "Analyzing parent POM dependency changes..."
+ while read -r pom_file; do
+ [ -z "$pom_file" ] && continue
+
+ # Capture changed props for this pom before calling analyze
+ local pom_diff
+ pom_diff=$(extractPomDiff "$diff_body" "$pom_file")
+ if [ -n "$pom_diff" ]; then
+ local props
+ props=$(detectChangedProperties "$pom_diff")
+ if [ -n "$props" ]; then
+ all_changed_props="${all_changed_props:+${all_changed_props}, }$(echo "$props" | tr '\n' ',' | sed 's/,$//')"
+ fi
fi
+
+ analyzePomDependencies "$diff_body" "$pom_file"
+ done <<< "$pom_files"
+ fi
+
+ # ── Step 3: Merge and deduplicate ──
+ # Separate file-path modules into testable (has src/test) and pom-only.
+ # Pom-only modules (e.g. "parent") are kept in the build list but must NOT
+ # be expanded with -amd, since that would pull in every dependent module.
+ local testable_pl=""
+ local pom_only_pl=""
+ for w in $(echo "$pl" | tr ',' '\n'); do
+ if [ -d "$w/src/test" ]; then
+ testable_pl="${testable_pl:+${testable_pl},}${w}"
+ else
+ pom_only_pl="${pom_only_pl:+${pom_only_pl},}${w}"
+ echo " Pom-only module (no src/test, won't expand dependents): $w"
fi
- [[ -z $(git status --porcelain | grep -v antora.yml) ]] || { echo 'There are uncommitted changes'; git status; echo; echo; git diff; exit 1; }
- else
- local mustSkipTests
- mustSkipTests=$(hasLabel ${prId} "skip-tests" ${repository})
- if [[ ${mustSkipTests} = "1" ]] ; then
- echo "The skip-tests label has been detected thus no test will be launched"
- buildAll=true
- elif [[ ${buildAll} = "true" ]] ; then
- echo "Cannot launch the tests of all projects, so no test will be launched"
+ done
+
+ # Build final_pl: testable file-path modules + dependency-detected + pom-only + extra
+ local final_pl=""
+ if [ -n "$testable_pl" ]; then
+ final_pl="$testable_pl"
+ fi
+ if [ -n "$dep_module_ids" ]; then
+ final_pl="${final_pl:+${final_pl},}${dep_module_ids}"
+ fi
+ if [ -n "$pom_only_pl" ]; then
+ final_pl="${final_pl:+${final_pl},}${pom_only_pl}"
+ fi
+
+ # Merge extra modules (e.g. from /component-test)
+ if [ -n "$extraModules" ]; then
+ echo ""
+ echo "Extra modules requested: $extraModules"
+ final_pl="${final_pl:+${final_pl},}${extraModules}"
+ fi
+
+ if [ -z "$final_pl" ]; then
+ echo ""
+ echo "No modules to test"
+ writeComment "incremental-test-comment.md" "" "" "" "" ""
+ exit 0
+ fi
+
+ echo ""
+ echo "Modules to test:"
+ for w in $(echo "$final_pl" | tr ',' '\n'); do
+ echo " - $w"
+ done
+ echo ""
+
+ # ── Step 4: Run tests ──
+ # Decide whether to use -amd (also-make-dependents):
+ # - Use -amd when there are testable file-path modules (to test their dependents)
+ # - Subject to threshold check to avoid testing too many modules
+ # - Pom-only modules are excluded from -pl to prevent -amd from pulling in everything
+ # (Maven builds them implicitly as dependencies of child modules)
+ local use_amd=false
+ local testDependents="0"
+
+ if [ -n "$testable_pl" ]; then
+ # File-path modules with tests — use -amd to catch dependents
+ if [ -n "$prId" ]; then
+ testDependents=$(hasLabel "${prId}" "test-dependents" "${repository}")
+ fi
+
+ if [[ ${testDependents} = "1" ]]; then
+ echo "The test-dependents label has been detected, testing dependents too"
+ use_amd=true
+ testedDependents=true
else
- local testDependents
- testDependents=$(hasLabel ${prId} "test-dependents" ${repository})
local totalTestableProjects
- if [[ ${testDependents} = "1" ]] ; then
- echo "The test-dependents label has been detected thus the projects that depend on affected projects will be tested"
- testedDependents=true
- totalTestableProjects=0
- else
- totalTestableProjects=$(./mvnw -B -q -amd exec:exec -Dexec.executable="pwd" -pl "$pl" | wc -l)
- fi
- if [[ ${totalTestableProjects} -gt ${maxNumberOfTestableProjects} ]] ; then
- echo "There are too many projects to test (${totalTestableProjects} > ${maxNumberOfTestableProjects}) so only the affected projects are tested:"
+ totalTestableProjects=$(./mvnw -B -q -amd exec:exec -Dexec.executable="pwd" -pl "$testable_pl" 2>/dev/null | wc -l) || true
+ totalTestableProjects=$(echo "$totalTestableProjects" | tail -1 | tr -d '[:space:]')
+ totalTestableProjects=${totalTestableProjects:-0}
+
+ if [[ ${totalTestableProjects} -gt ${maxNumberOfTestableProjects} ]]; then
+ echo "Too many dependent modules (${totalTestableProjects} > ${maxNumberOfTestableProjects}), testing only the affected modules"
testedDependents=false
- for w in $pl; do
- echo "$w"
- done
- # This need to install, other commands like test are not enough, otherwise test-infra will fail due to jandex maven plugin
- $mavenBinary -l $log $MVND_OPTS install -pl "$pl"
- ret=$?
else
- echo "Testing the affected projects and the projects that depend on them (${totalTestableProjects} modules):"
+ echo "Testing affected modules and their dependents (${totalTestableProjects} modules)"
+ use_amd=true
testedDependents=true
- for w in $pl; do
- echo "$w"
- done
- # This need to install, other commands like test are not enough, otherwise test-infra will fail due to jandex maven plugin
- $mavenBinary -l $log $MVND_OPTS install -pl "$pl" -amd
- ret=$?
fi
fi
+ elif [ -n "$dep_module_ids" ]; then
+ # Only dependency-detected modules (no file-path code changes)
+ echo "POM dependency analysis found affected modules — testing specific modules"
+ testedDependents=true
+ else
+ # Only pom-only modules, no testable code and no dependency results
+ echo "Only pom-only modules changed with no detected dependency impact"
+ testedDependents=true
fi
- # Write the list of tested modules to the step summary and PR comment file
- local comment_file="incremental-${mode}-comment.md"
- if [[ -n "$pl" && ${buildAll} != "true" ]] ; then
- echo "### Changed modules" >> "$GITHUB_STEP_SUMMARY"
- echo "" >> "$GITHUB_STEP_SUMMARY"
- echo "<!-- ci-tested-modules -->" > "$comment_file"
- echo ":test_tube: **CI tested the following changed modules:**" >> "$comment_file"
+ # Build the -pl argument:
+ # - Exclude pom-only modules from -pl when using -amd (they'd pull in everything)
+ # - Append exclusion list when dependency-detected modules are present
+ local build_pl="$final_pl"
+ if [[ "$use_amd" = true ]] && [ -n "$pom_only_pl" ]; then
+ # Remove pom-only modules — Maven builds them implicitly as dependencies
+ build_pl=""
+ if [ -n "$testable_pl" ]; then
+ build_pl="$testable_pl"
+ fi
+ if [ -n "$dep_module_ids" ]; then
+ build_pl="${build_pl:+${build_pl},}${dep_module_ids}"
+ fi
+ if [ -n "$extraModules" ]; then
+ build_pl="${build_pl:+${build_pl},}${extraModules}"
+ fi
+ fi
+ # This needs to install, not just test, otherwise test-infra will fail due to jandex maven plugin
+ # Exclusion list is only needed with -amd (to prevent testing generated/meta modules);
+ # without -amd, only the explicitly listed modules are built.
+ if [[ "$use_amd" = true ]]; then
+ $mavenBinary -l "$log" $MVND_OPTS install -pl "${build_pl},${EXCLUSION_LIST}" -amd || ret=$?
+ else
+ $mavenBinary -l "$log" $MVND_OPTS install -pl "$build_pl" || ret=$?
+ fi
+
+ # ── Step 5: Write comment and summary ──
+ local comment_file="incremental-test-comment.md"
+ writeComment "$comment_file" "$pl" "$dep_module_ids" "$all_changed_props" "$testedDependents" "$extraModules"
+
+ # Check for tests disabled in CI via @DisabledIfSystemProperty(named = "ci.env.name")
+ local disabled_tests
+ disabled_tests=$(detectDisabledTests "$final_pl")
+ if [ -n "$disabled_tests" ]; then
echo "" >> "$comment_file"
- for w in $(echo "$pl" | tr ',' '\n'); do
- echo "- \`$w\`" >> "$GITHUB_STEP_SUMMARY"
- echo "- \`$w\`" >> "$comment_file"
- done
- echo "" >> "$GITHUB_STEP_SUMMARY"
- # Add note about dependent modules testing scope
- if [[ ${mode} = "test" && "${testedDependents:-}" = "false" ]] ; then
+ echo ":warning: **Some tests are disabled on GitHub Actions** (\`@DisabledIfSystemProperty(named = \"ci.env.name\")\`) and require manual verification:" >> "$comment_file"
+ echo "$disabled_tests" >> "$comment_file"
+ fi
+
+ # Append reactor module list from build log
+ if [[ -f "$log" ]]; then
+ local reactor_modules
+ reactor_modules=$(grep '^\[INFO\] Camel ::' "$log" | sed 's/\[INFO\] //' | sed 's/ \..*$//' | sort -u || true)
+ if [[ -n "$reactor_modules" ]]; then
+ local count
+ count=$(echo "$reactor_modules" | wc -l | tr -d ' ')
+ local reactor_label
+ if [[ "${testedDependents}" = "false" ]]; then
+ reactor_label="Build reactor — dependencies compiled but only changed modules were tested"
+ else
+ reactor_label="All tested modules"
+ fi
+
echo "" >> "$comment_file"
- echo "> :information_source: Dependent modules were not tested because the total number of affected modules exceeded the threshold (${maxNumberOfTestableProjects}). Use the \`test-dependents\` label to force testing all dependents." >> "$comment_file"
+ echo "<details><summary>${reactor_label} ($count modules)</summary>" >> "$comment_file"
echo "" >> "$comment_file"
- fi
- # Extract full reactor module list from the build log
- if [[ -f "$log" ]] ; then
- local reactor_modules
- reactor_modules=$(grep '^\[INFO\] Camel ::' "$log" | sed 's/\[INFO\] //' | sed 's/ \..*$//' | sort -u)
- if [[ -n "$reactor_modules" ]] ; then
- local count
- count=$(echo "$reactor_modules" | wc -l | tr -d ' ')
- local reactor_label
- if [[ ${mode} = "test" && "${testedDependents:-}" = "false" ]] ; then
- reactor_label="Build reactor — dependencies compiled but only changed modules were tested"
- else
- reactor_label="All tested modules"
- fi
+
+ if [ -n "${GITHUB_STEP_SUMMARY:-}" ]; then
+ echo "" >> "$GITHUB_STEP_SUMMARY"
echo "<details><summary><b>${reactor_label} ($count)</b></summary>" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
- echo "" >> "$comment_file"
- echo "<details><summary>${reactor_label} ($count modules)</summary>" >> "$comment_file"
- echo "" >> "$comment_file"
- echo "$reactor_modules" | while read -r m; do
- echo "- $m" >> "$GITHUB_STEP_SUMMARY"
- echo "- $m" >> "$comment_file"
- done
+ fi
+
+ echo "$reactor_modules" | while read -r m; do
+ [ -n "${GITHUB_STEP_SUMMARY:-}" ] && echo "- $m" >> "$GITHUB_STEP_SUMMARY"
+ echo "- $m" >> "$comment_file"
+ done
+
+ if [ -n "${GITHUB_STEP_SUMMARY:-}" ]; then
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "</details>" >> "$GITHUB_STEP_SUMMARY"
- echo "" >> "$GITHUB_STEP_SUMMARY"
- echo "" >> "$comment_file"
- echo "</details>" >> "$comment_file"
fi
+ echo "" >> "$comment_file"
+ echo "</details>" >> "$comment_file"
fi
- elif [[ ${buildAll} = "true" ]] ; then
- echo "<!-- ci-tested-modules -->" > "$comment_file"
- echo ":information_source: CI did not run targeted module tests (all projects built or tests skipped)." >> "$comment_file"
fi
- if [[ ${ret} -ne 0 ]] ; then
+ # Write step summary header
+ if [ -n "${GITHUB_STEP_SUMMARY:-}" ]; then
+ {
+ echo "### Tested modules"
Review Comment:
nitpick (not blocking merge if everything else is working): I think this can be rendered a bit better in the GitHub interface. Currently the 3 # are not interpreted and displayed directly. I think that the intent wasn't this one
<img width="544" height="266" alt="Image" src="https://github.com/user-attachments/assets/b803784f-806f-4516-97a8-322f61b1b5a5" />
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore(ci): unify CI test infrastructure [camel]
Posted by "apupier (via GitHub)" <gi...@apache.org>.
apupier commented on code in PR #22247:
URL: https://github.com/apache/camel/pull/22247#discussion_r2986371948
##########
.github/workflows/pr-test-commenter.yml:
##########
@@ -0,0 +1,121 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Posts the CI test summary comment on PRs.
+# Uses workflow_run trigger so it runs in the base repo context with
+# full permissions — this allows posting comments on fork PRs too.
+
+name: Post CI test comment
+
+on:
+ workflow_run:
+ workflows: ["Build and test"]
+ types:
+ - completed
+
+jobs:
+ comment:
+ runs-on: ubuntu-latest
+ if: >
+ github.event.workflow_run.event == 'pull_request' ||
+ github.event.workflow_run.event == 'workflow_dispatch'
+ permissions:
+ pull-requests: write
+ actions: read
+ steps:
+ - name: Download CI comment artifact
+ uses: actions/github-script@v8
Review Comment:
realizing that it was not using an hash before, so well fine to change it in another PR
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore(ci): rationalize CI into single workflow with unified comment [camel]
Posted by "apupier (via GitHub)" <gi...@apache.org>.
apupier commented on PR #22247:
URL: https://github.com/apache/camel/pull/22247#issuecomment-4183650279
Every time there is a change on the PR, the tests must be relaunched to be able to check the output of the pipeline
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore(ci): rationalize CI into single workflow with unified comment [camel]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #22247:
URL: https://github.com/apache/camel/pull/22247#issuecomment-4138133767
## Fork Testing Report
_Claude Code on behalf of Guillaume Nodet_
Ran manual tests on `gnodet/camel` fork using `workflow_dispatch` to validate the CI changes in this PR. Three scenarios were tested:
### Test 1: Component file change detection ✅
**Run:** [23613433728](https://github.com/gnodet/camel/actions/runs/23613433728) — **All 3 JDKs passed**
Changed `components/camel-http/HttpComponent.java` and verified:
- ✅ File-path analysis correctly detected `components/camel-http`
- ✅ Dependent module count (88) correctly exceeded threshold (50) → tested only affected module
- ✅ Full regen.sh build + incremental test pipeline completed successfully
- ✅ CI comment artifact uploaded correctly
### Test 2: Parent POM dependency detection ✅ (script worked, tests failed)
**Run:** [23613434374](https://github.com/gnodet/camel/actions/runs/23613434374) — **JDK 21 failed (test failures)**
Changed `jetty-version` property comment in `parent/pom.xml` and verified:
- ✅ POM dependency analysis correctly detected `jetty-version` property change
- ✅ Found all 8 modules referencing `${jetty-version}`: camel-undertow, camel-cometd, camel-platform-http, camel-jetty-common, camel-salesforce-maven-plugin, camel-salesforce, camel-jetty, camel-thymeleaf
- ✅ Correctly identified `parent` as pom-only module (no src/test, won't expand dependents)
- ❌ Actual test failures in detected modules (expected — these are real component tests that can fail independently)
### Test 3: skip_full_build + extra_modules (`/component-test` path) ✅ (script worked, tests failed)
**Run:** [23615655184](https://github.com/gnodet/camel/actions/runs/23615655184) — **JDK 17/25 failed (test failures)**
Dispatched with `skip_full_build=true` and `extra_modules=components/camel-direct`:
- ✅ Quick dependency build used instead of regen.sh
- ✅ Extra modules correctly merged with file-path detected modules
- ✅ Dependent module count correctly calculated as 24 (< 50 threshold) → tested all dependents
- ❌ Actual test failures in dependent modules (expected)
### Bugs Found and Fixed
1. **Pipefail bug in dependent count** (line 448): When `./mvnw` returns non-zero, `pipefail` causes the `|| echo "0"` fallback to append "0" to the `wc -l` output, producing values like `"24\n0"` that break the `[[ -gt ]]` comparison. Fixed by using `|| true` and extracting the last line.
2. **Hardcoded `github-repo` default**: The `action.yaml` had `default: 'apache/camel'` instead of `default: ${{ github.repository }}`. This prevented the script from fetching PR diffs on forks. Fixed to use `${{ github.repository }}`.
Both fixes are included in commit b9e4fd7594c4.
### Summary
All three code paths in `incremental-build.sh` are working correctly:
- **File-path detection** → identifies changed modules from PR diff
- **POM dependency detection** → finds modules affected by parent POM property changes
- **Extra modules merging** → correctly adds `/component-test` modules to the test set
- **skip_full_build** → correctly uses quick build instead of regen.sh
- **Dependent module threshold** → correctly counts and applies the 50-module limit
- **CI comment artifact** → uploaded correctly for the commenter workflow
The test failures (exit code 1) in Tests 2 and 3 are from actual Camel component tests, not from the CI script itself.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore(ci): rationalize CI into single workflow with unified comment [camel]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #22247:
URL: https://github.com/apache/camel/pull/22247#issuecomment-4156101440
Related: 057bc9875f5a adds a "manual IT advisory" mechanism on top of this PR's unified comment infrastructure.
When changed modules have associated integration tests that are excluded from CI (e.g. `camel-jbang-core` → `camel-jbang-it`), the unified PR comment will now include a section advising the contributor to run them manually. The mapping is maintained in `manual-it-mapping.txt` co-located with the incremental build script.
This was motivated by apache/camel#22337 where two regressions in `camel-jbang-core` (logging config + jbang flag) went undetected because the JBang ITs are excluded from CI and there was no signal to run them.
_Claude Code on behalf of Guillaume Nodet_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore(ci): rationalize CI into single workflow with unified comment [camel]
Posted by "apupier (via GitHub)" <gi...@apache.org>.
apupier commented on PR #22247:
URL: https://github.com/apache/camel/pull/22247#issuecomment-4169652530
conflict to resolve
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore(ci): unify CI test infrastructure [camel]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #22247:
URL: https://github.com/apache/camel/pull/22247#issuecomment-4127167520
_Claude Code on behalf of Guillaume Nodet_
The `workflow_dispatch` approach doesn't work for testing CI changes — it runs the workflow YAML from `main`, not the PR branch. The dispatched run used the old scripts and expectedly failed.
Pushed a dummy `parent/pom.xml` change to trigger the `pull_request` event, which will use our branch's workflow files. This also exercises the "parent pom changed" path of the new script. Will revert before merging.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore(ci): unify CI test infrastructure [camel]
Posted by "apupier (via GitHub)" <gi...@apache.org>.
apupier commented on PR #22247:
URL: https://github.com/apache/camel/pull/22247#issuecomment-4126975967
What is the output of the way indicated to test it?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore(ci): rationalize CI into single workflow with unified comment [camel]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #22247:
URL: https://github.com/apache/camel/pull/22247#issuecomment-4145741741
> for this pointed build, in the incremental-test logs, we can notice that it tries to launch tests on 498 modules it doesn't seems to correspond to the mentioned 24.
Good catch! The threshold check was only counting dependents of file-path detected modules (`testable_pl`), but when `-amd` was used, `extraModules` (like `camel-direct`) were also expanded by Maven. Since `camel-direct` is used by nearly every component, the actual reactor was ~498 modules instead of the expected 24.
Fixed by including `extraModules` in the threshold count so the check accurately reflects what Maven will actually build.
_Claude Code on behalf of Guillaume Nodet_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore(ci): merge detect-dependencies into incremental-build [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #22247:
URL: https://github.com/apache/camel/pull/22247#issuecomment-4121736244
:star2: Thank you for your contribution to the Apache Camel project! :star2:
:robot: CI automation will test this PR automatically.
:camel: Apache Camel Committers, please review the following items:
* First-time contributors **require MANUAL approval** for the GitHub Actions to run
* You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot although they are normally detected and executed by CI.
* You can label PRs using `build-all`, `build-dependents`, `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
* Build and test logs are available in the summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
:warning: Be careful when sharing logs. Review their contents before sharing them publicly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore(ci): unify CI test infrastructure [camel]
Posted by "apupier (via GitHub)" <gi...@apache.org>.
apupier commented on code in PR #22247:
URL: https://github.com/apache/camel/pull/22247#discussion_r2986355667
##########
.github/workflows/pr-manual-component-test.yml:
##########
@@ -28,20 +28,16 @@ jobs:
name: PR comment
if: ${{ github.repository == 'apache/camel' && github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'CONTRIBUTOR') && startsWith(github.event.comment.body, '/component-test') }}
permissions:
- pull-requests: write # to comment on a pull request
- actions: read # to download artifact
+ pull-requests: write
+ actions: write # to dispatch workflows
runs-on: ubuntu-latest
- strategy:
- matrix:
- java: [ '21' ]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- submodules: recursive
- - name: Check Permission
- uses: actions-cool/check-user-permission@7b90a27f92f3961b368376107661682c441f6103
Review Comment:
Why the check user permission has been removed?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore(ci): rationalize CI into single workflow with unified comment [camel]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #22247:
URL: https://github.com/apache/camel/pull/22247#issuecomment-4138804452
## Updated Fork Testing Report
_Claude Code on behalf of Guillaume Nodet_
After fixing the bugs found in the first round, re-ran the failing tests. All 3 code paths now pass.
### Test 1: Component file change detection ✅
**Run:** [23613433728](https://github.com/gnodet/camel/actions/runs/23613433728) — **All 3 JDKs passed**
- ✅ File-path analysis correctly detected `components/camel-http`
- ✅ Dependent module threshold (88 > 50) correctly applied
### Test 2: Parent POM dependency detection ✅
**Run:** [23620804048](https://github.com/gnodet/camel/actions/runs/23620804048) — **All 3 JDKs passed**
- ✅ POM dependency analysis detected `jetty-version` property change
- ✅ Found all 8 referencing modules (camel-undertow, camel-cometd, camel-platform-http, camel-jetty-common, camel-salesforce-maven-plugin, camel-salesforce, camel-jetty, camel-thymeleaf)
- ✅ Correctly identified `parent` as pom-only module
- ✅ Tests passed on all detected modules
### Test 3: skip_full_build + extra_modules (`/component-test` path) ✅ (script correct, flaky test failures)
**Run:** [23615655184](https://github.com/gnodet/camel/actions/runs/23615655184) — **JDK 17/25 failed (flaky test failures)**
- ✅ Quick dependency build used instead of regen.sh
- ✅ Extra modules correctly merged with file-path detected modules
- ✅ Dependent module count correctly calculated as 24 (< 50 threshold)
- ❌ Exit code 1 from actual test failures in camel-http dependent modules (not a CI script bug)
### Bugs Found and Fixed
| Bug | Commit | Description |
|-----|--------|-------------|
| Pipefail in dependent count | b9e4fd7 | `wc -l \|\| echo "0"` under `set -o pipefail` produced `"24\n0"`, breaking `[[ -gt ]]` |
| Hardcoded github-repo default | b9e4fd7 | `action.yaml` default was `'apache/camel'` instead of `${{ github.repository }}` |
| Exclusion list without -amd | 636e55b | `!:camel-allcomponents` exclusion syntax fails when modules aren't in reactor (no `-amd`) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore(ci): rationalize CI into single workflow with unified comment [camel]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #22247:
URL: https://github.com/apache/camel/pull/22247#issuecomment-4185211494
_Claude Code on behalf of Guillaume Nodet_
### Fork testing results (round 4 — all green ✅)
Tested the full CI pipeline on the [gnodet/camel](https://github.com/gnodet/camel) fork with two separate PRs, each exercising a different detection path.
---
#### PR #1: File-path detection — [gnodet/camel#13](https://github.com/gnodet/camel/pull/13)
**Change:** Added a comment to `components/camel-bean/src/test/java/.../BeanInfoTest.java`
**Expected:** CI detects `components/camel-bean` as affected module
**Run:** [Build and test #23959189857](https://github.com/gnodet/camel/actions/runs/23959189857) — ✅ all 3 JDK jobs passed
CI comment posted on the PR:
> 🧪 **CI tested the following changed modules:**
>
> - `components/camel-bean`
>
> > ℹ️ Dependent modules were not tested because the total number of affected modules exceeded the threshold (50). Use the `test-dependents` label to force testing all dependents.
---
#### PR #2: POM dependency detection — [gnodet/camel#14](https://github.com/gnodet/camel/pull/14)
**Change:** Changed `commons-lang3-version` from 3.20.0 to 3.19.0 in `parent/pom.xml`
**Expected:** CI detects property change, finds modules referencing `${commons-lang3-version}`
**Run:** [Build and test #23959192108](https://github.com/gnodet/camel/actions/runs/23959192108) — ✅ all 3 JDK jobs passed
CI comment posted on the PR:
> 🧪 **CI tested the following changed modules:**
>
> - `parent`
>
> ✅ **POM dependency changes: targeted tests included**
>
> Changed properties: commons-lang3-version
>
> Modules affected by dependency changes (2):
> - `:camel-report-maven-plugin`
> - `:camel-cxf-soap`
>
> All tested modules (3 modules):
> - Camel :: CXF :: SOAP
> - Camel :: Catalog :: Camel Report Maven Plugin
> - Camel :: Parent
---
#### Bugs found and fixed during testing
1. **Empty associative array under `set -u`** — `checkManualItTests()` crashed with `it_sources: unbound variable` when no modules matched `manual-it-mapping.txt`. Fixed by using a counter variable `it_found` instead of `${#it_sources[@]}`.
2. **Duplicate modules in CI comment** — Maven reactor output includes both `Camel :: Foo` and `Camel :: Foo [jar]` lines. The grep/sed pipeline wasn't stripping the `[packaging]` suffix before deduplication. Fixed by adding `sed 's/ *\[.*\]$//'`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore(ci): unify CI test infrastructure [camel]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on code in PR #22247:
URL: https://github.com/apache/camel/pull/22247#discussion_r2987123974
##########
.github/workflows/pr-build-main.yml:
##########
@@ -92,61 +98,30 @@ jobs:
- name: mvn test
uses: ./.github/actions/incremental-build
with:
- mode: test
pr-id: ${{ github.event.number || inputs.pr_number }}
github-token: ${{ secrets.GITHUB_TOKEN }}
skip-mvnd-install: 'true'
artifact-upload-suffix: java-${{ matrix.java }}
- - name: Post CI test summary comment
- if: always() && !matrix.experimental
- uses: actions/github-script@v8
- with:
- script: |
- const fs = require('fs');
- const commentFile = 'incremental-test-comment.md';
- if (!fs.existsSync(commentFile)) return;
- const body = fs.readFileSync(commentFile, 'utf8').trim();
- if (!body) return;
-
- const prNumber = ${{ github.event.number || inputs.pr_number || 0 }};
- if (!prNumber) {
- core.warning('Could not determine PR number, skipping test summary comment');
- return;
- }
-
- const marker = '<!-- ci-tested-modules -->';
-
- try {
- const { data: comments } = await github.rest.issues.listComments({
- owner: context.repo.owner,
- repo: context.repo.repo,
- issue_number: prNumber,
- });
- const existing = comments.find(c => c.body && c.body.includes(marker));
-
- if (existing) {
- await github.rest.issues.updateComment({
- owner: context.repo.owner,
- repo: context.repo.repo,
- comment_id: existing.id,
- body: body,
- });
- } else {
- await github.rest.issues.createComment({
- owner: context.repo.owner,
- repo: context.repo.repo,
- issue_number: prNumber,
- body: body,
- });
- }
- } catch (error) {
- core.warning(`Failed to post CI test summary comment: ${error.message}`);
- }
- - name: mvn test parent pom dependencies changed
- if: always() && !matrix.experimental
- uses: ./.github/actions/detect-dependencies
+ extra-modules: ${{ inputs.extra_modules || '' }}
+ - name: Save PR number and test comment for commenter workflow
+ if: always() && matrix.java == '21'
Review Comment:
_Claude Code on behalf of Guillaume Nodet_
The comment lists which modules were tested — this is identical across all JDK versions since the same modules are tested on JDK 17, 21, and 25. Per-JDK pass/fail results are visible in the GitHub Actions checks UI. Uploading from one JDK avoids duplicate artifacts. Added a comment in the workflow to clarify this.
##########
.github/workflows/pr-manual-component-test.yml:
##########
@@ -28,20 +28,16 @@ jobs:
name: PR comment
if: ${{ github.repository == 'apache/camel' && github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'CONTRIBUTOR') && startsWith(github.event.comment.body, '/component-test') }}
permissions:
- pull-requests: write # to comment on a pull request
- actions: read # to download artifact
+ pull-requests: write
+ actions: write # to dispatch workflows
runs-on: ubuntu-latest
- strategy:
- matrix:
- java: [ '21' ]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- submodules: recursive
- - name: Check Permission
- uses: actions-cool/check-user-permission@7b90a27f92f3961b368376107661682c441f6103
Review Comment:
_Claude Code on behalf of Guillaume Nodet_
Good catch — this was accidentally removed during the rewrite. Re-added in the latest commit.
##########
.github/workflows/pr-test-commenter.yml:
##########
@@ -0,0 +1,121 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Posts the CI test summary comment on PRs.
+# Uses workflow_run trigger so it runs in the base repo context with
+# full permissions — this allows posting comments on fork PRs too.
+
+name: Post CI test comment
+
+on:
+ workflow_run:
+ workflows: ["Build and test"]
+ types:
+ - completed
+
+jobs:
+ comment:
+ runs-on: ubuntu-latest
+ if: >
+ github.event.workflow_run.event == 'pull_request' ||
+ github.event.workflow_run.event == 'workflow_dispatch'
+ permissions:
+ pull-requests: write
+ actions: read
+ steps:
+ - name: Download CI comment artifact
+ uses: actions/github-script@v8
Review Comment:
_Claude Code on behalf of Guillaume Nodet_
Fixed — pinned to `ed597411d8f924073f98dfc5c65a23a2325f34cd` (v8) in the latest commit.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore(ci): unify CI test infrastructure [camel]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #22247:
URL: https://github.com/apache/camel/pull/22247#issuecomment-4128381846
_Claude Code on behalf of Guillaume Nodet_
The CI ran successfully on the latest push. Here's what the unified comment would look like for this PR (which only changes `parent/pom.xml` with a dummy trigger and `.github/` CI files):
---
<!-- ci-tested-modules -->
:test_tube: **CI tested the following changed modules:**
- `parent`
---
:gear: [View full build and test results](https://github.com/apache/camel/actions/runs/23552793971)
---
The script correctly identified `parent` as a pom-only module (no `src/test`), skipped `-amd` expansion (which would have pulled in every module in the project), and completed quickly.
For a real change — e.g., bumping a dependency version in `parent/pom.xml` — the Toolbox dependency analysis would detect the changed property, resolve the affected GAV coordinates, and use `tree-find` to discover all modules that depend on them (including transitive dependents). Those would all appear in the comment under a "POM dependency changes" section.
**Why the comment was not actually posted on this PR:** The `pr-test-commenter.yml` workflow uses a `workflow_run` trigger, which requires the workflow file to exist on the **default branch** (`main`). Since this workflow is new and only exists in the PR branch, it can't fire yet. Once this PR is merged, the commenter will work for all subsequent PRs. The comment content was correctly generated and uploaded as an artifact — it just couldn't be posted yet.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org