Skip to content

[TRTLLM-11861][infra] Support wildcard in bot stage-list/extra-stage commands#12881

Open
mzweilz wants to merge 2 commits intoNVIDIA:mainfrom
mzweilz:user/mengzew/TRTLLM-11861-wildcard-stage-list
Open

[TRTLLM-11861][infra] Support wildcard in bot stage-list/extra-stage commands#12881
mzweilz wants to merge 2 commits intoNVIDIA:mainfrom
mzweilz:user/mengzew/TRTLLM-11861-wildcard-stage-list

Conversation

@mzweilz
Copy link
Copy Markdown
Collaborator

@mzweilz mzweilz commented Apr 9, 2026

Summary

  • Add wildcard * support for --stage-list and --extra-stage bot commands
  • Users can now specify patterns like "*PerfSanity*" to match all stages containing "PerfSanity" instead of listing each stage individually
  • Supports exact names (backward compatible), prefix (A10-*), suffix (*-1), contains (*PerfSanity*), and multi-segment (H100*Post-Merge*1) patterns
  • Implementation uses pure string operations (no regex), so special characters like [] in stage names are handled correctly

Test plan

  • /bot run --stage-list "*PerfSanity*" — verify wildcard substring matching
  • /bot run --stage-list "A10-PyTorch-1, *PerfSanity*" — verify mixed exact + wildcard
  • /bot run --stage-list "A10-PyTorch-1" — verify backward compatibility
  • /bot run --stage-list "*Nonexistent*" — verify error on unmatched pattern
  • Check Jenkins console log for correct stage filtering output

Summary by CodeRabbit

Release Notes

  • New Features
    • Stage list filtering now supports wildcard * pattern matching (e.g., "*PerfSanity*") for more flexible stage selection.

@mzweilz mzweilz requested review from a team as code owners April 9, 2026 06:44
@mzweilz mzweilz requested review from dpitman-nvda and niukuo April 9, 2026 06:44
@mzweilz
Copy link
Copy Markdown
Collaborator Author

mzweilz commented Apr 9, 2026

/bot run --stage-list "A10-Build_Docs"

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 9, 2026

📝 Walkthrough

Walkthrough

Added wildcard pattern matching support for stage filtering across bot commands and Jenkins pipelines. Introduced helper functions to evaluate stage names against wildcard patterns (supporting * in patterns), and updated filtering logic to use pattern matching instead of exact string matching.

Changes

Cohort / File(s) Summary
Bot Command Help Text
.github/workflows/bot-command.yml
Updated help text for --stage-list option to document wildcard * pattern matching support with examples.
Jenkins Pattern Matching Helpers
jenkins/L0_MergeRequest.groovy, jenkins/L0_Test.groovy
Added stageMatchesPattern() and stageMatchesAnyPattern() helper functions to support wildcard matching. Updated launchStages() and stage filtering logic in both files to use pattern-based matching instead of exact string comparisons, allowing filters to accept wildcard patterns.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description covers the summary, test plan, and implementation details. However, it lacks the formal template structure with sections for 'Description', 'Test Coverage' (checkbox format), and 'PR Checklist', which are specified in the repository's description template. Restructure the description to follow the template format: include formal 'Description' section, checkbox-based 'Test Coverage' section listing automated/integration tests, and complete the 'PR Checklist' with checkmarks for code guidelines compliance, dependency scanning, and CODEOWNERS updates.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding wildcard support to bot stage-list and extra-stage commands, matching the primary objective of the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
jenkins/L0_Test.groovy (2)

1381-1404: Extract the wildcard matcher into a shared helper.

stageMatchesPattern is now duplicated here and in jenkins/L0_MergeRequest.groovy, so the bot can easily drift into validating one wildcard syntax and executing another later. Centralizing this logic, or at least covering both call sites with the same tests, would make the behavior much safer to evolve.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@jenkins/L0_Test.groovy` around lines 1381 - 1404, The wildcard matching logic
in stageMatchesPattern (and its caller stageMatchesAnyPattern) is duplicated and
should be centralized to avoid drift; extract stageMatchesPattern into a shared
helper (e.g., a common utility class/function) and replace local implementations
in both locations to call that single helper, update stageMatchesAnyPattern to
delegate to the new helper, and add a small unit test covering exact, prefix,
suffix, contains and multi-wildcard cases to both call sites to ensure identical
behavior.

3824-3835: Enforce a single resolved stage when --debug is enabled.

A single wildcard like *PerfSanity* can now expand to many stages here, but the debug flow later assumes one target container. Without a post-filter check, --debug can open multiple interactive sessions and effectively wedge the job.

Suggested guard
     if (testFilter[EXTRA_STAGE_LIST] != null) {
         echo "Use EXTRA_STAGE_LIST for filtering. Stages: ${testFilter[(EXTRA_STAGE_LIST)]}."
         parallelJobsFiltered += parallelJobs.findAll { stageMatchesAnyPattern(it.key, testFilter[(EXTRA_STAGE_LIST)]) }
         println parallelJobsFiltered.keySet()
     }
+
+    if (testFilter[(DEBUG_MODE)] && parallelJobsFiltered.size() != 1) {
+        error "--debug requires the stage selection to resolve to exactly one stage. Matched stages: ${parallelJobsFiltered.keySet()}"
+    }
 
     checkStageName(fullSet)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@jenkins/L0_Test.groovy` around lines 3824 - 3835, After resolving
TEST_STAGE_LIST and EXTRA_STAGE_LIST into parallelJobsFiltered (using
stageMatchesAnyPattern), add a guard when running with --debug: if the debug
flag is set and parallelJobsFiltered does not contain exactly one entry, fail
fast with a clear error/echo and exit (or throw) to avoid opening multiple
interactive sessions; reference the symbols TEST_STAGE_LIST, EXTRA_STAGE_LIST,
parallelJobsFiltered and stageMatchesAnyPattern and perform this check
immediately after the combined filtering block so the debug flow only proceeds
when exactly one stage is selected.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@jenkins/L0_MergeRequest.groovy`:
- Around line 1316-1320: The Build-Docker-Images check currently treats patterns
as glob-style matches via matchesBuildDocker/ stageMatchesPattern, causing broad
patterns (e.g., *Build*) to incorrectly opt into the top-level docker build;
change matchesBuildDocker to only consider an exact literal match to
"Build-Docker-Images" (e.g., pattern == "Build-Docker-Images") and update the
subsequent removeAll calls to only remove entries that exactly equal
"Build-Docker-Images" (rather than using stageMatchesPattern) so dockerBuildJob
is only included when the user explicitly opted into Build-Docker-Images.

---

Nitpick comments:
In `@jenkins/L0_Test.groovy`:
- Around line 1381-1404: The wildcard matching logic in stageMatchesPattern (and
its caller stageMatchesAnyPattern) is duplicated and should be centralized to
avoid drift; extract stageMatchesPattern into a shared helper (e.g., a common
utility class/function) and replace local implementations in both locations to
call that single helper, update stageMatchesAnyPattern to delegate to the new
helper, and add a small unit test covering exact, prefix, suffix, contains and
multi-wildcard cases to both call sites to ensure identical behavior.
- Around line 3824-3835: After resolving TEST_STAGE_LIST and EXTRA_STAGE_LIST
into parallelJobsFiltered (using stageMatchesAnyPattern), add a guard when
running with --debug: if the debug flag is set and parallelJobsFiltered does not
contain exactly one entry, fail fast with a clear error/echo and exit (or throw)
to avoid opening multiple interactive sessions; reference the symbols
TEST_STAGE_LIST, EXTRA_STAGE_LIST, parallelJobsFiltered and
stageMatchesAnyPattern and perform this check immediately after the combined
filtering block so the debug flow only proceeds when exactly one stage is
selected.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f73283b9-7c14-4e8a-870d-99c152c98464

📥 Commits

Reviewing files that changed from the base of the PR and between ce71620 and a16c47f.

📒 Files selected for processing (3)
  • .github/workflows/bot-command.yml
  • jenkins/L0_MergeRequest.groovy
  • jenkins/L0_Test.groovy

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #42488 [ run ] triggered by Bot. Commit: a16c47f Link to invocation

@mzweilz mzweilz force-pushed the user/mengzew/TRTLLM-11861-wildcard-stage-list branch from 504517e to 6bd1dea Compare April 9, 2026 07:50
…commands

Add wildcard '*' support for --stage-list and --extra-stage bot commands.
Users can now specify patterns like "*PerfSanity*" to match all stages
containing "PerfSanity" instead of listing each stage individually.

Signed-off-by: Abby Wei <mengzew@nvidia.com>
@mzweilz mzweilz force-pushed the user/mengzew/TRTLLM-11861-wildcard-stage-list branch from 6bd1dea to 9db1163 Compare April 9, 2026 08:01
@mzweilz
Copy link
Copy Markdown
Collaborator Author

mzweilz commented Apr 9, 2026

/bot run --stage-list "A10*"

@mzweilz mzweilz requested a review from ZhanruiSunCh April 9, 2026 08:02
@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #42505 [ run ] triggered by Bot. Commit: 9db1163 Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #42488 [ run ] completed with state ABORTED. Commit: a16c47f

Link to invocation

@mzweilz
Copy link
Copy Markdown
Collaborator Author

mzweilz commented Apr 9, 2026

/bot run --stage-list "A10*"

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #42526 [ run ] triggered by Bot. Commit: 9db1163 Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #42505 [ run ] completed with state ABORTED. Commit: 9db1163

Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #42526 [ run ] completed with state SUCCESS. Commit: 9db1163
/LLM/main/L0_MergeRequest_PR pipeline #33267 (Partly Tested) completed with status: 'SUCCESS'
Pipeline passed with automatic retried tests. Check the rerun report for details.

CI Report

Link to invocation

@mzweilz
Copy link
Copy Markdown
Collaborator Author

mzweilz commented Apr 10, 2026

/bot run

Replace hand-rolled imperative loop with Groovy regex matching.
Uses Pattern.quote() to safely handle special characters in stage names.
Behavior is unchanged - same glob semantics with cleaner implementation.

Signed-off-by: Abby Wei <mengzew@nvidia.com>
@mzweilz mzweilz force-pushed the user/mengzew/TRTLLM-11861-wildcard-stage-list branch from 5090d40 to 8723faf Compare April 10, 2026 03:52
@mzweilz
Copy link
Copy Markdown
Collaborator Author

mzweilz commented Apr 10, 2026

/bot run

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #42650 [ run ] triggered by Bot. Commit: 8723faf Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #42652 [ run ] triggered by Bot. Commit: 8723faf Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #42650 [ run ] completed with state ABORTED. Commit: 8723faf

Link to invocation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants