Repository navigation
fix(ci): bound pinned Pi tool installation #12778
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
+375
−105
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ce79cbe
fix(ci): bound pinned Pi tool installation
rsliter 2c19579
Merge remote-tracking branch 'origin/main' into codex/11320-cli-shard…
rsliter 863a65e
Merge remote-tracking branch 'origin/main' into codex/11320-cli-shard…
rsliter b695d75
Merge remote-tracking branch 'origin/main' into codex/11320-cli-shard…
rsliter ddfaf29
fix(ci): cover pinned tool caller success and forced kills
rsliter 9c4601d
Merge remote-tracking branch 'origin/main' into codex/11320-cli-shard…
rsliter 445444d
ci: preserve bounded CLI APT retry in isolated installer
rsliter 8a08e62
ci: keep pinned APT installer shared and supervised
rsliter ffb4e22
test(ci): guard base-pinned CLI installer checkout
rsliter 2bc20c6
chore(ci): retain trusted source-shape policy
rsliter f2ca305
chore(ci): remove review-only test spacing
rsliter 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| #!/usr/bin/env bash | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| update_attempts=1 | ||
| update_timeout=300s | ||
| install_timeout=300s | ||
| acquire_timeout=30 | ||
| if [ "${1:-}" = --retry-transient-update ]; then | ||
| update_attempts=3 | ||
| update_timeout=120s | ||
| install_timeout=180s | ||
| acquire_timeout=20 | ||
| shift | ||
| fi | ||
|
|
||
| if [ "$#" -eq 0 ]; then | ||
| echo "::error title=Missing APT packages::Provide pinned package=version specifications." >&2 | ||
| exit 2 | ||
| fi | ||
| for package_spec in "$@"; do | ||
| if [[ ! "$package_spec" =~ ^[A-Za-z0-9][A-Za-z0-9.+-]*(:[A-Za-z0-9][A-Za-z0-9.+-]*)?=[^[:space:]=]+$ ]]; then | ||
| echo "::error title=Unpinned APT package::Expected package=version." >&2 | ||
| exit 2 | ||
| fi | ||
| done | ||
|
|
||
| ubuntu_sources=/etc/apt/sources.list.d/ubuntu.sources | ||
| if ! sudo test -f "$ubuntu_sources" || ! sudo test -r "$ubuntu_sources"; then | ||
| echo "::error title=Missing Ubuntu APT source::Expected readable $ubuntu_sources." >&2 | ||
| exit 1 | ||
| fi | ||
| if [ -z "${RUNNER_TEMP:-}" ] || [ ! -d "$RUNNER_TEMP" ]; then | ||
| echo "::error title=Missing runner temporary directory::RUNNER_TEMP must be a directory." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| runner_temp_mode="$(stat -c '%a' "$RUNNER_TEMP")" | ||
| apt_lists="$(mktemp -d "$RUNNER_TEMP/nemoclaw-apt-lists.XXXXXXXX")" | ||
| cleanup() { | ||
| local status=$? | ||
| trap - EXIT | ||
| sudo rm -rf -- "$apt_lists" || status=1 | ||
| sudo chmod "$runner_temp_mode" "$RUNNER_TEMP" || status=1 | ||
| exit "$status" | ||
| } | ||
| trap cleanup EXIT | ||
|
|
||
| # APT's _apt user needs traversal into the isolated package-list directory. | ||
| sudo chmod o+x "$RUNNER_TEMP" | ||
| sudo chmod 0755 "$apt_lists" | ||
| sudo install -d -o _apt -g root -m 0700 "$apt_lists/partial" | ||
|
|
||
| apt_options=( | ||
| -o "Dir::Etc::sourcelist=$ubuntu_sources" | ||
| -o "Dir::Etc::sourceparts=-" | ||
| -o "Dir::State::lists=$apt_lists" | ||
| -o "Acquire::http::Timeout=$acquire_timeout" | ||
| -o "Acquire::https::Timeout=$acquire_timeout" | ||
| ) | ||
| if [ "$update_attempts" -gt 1 ]; then | ||
| apt_options+=(-o "Acquire::Retries=2") | ||
| fi | ||
|
|
||
| run_apt() { | ||
| local operation="$1" | ||
| local duration="$2" | ||
| local attempt="$3" | ||
| local total="$4" | ||
| shift 4 | ||
| local log status | ||
| log="$(mktemp "$RUNNER_TEMP/nemoclaw-apt-${operation}.XXXXXXXX")" | ||
| echo "Installing pinned Pi tools: APT $operation started (attempt $attempt/$total)." | ||
| if { sudo timeout -k 10s "$duration" apt-get "${apt_options[@]}" "$@"; } >"$log" 2>&1; then | ||
| rm -f -- "$log" | ||
| echo "Installing pinned Pi tools: APT $operation completed." | ||
| return 0 | ||
| else | ||
| status=$? | ||
| fi | ||
| if [ "$status" -eq 124 ]; then | ||
| if [ "$operation" = update ] && [ "$attempt" -lt "$total" ]; then | ||
| echo "::warning title=APT update timed out::Ubuntu package update exceeded $duration on attempt $attempt/$total; retrying the idempotent metadata update." >&2 | ||
| else | ||
| echo "::error title=APT $operation timed out::Ubuntu package $operation exceeded $duration on attempt $attempt/$total." >&2 | ||
| fi | ||
| elif [ "$status" -eq 137 ]; then | ||
| echo "::error title=APT $operation was force-killed::Ubuntu package $operation exited with status 137 on attempt $attempt/$total; it may have exceeded $duration and been killed by timeout." >&2 | ||
| else | ||
| echo "::error title=APT $operation failed::Ubuntu package $operation exited with status $status on attempt $attempt/$total." >&2 | ||
| fi | ||
| tail -c 8192 "$log" | tail -n 60 >&2 | ||
| rm -f -- "$log" | ||
| return "$status" | ||
| } | ||
|
|
||
| for ((attempt = 1; attempt <= update_attempts; attempt++)); do | ||
| if run_apt update "$update_timeout" "$attempt" "$update_attempts" update; then | ||
| break | ||
| else | ||
| status=$? | ||
| fi | ||
| if [ "$status" -ne 124 ] || [ "$attempt" -eq "$update_attempts" ]; then | ||
| exit "$status" | ||
| fi | ||
| done | ||
| run_apt install "$install_timeout" 1 1 install -y --no-install-recommends "$@" | ||
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.