Skip to content

[TRTLLMINF-237][infra] Adopt resourceLedger.withResource for BuildDockerImage - #17136

Open
dpitman-nvda wants to merge 2 commits into
NVIDIA:mainfrom
dpitman-nvda:user/dpitman/resource-ledger-phase2-docker-login
Open

[TRTLLMINF-237][infra] Adopt resourceLedger.withResource for BuildDockerImage#17136
dpitman-nvda wants to merge 2 commits into
NVIDIA:mainfrom
dpitman-nvda:user/dpitman/resource-ledger-phase2-docker-login

Conversation

@dpitman-nvda

@dpitman-nvda dpitman-nvda commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Dev Engineer Review

  • BuildDockerImage.buildImage() registers Docker logins with resourceLedger.withResource.
  • The ledger performs best-effort Docker logout on success and failure paths.
  • The ledger preserves login records for post-build reconciliation if the build pod terminates before cleanup.
  • Independent logout failures are logged without masking the original build failure.
  • The change removes the previous local cleanup logic and preserves existing behavior.
  • Groovy AST parsing succeeds for the modified file.
  • No public or exported declarations changed.
  • No configuration or test-list files changed.

QA Engineer Review

No test changes.

Description

buildImage() logs into two Docker registries and must log out on both success and failure. Replace the hand-rolled try/catch/finally + containerGenFailure + manual rethrow with a single resourceLedger.withResource whose reclaim performs the logout. Behavior is preserved -- logout still runs in a finally on either path and the body's own error still propagates -- with two improvements:

  • the login is registered in the build-scoped ledger, so if the build pod dies before the finally runs, the entry is left live for a post-build sweep (Phase 3) instead of being silently lost;
  • a logout (reclaim) failure is now logged rather than masking the build's own failure.

Validated: Groovy AST parse of the modified file succeeds.

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)

  • If PR introduces API changes, an appropriate PR label is added - either api-compatible or api-breaking. For api-breaking, include BREAKING in the PR title.

  • 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.

…ogin in BuildDockerImage

Phase 2 of the pipeline resource-reconciliation work (shared-lib resourceLedger
landed in TRTLLMINF-237): adopt the Tier-1 withResource guard for the clearest
same-context case as a proof of the API.

buildImage() logs into two Docker registries and must log out on both success
and failure. Replace the hand-rolled try/catch/finally + containerGenFailure +
manual rethrow with a single resourceLedger.withResource whose reclaim performs
the logout. Behavior is preserved -- logout still runs in a finally on either
path and the body's own error still propagates -- with two improvements:
  - the login is registered in the build-scoped ledger, so if the build pod dies
    before the finally runs, the entry is left live for a post-build sweep
    (Phase 3) instead of being silently lost;
  - a logout (reclaim) failure is now logged rather than masking the build's own
    failure.

Validated: Groovy AST parse of the modified file succeeds.
Signed-off-by: Derek Pitman <dpitman@nvidia.com>
@dpitman-nvda

Copy link
Copy Markdown
Collaborator Author

/bot run

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 2aa52405-44d3-42c2-b0f3-5fc13432a6c1

📥 Commits

Reviewing files that changed from the base of the PR and between 22f6bbe and c5d5b9f.

📒 Files selected for processing (1)
  • jenkins/BuildDockerImage.groovy
🚧 Files skipped from review as they are similar to previous changes (1)
  • jenkins/BuildDockerImage.groovy

Walkthrough

Changes

Docker login cleanup

Layer / File(s) Summary
Resource-ledger Docker cleanup
jenkins/BuildDockerImage.groovy
Docker login credentials use resourceLedger.withResource with a stage-keyed dockerLogin entry. Reclaim attempts logout from both registries. Manual try/catch/finally cleanup and deferred exception rethrow were removed.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: emmaqiaoch, zhanruisunch

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the infrastructure change and follows the required ticket and type format.
Description check ✅ Passed The description explains the issue, solution, behavior changes, and validation; the Test Coverage section is present but minimally detailed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@jenkins/BuildDockerImage.groovy`:
- Around line 328-344: Move both Docker login operations from before
resourceLedger.withResource into its body for the
docker-login/${config.stageName} resource. Ensure registration occurs before the
first login, while preserving the existing reclaim callback and build behavior.
- Around line 340-341: Update the logout steps in the reclaim callback so the
two docker logout commands execute independently: wrap each command in its own
error-handling block, log that registry’s failure, and continue to the other
logout even when one returns a nonzero status. Preserve both existing registry
targets.
🪄 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: Enterprise

Run ID: babffdd0-0728-45aa-8282-25d9b027245d

📥 Commits

Reviewing files that changed from the base of the PR and between 7443b7f and 22f6bbe.

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

Comment thread jenkins/BuildDockerImage.groovy Outdated
Comment thread jenkins/BuildDockerImage.groovy Outdated
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #63104 [ run ] triggered by Bot. Commit: 22f6bbe Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #63104 [ run ] completed with state FAILURE. Commit: 22f6bbe
/LLM/main/L0_MergeRequest_PR pipeline #51195 completed with status: 'FAILURE'

CI Report

⚠️ 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

CI Agent Failure Analysis

Link to invocation

…docker-login

- Register the docker-login resource before the logins: move both `docker login`s
  into the withResource body (new "Docker Login" stage) so any registry we
  authenticate to is owed a logout even if a later login (or the pod) fails
  partway through. Previously the logins ran in "Install Package" before
  withResource, so a second-login failure left the first login with no reclaim.
- Make the logout reclaim best-effort and independent: each `docker logout` runs
  in its own try/catch and is logged on failure, so failing to log out of one
  registry can no longer skip logging out of the other.

Validated: Groovy AST parse of the modified file succeeds.
Signed-off-by: Derek Pitman <dpitman@nvidia.com>
@dpitman-nvda

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #63125 [ run ] triggered by Bot. Commit: c5d5b9f Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #63125 [ run ] completed with state FAILURE. Commit: c5d5b9f
/LLM/main/L0_MergeRequest_PR pipeline #51213 completed with status: 'FAILURE'

CI Report

⚠️ 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

CI Agent Failure Analysis

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.

2 participants