Skip to content

feat: make install.sh configurable for air-gapped environments#660

Open
chkp-roniz wants to merge 4 commits intomicrosoft:mainfrom
chkp-roniz:feat/install-dir-param
Open

feat: make install.sh configurable for air-gapped environments#660
chkp-roniz wants to merge 4 commits intomicrosoft:mainfrom
chkp-roniz:feat/install-dir-param

Conversation

@chkp-roniz
Copy link
Copy Markdown
Contributor

@chkp-roniz chkp-roniz commented Apr 10, 2026

Summary

  • APM_INSTALL_DIR env var to override install path (default /usr/local/bin)
  • GITHUB_URL env var to override GitHub base URL for mirrors/GHE
  • REPO env var to override repository (default microsoft/apm)
  • VERSION env var or @v1.2.3 arg to pin a specific version — skips GitHub API entirely when set

Usage

# Specific version (no GitHub API call needed)
curl -sSL https://aka.ms/apm-unix | sh -s -- @v0.8.10

# Custom install directory
curl -sSL https://aka.ms/apm-unix | APM_INSTALL_DIR=~/.local/bin sh

# Air-gapped / internal mirror
GITHUB_URL=https://artifactory.corp.com/artifactory/github VERSION=v0.8.10 sh install.sh

Test plan

  • Tested with custom GITHUB_URL + VERSION=v0.8.10 — downloads from mirror, skips API
  • Tested with unreachable API — confirmed API is skipped when VERSION is set
  • Tested with APM_INSTALL_DIR=$HOME/.local/bin — installs to custom dir without sudo
  • bash -n install.sh syntax check passes
  • No hardcoded https://github.com outside Configuration defaults

🤖 Generated with Claude Code

chkp-roniz and others added 2 commits April 10, 2026 10:12
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>
Copilot AI review requested due to automatic review settings April 10, 2026 07:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and VERSION (plus @vX.Y.Z positional argument support).
  • When VERSION is 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_URL is configurable, but the script still hardcodes https://api.github.com/... for the latest release lookup. This will break GitHub Enterprise / mirrored setups when VERSION is not provided, and it also conflicts with the PR description mentioning GITHUB_API_URL. Consider adding a GITHUB_API_URL (defaulting to https://api.github.com, or derived from GITHUB_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 cp1252 UnicodeEncodeError issues.
    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 though REPO/GITHUB_URL are 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

Comment on lines 4 to +8
# 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
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
chkp-roniz and others added 2 commits April 10, 2026 12:05
- 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>
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.

2 participants