fix(self-update): pin installer ref to latest version#2026
Open
fallintoplace wants to merge 1 commit into
Open
fix(self-update): pin installer ref to latest version#2026fallintoplace wants to merge 1 commit into
fallintoplace wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the apm self-update flow to download the installer script from the release tag ref (v<latest_version>) instead of a moving branch ref (previously main) when using a custom GITHUB_URL/APM_REPO, and adjusts installer subprocess defaults to pass VERSION=v<latest_version> unless explicitly provided.
Changes:
- Add a
script_refoverride to_get_update_installer_url()and use it inself_update()to pin installer downloads tov<latest_version>. - Change
_build_self_update_installer_env()to always defaultVERSIONtov<latest_version>(not prerelease-only). - Add unit tests covering script ref overrides and pinned installer URL behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/apm_cli/commands/self_update.py | Pins installer URL to the release tag ref and changes default installer env to always set VERSION when unset. |
| tests/unit/commands/test_self_update_air_gapped.py | Adds regression tests for the new script-ref override and for tag-pinned installer downloads. |
Comment on lines
156
to
160
| channel = _get_effective_self_update_channel() | ||
| if _ENV_SELF_UPDATE_CHANNEL not in env: | ||
| env[_ENV_SELF_UPDATE_CHANNEL] = channel | ||
| if channel == "prerelease" and _ENV_VERSION not in env: | ||
| if _ENV_VERSION not in env: | ||
| env[_ENV_VERSION] = f"v{latest_version}" |
Comment on lines
271
to
278
| # Download install script to temp file | ||
| try: | ||
| import requests | ||
|
|
||
| try: | ||
| install_script_url = _get_update_installer_url() | ||
| installer_ref = f"v{latest_version}" | ||
| install_script_url = _get_update_installer_url(installer_ref) | ||
| except RuntimeError as e: |
1a52ed6 to
a582830
Compare
a582830 to
50d2b5b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
v<latest_version>) instead of always usingmain.APM_INSTALLER_BASE_URLbehaviour unchanged (enterprise mirror path still uses the provided mirror base).VERSION=v<latest_version>in installer env when not explicitly provided.latest_version.Testing