Repository navigation
fix: avoid redundant Node/npm during Docker agent setup #193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
843b672
fix: avoid redundant Docker agent Node bootstrap
chrisknvidia 8e2a33c
Merge main into feat/christopherk/docker-agent-bootstrap
rng1995 3829bfe
fix(tier3): install a CA bundle when skipping Docker agent Node/npm
rng1995 8cd5285
docs: note that Docker agent setup no longer installs Node/npm
rng1995 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """Keep Harbor's bootstrap dependencies aligned with its installer branches.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from typing import TYPE_CHECKING | ||
|
|
||
| from harbor.agents.installed.claude_code import ClaudeCode | ||
| from harbor.agents.installed.codex import Codex | ||
|
|
||
| if TYPE_CHECKING: | ||
| from harbor.environments.base import BaseEnvironment | ||
|
|
||
| # Harbor's installers download over HTTPS but never request a CA bundle; apt | ||
| # images used to get one only as a dependency of the skipped npm package. | ||
| _CA_BUNDLE_PREDICATE = "[ -s /etc/ssl/certs/ca-certificates.crt ] || [ -s /etc/pki/tls/certs/ca-bundle.crt ]" | ||
| _INSTALLER_BRANCHES = frozenset({"system", "bundled", "bundled-without-ca"}) | ||
|
|
||
|
|
||
| async def _installer_dependencies( | ||
| environment: BaseEnvironment, | ||
| dependencies: tuple[str, ...], | ||
| *, | ||
| system_npm_predicate: str, | ||
| ) -> tuple[str, ...]: | ||
| if not {"nodejs", "npm"}.intersection(dependencies): | ||
| return dependencies | ||
|
|
||
| # Match the pinned Harbor installer's branch before removing prerequisites. | ||
| # Codex supplies Node via NVM on glibc; Claude's native installer needs no | ||
| # Node. Both still need system npm on their respective fallback branches. | ||
| result = await environment.exec( | ||
| command=( | ||
| f"if {system_npm_predicate}; then printf '%s' system; " | ||
| f"elif {_CA_BUNDLE_PREDICATE}; then printf '%s' bundled; " | ||
| "else printf '%s' bundled-without-ca; fi" | ||
| ), | ||
| user="root", | ||
| ) | ||
| installer = (result.stdout or "").strip() | ||
| if result.return_code != 0 or installer not in _INSTALLER_BRANCHES: | ||
| raise RuntimeError("Could not determine agent installer system dependency requirements") | ||
| if installer == "system": | ||
| return dependencies | ||
| bundled = tuple(dependency for dependency in dependencies if dependency not in {"nodejs", "npm"}) | ||
| if installer == "bundled-without-ca": | ||
| return (*bundled, "ca_certificates") | ||
| return bundled | ||
|
|
||
|
|
||
| class SkillEvaluatorCodex(Codex): | ||
| """Avoid a redundant distribution Node/npm install before Harbor's NVM.""" | ||
|
|
||
| async def ensure_system_dependencies( | ||
| self, | ||
| environment: BaseEnvironment, | ||
| dependencies: tuple[str, ...], | ||
| ) -> None: | ||
| dependencies = await _installer_dependencies( | ||
| environment, | ||
| dependencies, | ||
| system_npm_predicate="ldd --version 2>&1 | grep -qi musl || [ -f /etc/alpine-release ]", | ||
| ) | ||
| await super().ensure_system_dependencies(environment, dependencies) | ||
|
|
||
|
|
||
| class SkillEvaluatorClaudeCode(ClaudeCode): | ||
| """Avoid distribution Node/npm for Harbor's native Claude installer.""" | ||
|
|
||
| async def ensure_system_dependencies( | ||
| self, | ||
| environment: BaseEnvironment, | ||
| dependencies: tuple[str, ...], | ||
| ) -> None: | ||
| dependencies = await _installer_dependencies( | ||
| environment, | ||
| dependencies, | ||
| system_npm_predicate="command -v apk >/dev/null 2>&1", | ||
| ) | ||
| await super().ensure_system_dependencies(environment, dependencies) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.