Fix: fix: make install-gh-aw-local gracefully skip if gh CLI is not available
Fixed argoproj/argo-cd#28796 — 5 line bug-fix.

The Bug
Repo: argoproj/argo-cd Issue: #28796 Status: PR-submitted PR: https://github.com/argoproj/argo-cd/pull/28806
Description: fix: make install-gh-aw-local gracefully skip if gh CLI is not available
Fix scope: 5 lines changed in Makefile
Root Cause
The issue surfaces in argo-cd’s Makefile at the install-gh-aw-local target. This target unconditionally runs gh extension install, which fails the entire make install-tools-local invocation when the gh CLI isn’t present on the build machine. In CI environments where builds run on ephemeral runners with minimal tooling, gh may not be installed — yet the build should still succeed because the gh-aw extension is only needed for GitHub Agentics workflows, not for building or testing Argo CD itself.
The fix is a focused change — it addresses exactly the failing condition without refactoring surrounding code. A guard using command -v gh checks for CLI availability before attempting the install, and prints a non-fatal warning when skipped. This minimizes the risk of introducing new bugs while making the build pipeline resilient to missing optional tools.
Impact: The bug affects users who hit the specific edge case. For argo-cd, this means 5 lines fixes a scenario that could cause incorrect output, crashes, or silent data corruption depending on the code path.
The Fix
This is a focused fix — every line is deliberate and scoped to exactly the problem.
@@ -645,7 +645,11 @@ install-tools-local: install-test-tools-local install-codegen-tools-local instal
# Installs the gh aw CLI extension for managing GitHub Agentics workflows
.PHONY: install-gh-aw-local
install-gh-aw-local:
- . hack/tool-versions.sh && gh extension install --pin v$${GH_AW_VERSION} --force github/gh-aw
+ @if command -v gh >/dev/null 2>&1; then \
+ . hack/tool-versions.sh && gh extension install --pin v$${GH_AW_VERSION} --force github/gh-aw; \
+ else \
+ echo "WARNING: gh CLI not found — skipping gh-aw extension install (not required for building Argo CD)"; \
+ fi
# Installs all tools required for running unit & end-to-end tests (Linux packages)
.PHONY: install-test-tools-local
Pattern & Takeaways
Pattern: Build systems that assume optional tooling is always available will fail on ephemeral CI runners with minimal installations. The fix demonstrates that the most reliable approach is to add an explicit capability check before invoking the tool, with a graceful degradation path.
Key insight: The most predictable bugs are edge cases at input boundaries. Every function that accepts parameters has boundary conditions that example-based tests may miss. Code review should focus on: (1) What happens with empty/null input? (2) What happens at iteration boundaries? (3) What happens with unexpected types?
Transfer Potential
Varies — edge case fixes are repo-specific in detail but universal in pattern. The minimal-change principle and boundary-condition thinking transfer to any codebase. Reading this post helps recognize similar patterns in your own projects.
Auto-generated from PR #28796. View all patches on GitHub.