Skip to content

fix(cli): download ic-admin from GitHub releases - #2039

Merged
r-birkner merged 6 commits into
mainfrom
rjb/fix-ic-admin-download
Jun 16, 2026
Merged

fix(cli): download ic-admin from GitHub releases#2039
r-birkner merged 6 commits into
mainfrom
rjb/fix-ic-admin-download

Conversation

@r-birkner

Copy link
Copy Markdown
Contributor

Summary

  • download.dfinity.systems no longer serves ic-admin binaries; switch to GitHub Releases on dfinity/ic
  • Add find_github_release_tag_for_commit which resolves a commit SHA to a release tag by querying the GitHub matching-refs API (searches from current year back to 2024, with pagination)
  • Update asset naming to match new conventions: ic-admin-{arm64,x86_64}-{darwin,linux}.gz
  • Add proper ARM64 support for both Linux and macOS (Apple Silicon)
  • Update FALLBACK_IC_ADMIN_VERSION to b95f4a32b41798de115aac9298b51dd1662f1da5 (release-2026-06-04_04-52-base), since the old fallback has no GitHub release

Test plan

  • Run dre on a macOS (Apple Silicon) machine and verify ic-admin is downloaded from GitHub
  • Run dre on an x86_64 Linux machine and verify ic-admin is downloaded from GitHub
  • Verify the fallback version resolves correctly to a GitHub release tag

🤖 Generated with Claude Code

r-birkner and others added 5 commits June 8, 2026 10:21
…dfinity.systems

The download.dfinity.systems host no longer serves ic-admin binaries.
Switch to GitHub releases (dfinity/ic), resolving the release tag from
the commit hash via the GitHub matching-refs API. Update asset naming
to match new conventions (ic-admin-{arch}-{os}.gz) and add ARM support.
Update fallback version to one that has a GitHub release.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
rls was removed from Rust in newer versions. rust-analyzer is the
current replacement.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Three fixes to ic-admin handling:

1. Wire up --ic-admin: the flag was defined but never read, so pointing
   dre at an explicit ic-admin binary silently did nothing and it still
   tried to download. It now bypasses download entirely, validates the
   path up front, and supports bare commands resolved via $PATH.

2. Fix --ic-admin-version help/aliases: the help advertised aliases
   (governance, default, ...) that the parser didn't accept, so they
   were silently treated as commit hashes and failed downstream. The
   parser now accepts those aliases and the help matches reality.

3. Only deep-scan releases when needed: registry/fallback versions are
   always recent, so resolving them now only scans recent releases.
   The full multi-year scan is reserved for explicitly pinned
   --ic-admin-version <commit>. Also honor GITHUB_TOKEN and surface
   rate-limit errors with an actionable message.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… release

The default --ic-admin-version=from-registry resolves ic-admin from the
NNS registry canister's git_commit_id, which is the commit the *canister
WASM* was built from. That commit is generally a plain master commit, not
a tagged GuestOS `release-*`, so it has no GitHub release. The old
download.dfinity.systems served per-commit artifacts so any commit worked;
GitHub releases only exist for elected releases, so the default path would
hard-fail to download ic-admin in the common case.

Resolve this by falling back to FALLBACK_IC_ADMIN_VERSION (a recent, real
release that works fine against mainnet) when the registry-derived version
has no published release. The version actually used is cached so subsequent
runs don't re-resolve. An explicitly pinned --ic-admin-version <commit>
still errors rather than silently substituting.

find_github_release_tag_for_commit now returns Ok(None) for "not released"
vs Err for network/rate-limit problems, so callers can distinguish them.

Update the network test fixtures accordingly: the dead S3-only commit is
replaced with a real released commit, and the registry scenario accepts
either a direct match or the fallback.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

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 dre’s ic-admin acquisition logic to stop using download.dfinity.systems and instead download ic-admin from GitHub Releases in dfinity/ic, including resolving a commit SHA to a release-* tag and adding ARM64 support.

Changes:

  • Added GitHub API-based commit→release-tag resolution and switched ic-admin downloads to github.com/dfinity/ic/releases.
  • Updated ic-admin version resolution to allow falling back (for registry-derived unreleased commits) and to cache the effective version used.
  • Improved CLI args/docs and added/updated unit tests around ic-admin version parsing and selection.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
rs/cli/src/store.rs Adds GitHub release tag resolution, switches download source to GitHub releases, and updates fallback/version caching logic.
rs/cli/src/exe/args.rs Clarifies --ic-admin / --ic-admin-version help text, expands aliases, and adds parsing unit tests.
rs/cli/src/ctx/unit_tests.rs Updates context construction and adjusts version-resolution tests for the new release/fallback behavior.
rs/cli/src/ctx/mod.rs Adds --ic-admin override behavior to skip download/version resolution when an explicit binary is provided.
docker/Dockerfile Replaces rls with rust-analyzer during toolchain setup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread rs/cli/src/store.rs
Comment thread rs/cli/src/exe/args.rs Outdated
Comment thread docker/Dockerfile
- ic-admin asset selection: only match the platforms dfinity/ic actually
  publishes (arm64-darwin, arm64-linux, x86_64-linux). Intel macOS and any
  other OS/arch now fail fast with a clear message pointing to --ic-admin,
  instead of downloading an ARM binary on Intel macs or silently falling
  back to the Linux x86_64 asset.
- --ic-admin-version help: list all accepted aliases (from-governance, govn)
  so the docs match the parser.
- docker/Dockerfile: download ic-admin from a pinned GitHub release tag
  instead of the defunct download.dfinity.systems, which would have broken
  image builds.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@r-birkner
r-birkner marked this pull request as ready for review June 15, 2026 15:53
@r-birkner
r-birkner requested a review from a team as a code owner June 15, 2026 15:53

@NikolaMilosa NikolaMilosa left a comment

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.

Thanks!

Comment thread rs/cli/src/store.rs
@r-birkner
r-birkner merged commit e2dc8c8 into main Jun 16, 2026
8 checks passed
@r-birkner
r-birkner deleted the rjb/fix-ic-admin-download branch June 16, 2026 15:58
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.

3 participants