feat: make install.sh configurable for air-gapped environments#660
feat: make install.sh configurable for air-gapped environments#660chkp-roniz wants to merge 4 commits intomicrosoft:mainfrom
Conversation
Defaults to /usr/local/bin when not set. Usage: curl -sSL https://aka.ms/apm-unix | INSTALL_DIR=~/.local/bin sh Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ents - APM_INSTALL_DIR: override install path (default /usr/local/bin) - GITHUB_URL: override GitHub base URL for mirrors/GHE - REPO: override repository (default microsoft/apm) - VERSION: pin a specific version (@v1.2.3 arg or env var), skips GitHub API entirely when set Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the install.sh bootstrap installer to support air-gapped and enterprise environments by allowing callers to override the GitHub host/repo, install location, and (optionally) pin a version to avoid the GitHub API.
Changes:
- Added configurable environment variables:
APM_INSTALL_DIR,GITHUB_URL,REPO, andVERSION(plus@vX.Y.Zpositional argument support). - When
VERSIONis provided, the installer skips the GitHub API and constructs the release download URL directly. - Updated user-facing URLs/messages to use the configurable GitHub base URL.
Comments suppressed due to low confidence (3)
install.sh:224
GITHUB_URLis configurable, but the script still hardcodeshttps://api.github.com/...for the latest release lookup. This will break GitHub Enterprise / mirrored setups whenVERSIONis not provided, and it also conflicts with the PR description mentioningGITHUB_API_URL. Consider adding aGITHUB_API_URL(defaulting tohttps://api.github.com, or derived fromGITHUB_URL) and using it for both unauthenticated and authenticated API calls.
if [ -z "$TAG_NAME" ]; then
# Get latest release info
echo -e "${YELLOW}Fetching latest release information...${NC}"
# Try to fetch release info without authentication first (for public repos)
LATEST_RELEASE=$(curl -s "https://api.github.com/repos/$REPO/releases/latest")
CURL_EXIT_CODE=$?
install.sh:518
- Output strings in this modified block include non-ASCII characters (e.g.,
✓,⚠,🎉). The repo encoding guideline requires printable ASCII only for source/CLI output; please replace these with the project's ASCII status symbols (e.g.[+],[!]) to avoid Windows cp1252UnicodeEncodeErrorissues.
echo -e "${GREEN}✓ APM installed successfully!${NC}"
echo -e "${BLUE}Version: $INSTALLED_VERSION${NC}"
echo -e "${BLUE}Location: $APM_INSTALL_DIR/$BINARY_NAME -> $APM_LIB_DIR/$BINARY_NAME${NC}"
else
echo -e "${YELLOW}⚠ APM installed but not found in PATH${NC}"
echo "You may need to add $APM_INSTALL_DIR to your PATH environment variable."
echo "Add this line to your shell profile (.bashrc, .zshrc, etc.):"
echo " export PATH=\"$APM_INSTALL_DIR:\$PATH\""
fi
echo ""
echo -e "${GREEN}🎉 Installation complete!${NC}"
install.sh:12
- The private-repo usage example still hardcodes
https://raw.githubusercontent.com/microsoft/apm/...even thoughREPO/GITHUB_URLare now configurable for GHE/mirrors. Consider either updating these instructions to match the new configuration knobs (or explicitly documenting that these curl examples apply only to github.com).
# For private repositories, use with authentication:
# curl -sSL -H "Authorization: token $GITHUB_APM_PAT" \
# https://raw.githubusercontent.com/microsoft/apm/main/install.sh | \
# GITHUB_APM_PAT=$GITHUB_APM_PAT sh
| # APM CLI Installer Script | ||
| # Usage: curl -sSL https://aka.ms/apm-unix | sh | ||
| # Specific version: curl -sSL https://aka.ms/apm-unix | sh -s -- @v1.2.3 | ||
| # Custom install dir: curl -sSL https://aka.ms/apm-unix | APM_INSTALL_DIR=~/.local/bin sh | ||
| # GitHub Enterprise: GITHUB_URL=https://gh.corp.com sh install.sh |
There was a problem hiding this comment.
This change introduces new supported installer inputs (APM_INSTALL_DIR, GITHUB_URL, REPO, VERSION / @vX.Y.Z). The repo docs currently describe a fixed /usr/local/bin install path and don't mention version pinning or air-gapped/GHE usage (e.g. docs/src/content/docs/getting-started/installation.md). Please update the relevant docs pages (and the apm-guide skill docs under packages/apm-guide/.apm/skills/apm-usage/) to reflect the new options.
- Use $HOME instead of ~ in usage example (dash/sh compatibility) - Set AUTH_HEADER_VALUE before download section so private repo auth works even when VERSION skips the API path - mkdir -p APM_INSTALL_DIR before symlink to avoid unnecessary sudo - Update stale comment referencing /usr/local/bin Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Update installation docs and apm-guide skill to cover APM_INSTALL_DIR, GITHUB_URL, REPO, VERSION, and @Version syntax. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
APM_INSTALL_DIRenv var to override install path (default/usr/local/bin)GITHUB_URLenv var to override GitHub base URL for mirrors/GHEREPOenv var to override repository (defaultmicrosoft/apm)VERSIONenv var or@v1.2.3arg to pin a specific version — skips GitHub API entirely when setUsage
Test plan
GITHUB_URL+VERSION=v0.8.10— downloads from mirror, skips APIAPM_INSTALL_DIR=$HOME/.local/bin— installs to custom dir without sudobash -n install.shsyntax check passeshttps://github.comoutside Configuration defaults🤖 Generated with Claude Code