Skip to content

[None][fix] Fix Upload Build Info branch and run in post always#12025

Open
mzweilz wants to merge 1 commit intoNVIDIA:mainfrom
mzweilz:user/abbyw/dev-abbyw-fix-post-merge-build-job-1
Open

[None][fix] Fix Upload Build Info branch and run in post always#12025
mzweilz wants to merge 1 commit intoNVIDIA:mainfrom
mzweilz:user/abbyw/dev-abbyw-fix-post-merge-build-job-1

Conversation

@mzweilz
Copy link
Collaborator

@mzweilz mzweilz commented Mar 9, 2026

  • Resolve branch using globalVars[GITHUB_PR_API_URL] for GithubPR jobs
  • Move Upload Build Info to post always so it runs even on failure

Summary by CodeRabbit

  • Refactor
    • Restructured build info upload to execute during post-build finalization instead of the main build stages.
    • Improved branch detection logic to prioritize GitLab branch information, fallback to "main", and handle GitHub PR branches with a dedicated naming format.
    • Build artifacts continue to be generated with commit, branch, timestamp, and Jenkins metadata.

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

  • Update tava architecture diagram if there is a significant design change in PR.

  • 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

To see a list of available CI bot commands, please comment /bot help.

@mzweilz mzweilz requested review from a team as code owners March 9, 2026 08:54
@mzweilz mzweilz requested review from dpitman-nvda and mlefeb01 March 9, 2026 08:54
@mzweilz mzweilz force-pushed the user/abbyw/dev-abbyw-fix-post-merge-build-job-1 branch from 9b34a0c to f392692 Compare March 9, 2026 08:54
@mzweilz
Copy link
Collaborator Author

mzweilz commented Mar 9, 2026

/bot run

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 9, 2026

📝 Walkthrough

Walkthrough

The Upload Build Info stage is relocated from the main build stages to the post-build finalization block. The branch computation logic is updated to prioritize env.gitlabBranch, default to "main", and handle GitHub pull requests by extracting the PR number from the GITHUB_PR_API_URL environment variable to construct the branch name.

Changes

Cohort / File(s) Summary
Jenkins Pipeline Stage Reorganization
jenkins/L0_MergeRequest.groovy
Moved Upload Build Info stage to post-build phase and updated branch computation logic to handle multiple VCS platforms (GitLab and GitHub) with environment-based fallbacks.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete. While it briefly states the two main objectives, it lacks the required Description and Test Coverage sections from the template, and the checklist is unchecked. Add a detailed Description section explaining the issue and solution, include Test Coverage section listing relevant tests, and complete the PR Checklist by checking the final box after reviewing the applicable items.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: fixing the Upload Build Info branch resolution and moving it to post-build to run on all outcomes.
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
  • Post copyable unit tests in a comment

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

@mzweilz
Copy link
Collaborator Author

mzweilz commented Mar 9, 2026

@coderabbitai help

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 9, 2026

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

CodeRabbit commands

These commands are invoked using PR/Issue comments.

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai evaluate custom pre-merge check --instructions <custom-checks-instructions> --name <custom-checks-title> [--mode <error|warning>] to validate the custom pre-merge checks instructions. Defaults to error when --mode is omitted.
    • @coderabbitai ignore pre-merge checks to override pre-merge checks and get an approval on PR.
    • @coderabbitai run pre-merge checks to run pre-merge checks on the pull request.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai generate configuration to create a PR that adds the current resolved configuration as .coderabbit.yaml (or show it if already present).
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

Status, support, documentation and community

  • Visit our status page to check the current availability of CodeRabbit.
  • Create a ticket on our support page for assistance with any issues or questions.
  • Visit our documentation site for detailed information on how to use CodeRabbit.
  • Join our Discord community to connect with other users and get help from the community.
  • Follow us on X/Twitter for updates and announcements.

@mzweilz
Copy link
Collaborator Author

mzweilz commented Mar 9, 2026

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 9, 2026

✅ Actions performed

Full review triggered.

Copy link
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.

🧹 Nitpick comments (1)
jenkins/L0_MergeRequest.groovy (1)

1368-1380: Good move to post-always, consider adding defensive error handling.

Moving "Upload Build Info" to the post { always { ... } } block ensures build info is captured even on pipeline failure—this aligns with the PR objective. The branch derivation logic is consistent with lines 1283-1286 (Build-Docker-Images).

However, if trtllm_utils.uploadArtifacts fails (e.g., network issues), the exception could alter the final build status or disrupt subsequent post actions. Consider wrapping in try-catch for resilience, similar to how "Test Coverage" (lines 928-970) handles failures.

🛡️ Suggested defensive wrapper
 stage("Upload Build Info") {
+    try {
         def branch = env.gitlabBranch ? env.gitlabBranch : "main"
         if (globalVars[GITHUB_PR_API_URL]) {
             branch = "github-pr-" + globalVars[GITHUB_PR_API_URL].split('/').last()
         }
         def buildInfo = "commit=${env.gitlabCommit}\n" +
             "branch=${branch}\n" +
             "date=${new Date().format('yyyy-MM-dd HH:mm:ss z', TimeZone.getTimeZone('UTC'))}\n" +
             "jenkins_url=${env.BUILD_URL}"
         writeFile file: 'build_info.txt', text: buildInfo
         trtllm_utils.uploadArtifacts("build_info.txt", "${UPLOAD_PATH}/")
         echo "Build info: https://urm.nvidia.com/artifactory/${UPLOAD_PATH}/build_info.txt"
+    } catch (Exception e) {
+        echo "Upload Build Info failed: ${e.toString()}"
+    }
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@jenkins/L0_MergeRequest.groovy` around lines 1368 - 1380, The "Upload Build
Info" post-action should be made resilient to upload failures: wrap the call to
trtllm_utils.uploadArtifacts (inside the stage "Upload Build Info") in a
try-catch so that network or artifact errors do not fail the post block or
change the final build status; keep writeFile for 'build_info.txt' and the echo
of the artifact URL, and in the catch log a clear error (using echo or existing
logger) including the caught exception message so failures are recorded but do
not throw.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@jenkins/L0_MergeRequest.groovy`:
- Around line 1368-1380: The "Upload Build Info" post-action should be made
resilient to upload failures: wrap the call to trtllm_utils.uploadArtifacts
(inside the stage "Upload Build Info") in a try-catch so that network or
artifact errors do not fail the post block or change the final build status;
keep writeFile for 'build_info.txt' and the echo of the artifact URL, and in the
catch log a clear error (using echo or existing logger) including the caught
exception message so failures are recorded but do not throw.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9abc5a4b-24c8-4ab4-92bc-626c2b6cac76

📥 Commits

Reviewing files that changed from the base of the PR and between d17046d and f392692.

📒 Files selected for processing (1)
  • jenkins/L0_MergeRequest.groovy

@tensorrt-cicd
Copy link
Collaborator

PR_Github #38236 [ run ] triggered by Bot. Commit: f392692 Link to invocation

Copy link
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.

🧹 Nitpick comments (1)
jenkins/L0_MergeRequest.groovy (1)

1368-1380: LGTM! The stage correctly runs in post-always and resolves branch for GitHub PRs.

The implementation properly:

  1. Runs in post { always } ensuring execution even on failure
  2. Resolves branch using globalVars[GITHUB_PR_API_URL] for GitHub PRs

Optional refactor: The branch computation logic (lines 1369-1372) is duplicated from the Build-Docker-Images stage (lines 1283-1286). Consider extracting to a helper function if this pattern grows.

♻️ Optional: Extract branch computation to helper

Add helper function near other utility functions:

def getSourceBranch(globalVars) {
    def branch = env.gitlabBranch ? env.gitlabBranch : "main"
    if (globalVars[GITHUB_PR_API_URL]) {
        branch = "github-pr-" + globalVars[GITHUB_PR_API_URL].split('/').last()
    }
    return branch
}

Then simplify both usages:

-def branch = env.gitlabBranch ? env.gitlabBranch : "main"
-if (globalVars[GITHUB_PR_API_URL]) {
-    branch = "github-pr-" + globalVars[GITHUB_PR_API_URL].split('/').last()
-}
+def branch = getSourceBranch(globalVars)

,

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

In `@jenkins/L0_MergeRequest.groovy` around lines 1368 - 1380, Extract the
duplicated branch resolution logic into a helper function (e.g., def
getSourceBranch(globalVars)) that returns env.gitlabBranch ?: "main" but when
globalVars[GITHUB_PR_API_URL] exists returns "github-pr-" +
globalVars[GITHUB_PR_API_URL].split('/').last(); then replace the inline logic
in the Upload Build Info stage and the Build-Docker-Images stage with a call to
getSourceBranch(globalVars) to avoid duplication and keep behavior identical.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@jenkins/L0_MergeRequest.groovy`:
- Around line 1368-1380: Extract the duplicated branch resolution logic into a
helper function (e.g., def getSourceBranch(globalVars)) that returns
env.gitlabBranch ?: "main" but when globalVars[GITHUB_PR_API_URL] exists returns
"github-pr-" + globalVars[GITHUB_PR_API_URL].split('/').last(); then replace the
inline logic in the Upload Build Info stage and the Build-Docker-Images stage
with a call to getSourceBranch(globalVars) to avoid duplication and keep
behavior identical.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a930fa26-7c79-4195-ab7e-50c9590c6828

📥 Commits

Reviewing files that changed from the base of the PR and between d17046d and f392692.

📒 Files selected for processing (1)
  • jenkins/L0_MergeRequest.groovy

@mzweilz mzweilz force-pushed the user/abbyw/dev-abbyw-fix-post-merge-build-job-1 branch from f392692 to ddd4a6b Compare March 9, 2026 09:36
@tensorrt-cicd
Copy link
Collaborator

PR_Github #38236 [ run ] completed with state FAILURE. Commit: f392692
/LLM/main/L0_MergeRequest_PR pipeline #29625 completed with status: 'FAILURE'

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

Link to invocation

@mzweilz
Copy link
Collaborator Author

mzweilz commented Mar 9, 2026

/bot run

@mzweilz mzweilz force-pushed the user/abbyw/dev-abbyw-fix-post-merge-build-job-1 branch from ddd4a6b to ef94fa8 Compare March 9, 2026 09:38
@mzweilz
Copy link
Collaborator Author

mzweilz commented Mar 9, 2026

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #38240 [ run ] triggered by Bot. Commit: ef94fa8 Link to invocation

@tensorrt-cicd
Copy link
Collaborator

PR_Github #38241 [ run ] triggered by Bot. Commit: ef94fa8 Link to invocation

@tensorrt-cicd
Copy link
Collaborator

PR_Github #38241 [ run ] completed with state FAILURE. Commit: ef94fa8
/LLM/main/L0_MergeRequest_PR pipeline #29629 completed with status: 'FAILURE'

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

Link to invocation

Copy link
Collaborator

@dpitman-nvda dpitman-nvda left a comment

Choose a reason for hiding this comment

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

LGTM

- Resolve branch using globalVars[GITHUB_PR_API_URL] for GithubPR jobs
- Move Upload Build Info to post always so it runs even on failure

Signed-off-by: Abby Wei <mengzew@nvidia.com>
@mzweilz mzweilz force-pushed the user/abbyw/dev-abbyw-fix-post-merge-build-job-1 branch from ef94fa8 to 28ddc9a Compare March 10, 2026 07:19
@mzweilz
Copy link
Collaborator Author

mzweilz commented Mar 10, 2026

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #38415 [ run ] triggered by Bot. Commit: 28ddc9a 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