Skip to content

Commit

Permalink
feat(fvm): override installed binaries target (#4215)
Browse files Browse the repository at this point in the history
* feat(fvm): override installed binaries target

* chore: smoke tests

* chore: provide fvm ci context

* Update fvm_basic.bats

* Update fvm_basic.bats
  • Loading branch information
EstebanBorai authored Oct 19, 2024
1 parent 6bde655 commit 8efca9d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
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
}

0 comments on commit 8efca9d

Please sign in to comment.