[TRTLLM-7335][infra] use JobBuilder to trigger downstream job#7079
[TRTLLM-7335][infra] use JobBuilder to trigger downstream job#7079niukuo merged 2 commits intoNVIDIA:mainfrom
Conversation
📝 WalkthroughWalkthroughReplaced the old triggerJob flow in Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor DevPipeline
participant L0 as L0_MergeRequest.launchJob
participant Logger as Logger
participant JB as JobBuilder
participant Down as DownstreamJob
DevPipeline->>L0: launchJob(pipeline, jobName, params...)
L0->>L0: normalize jobName (trim '/' or prepend dir)
L0->>Logger: new Logger(pipeline)
L0->>JB: JobBuilder.build(pipeline, logger, jobName, parameters, 1, false)
JB->>Down: start downstream build
Down-->>JB: build result (buildStatus)
JB-->>L0: return buildStatus
alt buildStatus == "SUCCESS"
L0-->>DevPipeline: return "SUCCESS"
else
L0-->>DevPipeline: error / fail pipeline
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes ✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
jenkins/L0_MergeRequest.groovy (2)
940-969: Support Jenkins URL/credentials via parameters and guard against missing credentials before remote triggerThe current implementation only reads jenkinsUrl/credentials from env, which doesn’t align with the stated goal of “allowing Jenkins URL in parameters,” and it may attempt a remote trigger with a URL but no credentials, causing failures.
- Honor optional keys in parameters (e.g., jenkinsUrl/downstreamJenkinsUrl and jobCredentials/downstreamJobCredentials/credentials).
- Avoid null-vs-empty pitfalls by using truthiness checks.
- Only use triggerRemoteJob when both jenkinsUrl and credentials are present; otherwise fall back to local build.
- Do not forward the URL/credentials keys downstream.
Apply this diff:
-def triggerJob(jobName, parameters) +def triggerJob(jobName, parameters) { - def jenkinsUrl = env.downstreamJenkinsUrl - def credentials = env.localJobCredentials - if (jenkinsUrl == "" && credentials) { - jenkinsUrl = env.JENKINS_URL - } - def status = "" - if (jenkinsUrl != "") { - def jobPath = trtllm_utils.resolveFullJobName(jobName).replace('/', '/job/').substring(1) - def handle = triggerRemoteJob( - job: "${jenkinsUrl}${jobPath}/", - auth: CredentialsAuth(credentials: credentials), - parameters: trtllm_utils.toRemoteBuildParameters(parameters), - pollInterval: 60, - abortTriggeredJob: true, - ) - status = handle.getBuildResult().toString() - } else { - def handle = build( - job: jobName, - parameters: trtllm_utils.toBuildParameters(parameters), - propagate: false, - ) - echo "Triggered job: ${handle.absoluteUrl}" - status = handle.result - } - return status + // Make a defensive copy and allow overrides from parameters + def paramMap = parameters ? new LinkedHashMap(parameters) : [:] + def paramJenkinsUrl = (paramMap.remove('jenkinsUrl') ?: paramMap.remove('downstreamJenkinsUrl')) as String + def paramCredentials = (paramMap.remove('jobCredentials') ?: paramMap.remove('downstreamJobCredentials') ?: paramMap.remove('credentials')) as String + + def jenkinsUrl = paramJenkinsUrl ?: env.downstreamJenkinsUrl + def credentials = paramCredentials ?: env.localJobCredentials + if (!jenkinsUrl?.trim() && credentials?.trim()) { + // Allow remote trigger to same controller only if credentials are present + jenkinsUrl = env.JENKINS_URL + } + + def status = "" + boolean useRemote = jenkinsUrl?.trim() && credentials?.trim() + if (useRemote) { + def jobPath = trtllm_utils.resolveFullJobName(jobName).replace('/', '/job/').substring(1) + echo "Triggering remote job: ${jenkinsUrl}${jobPath}/" + def handle = triggerRemoteJob( + job: "${jenkinsUrl}${jobPath}/", + auth: CredentialsAuth(credentials: credentials), + parameters: trtllm_utils.toRemoteBuildParameters(paramMap), + pollInterval: 60, + abortTriggeredJob: true, + ) + status = handle.getBuildResult().toString() + } else { + def handle = build( + job: jobName, + parameters: trtllm_utils.toBuildParameters(paramMap), + propagate: false, + ) + echo "Triggered job: ${handle.absoluteUrl}" + status = handle.result + } + return status }
948-957: Prevent remote trigger without credentialsIf env.downstreamJenkinsUrl is set but credentials are missing, this path will call triggerRemoteJob with empty credentials, likely failing.
Gate the remote path on both jenkinsUrl and credentials being non-blank. Example:
- if (jenkinsUrl != "") { + if (jenkinsUrl?.trim() && credentials?.trim()) { // remote trigger } else { // local build }
🧹 Nitpick comments (1)
jenkins/L0_MergeRequest.groovy (1)
942-946: Fix null/blank handling for env.downstreamJenkinsUrlComparing with an empty string misses the null case. If env.downstreamJenkinsUrl is null, the fallback to env.JENKINS_URL won’t execute, changing behavior unintentionally.
Use truthiness checks:
- if (jenkinsUrl == "" && credentials) { + if (!jenkinsUrl?.trim() && credentials?.trim()) { jenkinsUrl = env.JENKINS_URL }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
jenkins/L0_MergeRequest.groovy(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Pre-commit Check
🔇 Additional comments (1)
jenkins/L0_MergeRequest.groovy (1)
970-1007: No outdatedtriggerJobcall sites foundA repository-wide search confirms that
triggerJobis only defined with two parameters and invoked with two arguments (e.g., injenkins/L0_MergeRequest.groovy:1002). No three-argument usages remain.
|
/bot run --skip-test |
|
PR_Github #15970 [ run ] triggered by Bot |
|
PR_Github #15970 [ run ] completed with state |
|
PR_Github #16107 [ run ] triggered by Bot |
|
PR_Github #16109 [ run ] triggered by Bot |
|
PR_Github #16107 [ run ] completed with state |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
jenkins/L0_MergeRequest.groovy (1)
1027-1027: Stage labels tied to credentials are consistent with the updated trigger logic.Using
env.downstreamJobCredentials ? "Remote Run" : "Run"keeps the UI aligned with the proposed “remote only when credentials exist” behavior intriggerJob. Looks good.Two tiny follow-ups:
- SBSA block still defines
def jenkinsUrl = ""anddef credentials = ""above Line 1121 but no longer uses them; consider removing to avoid noise.- If you want to de-dup the label logic, add a small helper and use it in all four places. Example (outside this block):
// near other helpers def remoteLabel() { (env.downstreamJobCredentials ? "Remote Run" : "Run") }Then:
def testStageName = "[Test-x86_64-Single-GPU] ${remoteLabel()}" // ...and similarly for the other threeAlso applies to: 1084-1084, 1121-1121, 1188-1188
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
jenkins/L0_MergeRequest.groovy(5 hunks)
🔇 Additional comments (1)
jenkins/L0_MergeRequest.groovy (1)
940-968: No stray downstreamJenkinsUrl references detected; changes approved.Scan results confirm that the only place
env.downstreamJenkinsUrlis read is within thetriggerJobmethod (lines 942–945), immediately alongsideenv.downstreamJobCredentials. No other code paths set or usedownstreamJenkinsUrlwithout pairing it withdownstreamJobCredentials. The hardening diff therefore covers the single trigger point and safely falls back to a local build when credentials are missing.
|
PR_Github #16109 [ run ] completed with state |
|
PR_Github #16116 [ run ] triggered by Bot |
|
PR_Github #16116 [ run ] completed with state |
|
PR_Github #16806 [ run ] triggered by Bot |
|
PR_Github #16806 [ run ] completed with state |
|
/bot run |
|
PR_Github #16845 [ run ] triggered by Bot |
|
PR_Github #16845 [ run ] completed with state |
|
/bot run --skip-test |
|
PR_Github #21128 [ run ] triggered by Bot |
|
PR_Github #21128 [ run ] completed with state |
|
PR_Github #21169 [ run ] triggered by Bot |
|
PR_Github #21169 [ run ] completed with state |
|
PR_Github #21414 [ run ] triggered by Bot |
|
PR_Github #21414 [ run ] completed with state |
|
PR_Github #21417 [ run ] triggered by Bot |
|
PR_Github #21417 [ run ] completed with state |
|
PR_Github #21420 [ run ] triggered by Bot |
|
PR_Github #21420 [ run ] completed with state |
|
PR_Github #21430 [ run ] triggered by Bot |
|
PR_Github #21430 [ run ] completed with state |
|
PR_Github #21667 [ run ] triggered by Bot |
|
PR_Github #21667 [ run ] completed with state |
|
PR_Github #21668 [ run ] triggered by Bot |
|
PR_Github #21668 [ run ] completed with state |
|
@coderabbitai summary |
✅ Actions performedSummary regeneration triggered. |
Signed-off-by: Yiteng Niu <6831097+niukuo@users.noreply.github.com>
|
/bot run --disable-fail-fast |
|
PR_Github #41209 [ run ] triggered by Bot. Commit: |
|
PR_Github #41209 [ run ] completed with state |
…#7079) Signed-off-by: Yiteng Niu <6831097+niukuo@users.noreply.github.com>
Summary by CodeRabbit
Description
Test Coverage
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...Provide a user friendly way for developers to interact with a Jenkins server.
Run
/bot [-h|--help]to print this help message.See details below for each supported subcommand.
Details
run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]Launch build/test pipelines. All previously running jobs will be killed.
--reuse-test (optional)pipeline-id(OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.--disable-reuse-test(OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.--disable-fail-fast(OPTIONAL) : Disable fail fast on build/tests/infra failures.--skip-test(OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.--stage-list "A10-PyTorch-1, xxx"(OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.--gpu-type "A30, H100_PCIe"(OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.--test-backend "pytorch, cpp"(OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.--only-multi-gpu-test(OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.--disable-multi-gpu-test(OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.--add-multi-gpu-test(OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.--post-merge(OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx"(OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".--detailed-log(OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.--debug(OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in thestage-listparameter to access the appropriate container environment. Note: Does NOT update GitHub check status.For guidance on mapping tests to stage names, see
docs/source/reference/ci-overview.mdand the
scripts/test_to_stage_mapping.pyhelper.kill
killKill all running builds associated with pull request.
skip
skip --comment COMMENTSkip testing for latest commit on pull request.
--comment "Reason for skipping build/test"is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.reuse-pipeline
reuse-pipelineReuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.