Skip to content

Fix dev-env-setup for macOS: replace wget with curl, install missing tools#1126

Open
ShreyaGupta08 wants to merge 5 commits intoNVIDIA:mainfrom
ShreyaGupta08:fix/dev-env-setup-macos
Open

Fix dev-env-setup for macOS: replace wget with curl, install missing tools#1126
ShreyaGupta08 wants to merge 5 commits intoNVIDIA:mainfrom
ShreyaGupta08:fix/dev-env-setup-macos

Conversation

@ShreyaGupta08
Copy link
Copy Markdown

@ShreyaGupta08 ShreyaGupta08 commented Apr 7, 2026

Summary

  • Replace all wget calls with curlwget is not available on macOS by default, causing make dev-env-setup to fail mid-script
  • Install Go via Homebrew on macOS instead of only printing a manual hint (the make install-go-ci tar extraction fails on macOS)
  • Install addlicense — required by make license-headers-lint but was not installed by the setup script (only CI installed it)
  • Add GOPATH/bin to PATH automatically during setup, with guidance for making it permanent
  • Use pipx for Poetry installation on macOS to avoid PEP 668 externally-managed-environment errors

Test plan

  • Run make dev-env-setup on a fresh macOS (Apple Silicon) machine and verify it completes without errors
  • Run make dev-env-setup on Linux and verify no regressions (curl replaces wget, all other logic unchanged)
  • Run make lint-test-all after setup completes and verify all lint/test stages pass without manual tool installation
  • Verify addlicense, protoc-gen-go, protoc-gen-go-grpc, golangci-lint, gotestsum, poetry are all available on PATH after setup

Fixes #1125

Summary by CodeRabbit

  • Chores
    • More reliable downloads using curl and stronger verification.
    • Load tool versions from .versions.yaml and add ko to the tools summary.
    • Conditional installs and runtime PATH setup for ko and addlicense when Go exists.
    • Interactive Go install path with optional automated install.
    • Automatic Helm repo add/update when Helm is present.
    • Switch Python tooling to pipx for isolated installs and ensure local bin is available.

@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented Apr 7, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 7, 2026

📝 Walkthrough

Walkthrough

Updated the dev-environment setup script to prefer curl for downloads, load tool versions (including KO_VERSION) from .versions.yaml, conditionally install Go-based tools (ko, addlicense) and Helm repos, bootstrap Poetry via pipx on macOS, and ensure GOPATH/bin is added to the session PATH. Tools verification now includes ko.

Changes

Cohort / File(s) Summary
Development Environment Setup
scripts/setup-dev-env.sh
Replaced wget with curl -fsSL for downloads; load KO_VERSION (and other versions) from .versions.yaml; optionally install ko and addlicense via go install when go exists and after consent; ensure $(go env GOPATH)/bin is appended to PATH for the session; prefer brew install go on macOS when Go is missing; install Poetry via pipx (with pipx inject) and append ~/.local/bin to PATH for the session if needed; add Helm repos and run helm repo update; update end-of-script tools verification to include ko.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through scripts and swapped wget for curl,
I fetched KO_VERSION and helped ko learn to whirl.
Helm sang its charts, pipx set Poetry free,
GOPATH/bin gleams, addlicense joined the spree.
A little rabbit cheered — dev setup ready for me!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main changes: replacing wget with curl and installing missing tools, both of which are core objectives of the PR.
Linked Issues check ✅ Passed The PR implements the key requirements from issue #1125: wget replaced with curl, missing tools installed (addlicense, ko, poetry via pipx), GOPATH/bin added to PATH, and pinned versions from .versions.yaml used.
Out of Scope Changes check ✅ Passed All changes directly address the objectives in issue #1125; no out-of-scope modifications detected beyond the scope of fixing dev-env-setup for macOS.
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

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

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/setup-dev-env.sh (1)

433-434: ⚠️ Potential issue | 🟠 Major

Black installation on macOS may fail with PEP 668 error.

Poetry installation was updated to use pipx to avoid PEP 668 "externally-managed-environment" errors on macOS, but Black installation at line 434 still uses pip3 install directly without --break-system-packages or --user fallback. This will likely fail on modern macOS with Homebrew Python.

🐛 Proposed fix to handle PEP 668 for Black on macOS
         if prompt_continue; then
             if [[ "${OS}" == "darwin" ]]; then
-                pip3 install black=="${BLACK_VERSION}"
+                pip3 install --break-system-packages black=="${BLACK_VERSION}" 2>/dev/null || \
+                    pip3 install --user black=="${BLACK_VERSION}"
             elif [[ "${OS}" == "linux" ]]; then
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/setup-dev-env.sh` around lines 433 - 434, The macOS Black install
line uses pip3 install directly and can trigger PEP 668; update the darwin
branch where pip3 installs Black (the pip3 install black=="${BLACK_VERSION}"
invocation) to either install via pipx (preferred) like pipx install
"black==${BLACK_VERSION}" or, if pipx is not available, run pip3 with a safe
fallback: first try pip3 install --break-system-packages
"black==${BLACK_VERSION}" and if that fails fallback to python3 -m pip install
--user "black==${BLACK_VERSION}" so installations on Homebrew macOS don't hit
the externally-managed-environment error.
🧹 Nitpick comments (1)
scripts/setup-dev-env.sh (1)

671-678: Shell profile suggestion could be more universal.

Line 677 only suggests ~/.zshrc, but users may use bash (~/.bashrc) or other shells. Consider detecting the current shell or providing a more generic suggestion.

♻️ Proposed fix for more universal shell guidance
     if [[ ":${PATH}:" != *":${GOPATH_BIN}:"* ]]; then
         export PATH="${PATH}:${GOPATH_BIN}"
         log_warning "Added ${GOPATH_BIN} to PATH for this session"
         log_info "To make this permanent, add to your shell profile:"
-        log_info "  echo 'export PATH=\"\$PATH:\$(go env GOPATH)/bin\"' >> ~/.zshrc"
+        SHELL_RC="${HOME}/.$(basename "${SHELL}")rc"
+        log_info "  echo 'export PATH=\"\$PATH:\$(go env GOPATH)/bin\"' >> ${SHELL_RC}"
     fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/setup-dev-env.sh` around lines 671 - 678, The suggestion to append
GOPATH_BIN to a single shell profile (~/.zshrc) is too narrow; update the logic
around GOPATH_BIN and the log_info messages to detect the current shell (using
$SHELL or $0) and print a tailored, universal instruction — e.g., show the
appropriate profile file (~/.bashrc, ~/.zshrc, ~/.profile) or print multiple
options — by modifying the block that sets GOPATH_BIN and calls
log_warning/log_info so the log_info lines reference the detected profile(s)
instead of hardcoding ~/.zshrc.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/setup-dev-env.sh`:
- Around line 403-410: After calling pipx ensurepath (before running pipx
install and pipx inject), ensure the pipx user-bin directory is added to the
current shell PATH so poetry is available in this session; detect the pipx bin
dir (e.g., use python3 -m site --user-base and append /bin, or fallback to
$HOME/.local/bin), export it into PATH for the current process, then proceed to
pipx install "poetry==${POETRY_VERSION}" and pipx inject. This change should be
applied near the pipx ensurepath/pipx install/pipx inject block so the later
summary correctly detects poetry.
- Around line 319-325: The macOS branch installs an unpinned Go via "brew
install go" causing version drift; change the macOS flow in the OS == "darwin"
block (where command_exists and log_success/log_error are used) to call the
Makefile target "make install-go-ci" so the Go version is pinned to GO_VERSION
from .versions.yaml (same behavior as the Linux/CI path) and adjust the
success/error log messages accordingly.

---

Outside diff comments:
In `@scripts/setup-dev-env.sh`:
- Around line 433-434: The macOS Black install line uses pip3 install directly
and can trigger PEP 668; update the darwin branch where pip3 installs Black (the
pip3 install black=="${BLACK_VERSION}" invocation) to either install via pipx
(preferred) like pipx install "black==${BLACK_VERSION}" or, if pipx is not
available, run pip3 with a safe fallback: first try pip3 install
--break-system-packages "black==${BLACK_VERSION}" and if that fails fallback to
python3 -m pip install --user "black==${BLACK_VERSION}" so installations on
Homebrew macOS don't hit the externally-managed-environment error.

---

Nitpick comments:
In `@scripts/setup-dev-env.sh`:
- Around line 671-678: The suggestion to append GOPATH_BIN to a single shell
profile (~/.zshrc) is too narrow; update the logic around GOPATH_BIN and the
log_info messages to detect the current shell (using $SHELL or $0) and print a
tailored, universal instruction — e.g., show the appropriate profile file
(~/.bashrc, ~/.zshrc, ~/.profile) or print multiple options — by modifying the
block that sets GOPATH_BIN and calls log_warning/log_info so the log_info lines
reference the detected profile(s) instead of hardcoding ~/.zshrc.
🪄 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: Pro

Run ID: 7c6b30ce-2028-4941-8557-8bdedca3c1c4

📥 Commits

Reviewing files that changed from the base of the PR and between 065709f and 5db6088.

📒 Files selected for processing (1)
  • scripts/setup-dev-env.sh

Comment thread scripts/setup-dev-env.sh Outdated
Comment thread scripts/setup-dev-env.sh
…tools

- Replace all wget calls with curl (wget not available on macOS by default)
- Install Go via Homebrew on macOS instead of just printing a manual hint
- Install addlicense (required by license-headers-lint but was missing)
- Add GOPATH/bin to PATH with permanent setup guidance
- Use pipx for Poetry on macOS to avoid PEP 668 externally-managed-environment errors

Fixes NVIDIA#1125

Signed-off-by: Shreya Gupta <shregupta@nvidia.com>
- Install ko at pinned version from .versions.yaml (required by Tilt to build Go services)
- Add Helm chart repos (jetstack, prometheus-community, sigs-kwok) needed by make dev-env
- Add ko to summary tools checklist

Signed-off-by: Shreya Gupta <shregupta@nvidia.com>
@ShreyaGupta08 ShreyaGupta08 force-pushed the fix/dev-env-setup-macos branch from 94ecd6a to c08bc42 Compare April 13, 2026 17:35
@lalitadithya
Copy link
Copy Markdown
Collaborator

/ok to test 5db3cd3

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

Actionable comments posted: 2

♻️ Duplicate comments (2)
scripts/setup-dev-env.sh (2)

320-323: ⚠️ Potential issue | 🟠 Major

Use the pinned Go installer on macOS.

brew install go ignores GO_VERSION, so macOS can drift from .versions.yaml and CI. Makefile:201-268 already supports darwin in install-go-ci, so calling that here keeps both platforms on the same version.

Suggested fix
-                if command_exists brew; then
-                    brew install go
-                    log_success "Go installed via Homebrew"
+                if command_exists brew; then
+                    make install-go-ci
+                    log_success "Go ${GO_VERSION} installed"
                 else
                     log_error "Homebrew not found. Please install Go manually or install Homebrew first."
                 fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/setup-dev-env.sh` around lines 320 - 323, The macOS branch currently
runs "brew install go" which ignores GO_VERSION; replace that call so macOS uses
the same pinned installer as CI by invoking the Makefile's install-go-ci target
instead (call the Makefile target used elsewhere, e.g., install-go-ci) so the
script uses the pinned GO_VERSION for darwin; update the block that references
brew (in scripts/setup-dev-env.sh) to call the Makefile target (install-go-ci)
for darwin rather than brew install.

404-411: ⚠️ Potential issue | 🟠 Major

Export the pipx bin dir before installing Poetry.

pipx ensurepath updates shell config files for later sessions; it does not make poetry available in the current shell, so the summary at the end can still report Poetry as missing in the same run. (pipx.pypa.io)

Suggested fix
                 if ! command_exists pipx; then
                     log_info "Installing pipx first (required for Poetry on macOS)..."
                     brew install pipx
                     pipx ensurepath
                 fi
+                PIPX_BIN="$(python3 -m site --user-base 2>/dev/null || echo "${HOME}/.local")/bin"
+                if [[ ":${PATH}:" != *":${PIPX_BIN}:"* ]]; then
+                    export PATH="${PIPX_BIN}:${PATH}"
+                    log_info "Added ${PIPX_BIN} to PATH for this session"
+                fi
                 pipx install "poetry==${POETRY_VERSION}"
                 pipx inject poetry "poetry-plugin-export==${POETRY_PLUGIN_EXPORT_VERSION}"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/setup-dev-env.sh` around lines 404 - 411, The script calls pipx
ensurepath but does not make the pipx user-bin dir available in the current
shell before running pipx install, so export the pipx bin directory into PATH
immediately after pipx ensurepath and before pipx install
"poetry==${POETRY_VERSION}"; you can compute the user bin with python3 -m site
--user-base and append "/bin" (or fall back to ~/.local/bin on Linux/macOS) and
export PATH="$USER_BASE_BIN:$PATH", then run pipx install and pipx inject as
currently done (refer to pipx ensurepath, pipx install
"poetry==${POETRY_VERSION}", pipx inject poetry
"poetry-plugin-export==${POETRY_PLUGIN_EXPORT_VERSION}").
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/setup-dev-env.sh`:
- Around line 635-640: The script currently prints log_success "ko installed"
regardless of whether the go install ran; move the success message inside the
branch that actually runs go install (the if block using command_exists and
invoking go install github.com/google/ko@"${KO_VERSION}") and only emit
log_success after the install command completes successfully (check its exit
status); keep the log_warning "Go not available — cannot install ko. Install Go
first." in the else branch and do not emit the success message there.
- Around line 698-703: The script currently appends GOPATH_BIN to PATH which
lets system tools override pinned versions; change it to prepend GOPATH_BIN by
exporting PATH="${GOPATH_BIN}:${PATH}" (update the export that references
GOPATH_BIN and the log_warning message if needed) and update the profile hint
lines (the log_info echo that writes export PATH) so it suggests echo 'export
PATH="${GOPATH_BIN}:$PATH"' >> ~/.zshrc (or use the original go env expression)
to ensure GOPATH/bin takes precedence at login and runtime; adjust references to
GOPATH_BIN, PATH export, and the profile hint messages accordingly.

---

Duplicate comments:
In `@scripts/setup-dev-env.sh`:
- Around line 320-323: The macOS branch currently runs "brew install go" which
ignores GO_VERSION; replace that call so macOS uses the same pinned installer as
CI by invoking the Makefile's install-go-ci target instead (call the Makefile
target used elsewhere, e.g., install-go-ci) so the script uses the pinned
GO_VERSION for darwin; update the block that references brew (in
scripts/setup-dev-env.sh) to call the Makefile target (install-go-ci) for darwin
rather than brew install.
- Around line 404-411: The script calls pipx ensurepath but does not make the
pipx user-bin dir available in the current shell before running pipx install, so
export the pipx bin directory into PATH immediately after pipx ensurepath and
before pipx install "poetry==${POETRY_VERSION}"; you can compute the user bin
with python3 -m site --user-base and append "/bin" (or fall back to ~/.local/bin
on Linux/macOS) and export PATH="$USER_BASE_BIN:$PATH", then run pipx install
and pipx inject as currently done (refer to pipx ensurepath, pipx install
"poetry==${POETRY_VERSION}", pipx inject poetry
"poetry-plugin-export==${POETRY_PLUGIN_EXPORT_VERSION}").
🪄 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: Pro Plus

Run ID: b3e2cb68-8173-45af-b5b6-6e8a8f377e5d

📥 Commits

Reviewing files that changed from the base of the PR and between 94ecd6a and c08bc42.

📒 Files selected for processing (1)
  • scripts/setup-dev-env.sh

Comment thread scripts/setup-dev-env.sh Outdated
Comment thread scripts/setup-dev-env.sh Outdated
- Pin Go version on macOS: use make install-go-ci instead of brew install go,
  which installs unpinned latest. The Makefile target already supports darwin.
- Add pipx bin to PATH for current session after Poetry install, so the
  summary check correctly detects poetry.
- Fix ko install: only log success when go install actually runs, not when
  Go is unavailable.
- Prepend GOPATH/bin to PATH instead of appending, so version-pinned tools
  in GOPATH/bin take precedence over any system-installed versions.

Signed-off-by: Shreya Gupta <shregupta@nvidia.com>
Copy link
Copy Markdown
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.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/setup-dev-env.sh (1)

306-321: ⚠️ Potential issue | 🟠 Major

Auto-remediate Go version drift instead of continuing with the wrong toolchain.

If go is present but does not match .versions.yaml, this branch only prints a manual command and keeps going. The later go install steps then run against the wrong compiler, so dev-env-setup no longer leaves the environment in the pinned state promised by the PR.

Suggested fix
     if command_exists go; then
         CURRENT_GO=$(go version | grep -o 'go[0-9]\+\.[0-9]\+\.[0-9]\+' | sed 's/go//' || echo "unknown")
         log_info "Current Go version: ${CURRENT_GO}"

         if [[ "${CURRENT_GO}" == "${GO_VERSION}"* ]]; then
             log_success "Go ${GO_VERSION} already installed"
         else
             log_warning "Go version mismatch (current: ${CURRENT_GO}, target: ${GO_VERSION})"
-            log_info "To install Go ${GO_VERSION}, run: make install-go-ci"
+            log_info "Installing Go ${GO_VERSION}..."
+            if prompt_continue; then
+                make install-go-ci
+                log_success "Go ${GO_VERSION} installed"
+            fi
         fi
     else
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/setup-dev-env.sh` around lines 306 - 321, The script currently logs a
Go version mismatch (using CURRENT_GO vs GO_VERSION) but continues; change the
mismatch branch so the setup auto-remediates by invoking make install-go-ci (or
prompting via prompt_continue and then calling make install-go-ci) and aborts or
retries until the expected version is installed; update the branch that
currently logs "Go version mismatch" to call make install-go-ci (using
prompt_continue if interactive) and verify CURRENT_GO again (re-run go version)
before proceeding so the rest of the script runs with the pinned GO_VERSION.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/setup-dev-env.sh`:
- Around line 642-648: The helm repo add calls in the setup script are masking
failures by redirecting stderr and forcing success; update the block around
command_exists/helm to run each helm repo add without `2>/dev/null || true`,
capture its exit status and stderr, and only treat failures as non-fatal when
the stderr/output explicitly indicates the repo "already exists"; for other
non-zero exits (e.g., network errors) log the error with log_error including the
captured stderr and exit or return a non-zero status so the script stops rather
than incorrectly logging "Helm repositories configured"; reference the
command_exists check and the log_info/log_success calls to locate where to
insert the error handling and early exit logic.
- Around line 682-691: The script currently skips installation if any addlicense
binary exists (command_exists), which allows an unpinned system copy to satisfy
the check; change the logic to detect the installed addlicense version and
compare it to ADDLICENSE_VERSION: if addlicense is present, invoke it to obtain
its version string (e.g., call the binary with its version flag and parse
output), compare against the value in ADDLICENSE_VERSION, and only skip
installation when they match exactly; if the binary is missing or the version
differs, call go install github.com/google/addlicense@"${ADDLICENSE_VERSION}"
(as currently done inside the prompt_continue block) and update the log messages
in this block (references: ADDLICENSE_VERSION, command_exists, prompt_continue,
and the go install invocation).

---

Outside diff comments:
In `@scripts/setup-dev-env.sh`:
- Around line 306-321: The script currently logs a Go version mismatch (using
CURRENT_GO vs GO_VERSION) but continues; change the mismatch branch so the setup
auto-remediates by invoking make install-go-ci (or prompting via prompt_continue
and then calling make install-go-ci) and aborts or retries until the expected
version is installed; update the branch that currently logs "Go version
mismatch" to call make install-go-ci (using prompt_continue if interactive) and
verify CURRENT_GO again (re-run go version) before proceeding so the rest of the
script runs with the pinned GO_VERSION.
🪄 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: Pro Plus

Run ID: 7626a7c6-c719-4808-83cf-23cac80f46ed

📥 Commits

Reviewing files that changed from the base of the PR and between c08bc42 and 7ed5770.

📒 Files selected for processing (1)
  • scripts/setup-dev-env.sh

Comment thread scripts/setup-dev-env.sh
Comment on lines +642 to +648
if command_exists helm; then
log_info "Adding required Helm chart repositories..."
helm repo add jetstack https://charts.jetstack.io 2>/dev/null || true
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts 2>/dev/null || true
helm repo add sigs-kwok https://kwok.sigs.k8s.io/charts 2>/dev/null || true
helm repo update
log_success "Helm repositories configured"
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.

⚠️ Potential issue | 🟠 Major

Do not mask Helm repository add failures.

2>/dev/null || true hides every helm repo add failure, not just the idempotent "already exists" case. A transient network error here still ends with Helm repositories configured, leaving later chart installs to fail much later.

Suggested fix
     if command_exists helm; then
         log_info "Adding required Helm chart repositories..."
-        helm repo add jetstack https://charts.jetstack.io 2>/dev/null || true
-        helm repo add prometheus-community https://prometheus-community.github.io/helm-charts 2>/dev/null || true
-        helm repo add sigs-kwok https://kwok.sigs.k8s.io/charts 2>/dev/null || true
+        helm repo list | awk 'NR > 1 {print $1}' | grep -qx 'jetstack' || \
+            helm repo add jetstack https://charts.jetstack.io
+        helm repo list | awk 'NR > 1 {print $1}' | grep -qx 'prometheus-community' || \
+            helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
+        helm repo list | awk 'NR > 1 {print $1}' | grep -qx 'sigs-kwok' || \
+            helm repo add sigs-kwok https://kwok.sigs.k8s.io/charts
         helm repo update
         log_success "Helm repositories configured"
     fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if command_exists helm; then
log_info "Adding required Helm chart repositories..."
helm repo add jetstack https://charts.jetstack.io 2>/dev/null || true
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts 2>/dev/null || true
helm repo add sigs-kwok https://kwok.sigs.k8s.io/charts 2>/dev/null || true
helm repo update
log_success "Helm repositories configured"
if command_exists helm; then
log_info "Adding required Helm chart repositories..."
helm repo list | awk 'NR > 1 {print $1}' | grep -qx 'jetstack' || \
helm repo add jetstack https://charts.jetstack.io
helm repo list | awk 'NR > 1 {print $1}' | grep -qx 'prometheus-community' || \
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo list | awk 'NR > 1 {print $1}' | grep -qx 'sigs-kwok' || \
helm repo add sigs-kwok https://kwok.sigs.k8s.io/charts
helm repo update
log_success "Helm repositories configured"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/setup-dev-env.sh` around lines 642 - 648, The helm repo add calls in
the setup script are masking failures by redirecting stderr and forcing success;
update the block around command_exists/helm to run each helm repo add without
`2>/dev/null || true`, capture its exit status and stderr, and only treat
failures as non-fatal when the stderr/output explicitly indicates the repo
"already exists"; for other non-zero exits (e.g., network errors) log the error
with log_error including the captured stderr and exit or return a non-zero
status so the script stops rather than incorrectly logging "Helm repositories
configured"; reference the command_exists check and the log_info/log_success
calls to locate where to insert the error handling and early exit logic.

Comment thread scripts/setup-dev-env.sh
Comment on lines +682 to +691
# Install addlicense (needed for license-headers-lint)
ADDLICENSE_VERSION=$(yq '.linting.addlicense' .versions.yaml)
if command_exists addlicense; then
log_success "addlicense already installed"
else
log_info "Installing addlicense ${ADDLICENSE_VERSION}..."
if prompt_continue; then
go install github.com/google/addlicense@"${ADDLICENSE_VERSION}"
log_success "addlicense installed"
fi
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.

⚠️ Potential issue | 🟠 Major

Presence-only checking is not enough for addlicense.

This skips installation as soon as any addlicense binary is found, even if it is an older system copy. That breaks the PR’s “exact versions from .versions.yaml” goal and can leave make license-headers-lint running against an unpinned tool.

Suggested fix
     # Install addlicense (needed for license-headers-lint)
     ADDLICENSE_VERSION=$(yq '.linting.addlicense' .versions.yaml)
-    if command_exists addlicense; then
-        log_success "addlicense already installed"
-    else
-        log_info "Installing addlicense ${ADDLICENSE_VERSION}..."
-        if prompt_continue; then
-            go install github.com/google/addlicense@"${ADDLICENSE_VERSION}"
-            log_success "addlicense installed"
-        fi
+    log_info "Installing addlicense ${ADDLICENSE_VERSION}..."
+    if prompt_continue; then
+        go install github.com/google/addlicense@"${ADDLICENSE_VERSION}"
+        log_success "addlicense installed"
     fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/setup-dev-env.sh` around lines 682 - 691, The script currently skips
installation if any addlicense binary exists (command_exists), which allows an
unpinned system copy to satisfy the check; change the logic to detect the
installed addlicense version and compare it to ADDLICENSE_VERSION: if addlicense
is present, invoke it to obtain its version string (e.g., call the binary with
its version flag and parse output), compare against the value in
ADDLICENSE_VERSION, and only skip installation when they match exactly; if the
binary is missing or the version differs, call go install
github.com/google/addlicense@"${ADDLICENSE_VERSION}" (as currently done inside
the prompt_continue block) and update the log messages in this block
(references: ADDLICENSE_VERSION, command_exists, prompt_continue, and the go
install 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.

make dev-env-setup missing several dependencies required for make lint-test-all on macOS

2 participants