Support multiple lang-branch overrides in PR title#6468
Conversation
Previously, specifying a tracer branch override in the PR title (e.g. [java@my-branch]) only supported a single override at a time. This change allows multiple overrides like [java@branch1][dotnet@branch2] so that different libraries can each use their own dev branch. The get_target_branch action now outputs a JSON map of library to branch, and the compute-workflow-parameters workflow extracts the correct branch for each library before passing it to load-binary.sh. Backward compatibility with plain branch strings is preserved. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
Update target branch selection docs to reflect that multiple [lang@branch] pairs can now be specified simultaneously in the PR title. Update the workflow parameter description to note JSON map support. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c04ec34d65
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| id: extract_branch | ||
| shell: bash | ||
| run: | | ||
| TARGET_BRANCH_MAP='${{ inputs._system_tests_library_target_branch }}' |
There was a problem hiding this comment.
Avoid shell interpolation of untrusted branch map
inputs._system_tests_library_target_branch is populated from PR title content (via compute_libraries_and_scenarios.yml + get_target_branch), but this step injects it directly into a single-quoted shell assignment. Since branch names can legally contain ' (e.g. foo'bar), a crafted override like [java@x'; ...] can break quoting and execute unintended shell commands in this job; at minimum it causes syntax failures, and in CI contexts it can become command injection.
Useful? React with 👍 / 👎.
| elif echo "$TARGET_BRANCH_MAP" | jq empty 2>/dev/null; then | ||
| # It's valid JSON — extract the branch for this library and agent | ||
| library_branch=$(echo "$TARGET_BRANCH_MAP" | jq -r --arg lib "$LIBRARY" '.[$lib] // empty') |
There was a problem hiding this comment.
Require JSON object before extracting library keys
The JSON detection uses jq empty, which returns success for any valid JSON scalar, not just maps. That means legacy plain branch strings like 123 or true (both valid Git branch names) are treated as JSON, then .[$lib] is evaluated on a number/boolean and the step exits with Cannot index ... with string, breaking the documented backward-compatible plain-string path.
Useful? React with 👍 / 👎.
Motivation
The system-tests CI supports specifying a tracer branch override in the PR title like
[java@my-branch], but it only supported one branch override at a time. This made it impossible to test PRs that need changes from multiple tracer libraries simultaneously (e.g.[java@branch1][dotnet@branch2]).Changes
get_target_branchaction: Updated to capture all[lang@branch]pairs from the PR title and output them as a JSON map (e.g.{"java":"branch1","dotnet":"branch2"}). Added ahas-target-branchboolean output.compute-workflow-parameters.yml: Added a step to extract the specific library's branch from the JSON map before passing it toload-binary.sh. Also extracts theagentbranch separately for properAGENT_TARGET_BRANCHenv var support.compute_libraries_and_scenarios.yml: Exposed the newhas-target-branchoutput.ci.yml: Updated the "Fail if target branch is specified" check to use the newhas-target-branchoutput.Backward compatibility is preserved: plain branch strings from external callers still work via the legacy fallback path.
Examples
My PR [java@branch1]{"java":"branch1"}My PR [java@b1][dotnet@b2]{"java":"b1","dotnet":"b2"}My PR [java@b1][golang@b2][ruby@b3]{"java":"b1","golang":"b2","ruby":"b3"}My PR(no override)Workflow
🚀 Once your PR is reviewed and the CI green, you can merge it!
🛟 #apm-shared-testing 🛟
Reviewer checklist
tests/ormanifests/is modified ? I have the approval from R&P teambuild-XXX-imagelabel is present🤖 Generated with Claude Code