Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(fvm): override installed binaries target #4215

Merged
merged 5 commits into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion crates/fluvio-version-manager/src/command/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ use crate::common::workdir::fvm_versions_path;
/// The `install` command is responsible of installing the desired Package Set
#[derive(Debug, Parser)]
pub struct InstallOpt {
/// Binaries architecture triple to use
#[arg(long, env = "FVM_BINARY_ARCH_TRIPLE", default_value = TARGET)]
target: String,
/// Registry used to fetch Fluvio Versions
#[arg(long, env = "INFINYON_HUB_REMOTE", default_value = HUB_REMOTE)]
registry: Url,
Expand All @@ -38,7 +41,9 @@ impl InstallOpt {
}

let client = Client::new(self.registry.as_str())?;
let pkgset = client.fetch_package_set(&self.version, TARGET).await?;
let pkgset = client
.fetch_package_set(&self.version, &self.target)
.await?;

VersionInstaller::new(self.version.to_owned(), pkgset, notify)
.install()
Expand Down
23 changes: 23 additions & 0 deletions tests/cli/fvm_smoke_tests/fvm_basic.bats
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ setup_file() {
export INFINYON_HUB_REMOTE
debug_msg "Using Hub Registry URL: $INFINYON_HUB_REMOTE"

export INFINYON_CI_CONTEXT="ci"

# Retrieves the latest stable version from the GitHub API and removes the
# `v` prefix from the tag name.
STABLE_VERSION=$(curl "https://api.github.com/repos/infinyon/fluvio/releases/latest" | jq -r .tag_name | cut -c2-)
Expand Down Expand Up @@ -1012,3 +1014,24 @@ setup_file() {
rm -rf $FLUVIO_HOME_DIR
assert_success
}

@test "Supports Binary Target Overriding" {
run bash -c '$FVM_BIN self install'
assert_success

# Sets `fvm` in the PATH using the "env" file included in the installation
source ~/.fvm/env

# Attempts to install unsupported target triple
run bash -c '$FVM_BIN install 0.11.12 --target aarch64-unknown-linux-gnu'
assert_line --index 0 "Error: PackageSet \"0.11.12\" is not available for architecture: \"aarch64-unknown-linux-gnu\""
assert_failure

# Removes FVM
run bash -c '$FVM_BIN self uninstall --yes'
assert_success

# Removes Fluvio
rm -rf $FLUVIO_HOME_DIR
assert_success
}
Loading