feat: allow binaryDestination to accept a full path to the CLI binary#879
Open
feat: allow binaryDestination to accept a full path to the CLI binary#879
Conversation
The coder.binaryDestination setting (and CODER_BINARY_DESTINATION env var) now accepts either a file path or a directory path: - File path (e.g. /usr/bin/coder): if the file exists, use it directly. Version is checked and reported. If the version mismatches and downloads are enabled, the binary is re-downloaded to the same path. If downloads are disabled, the existing binary is used as-is with a warning. - Directory path (existing behavior): look for the platform-specific name (e.g. coder-linux-amd64) first, then fall back to the simple name (coder / coder.exe). This supports package-manager-installed CLIs that use the simple name. Adds cliUtils.simpleName() returning "coder" (or "coder.exe" on Windows) and a unified resolveBinaryPath() method in CliManager used by both locateBinary() and fetchBinary(). Resolves #861
Always download to the platform-specific binary name (coder-linux-amd64) for temp files, old backups, signatures, and lock files. After a successful download, rename the result to the user's configured file name while still holding the lock to avoid races with other windows. Scoped rmOld to only clean files prefixed with the binary basename so it does not accidentally remove unrelated files when the target directory is shared (e.g. /usr/bin).
2eb60c3 to
d8f1641
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.
coder.binaryDestinationsetting (andCODER_BINARY_DESTINATIONenv var) now accepts a file path in addition to a directory path.coder-linux-amd64) first, then falls back to the simple name (coder/coder.exe). This supports package-manager-installed CLIs (e.g. viaapt,brew,winget) that use the simple name.cliUtils.simpleName()and a unifiedresolveBinaryPath()method inCliManagerused by bothlocateBinary()andfetchBinary().Resolves #861