Skip to content

Commit

Permalink
fix: aqua:apache/spark doesn't work (#3995)
Browse files Browse the repository at this point in the history
* fix: aqua:apache/spark doesn't work

* [autofix.ci] apply automated fixes

* Update registry.toml

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: jdx <[email protected]>
  • Loading branch information
3 people authored Jan 8, 2025
1 parent 2349d15 commit 5ca6035
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/registry.md
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ You can also specify the full name for a tool using `mise use aqua:1password/cli
| sourcery | [asdf:mise-plugins/mise-sourcery](https://github.com/mise-plugins/mise-sourcery) |
| spacectl | [aqua:spacelift-io/spacectl](https://github.com/spacelift-io/spacectl) [asdf:bodgit/asdf-spacectl](https://github.com/bodgit/asdf-spacectl) |
| spago | [ubi:purescript/spago](https://github.com/purescript/spago) [asdf:jrrom/asdf-spago](https://github.com/jrrom/asdf-spago) |
| spark | [asdf:mise-plugins/mise-spark](https://github.com/mise-plugins/mise-spark) |
| spark | [aqua:apache/spark](https://github.com/apache/spark) [asdf:mise-plugins/mise-spark](https://github.com/mise-plugins/mise-spark) |
| spectral | [aqua:stoplightio/spectral](https://github.com/stoplightio/spectral) [asdf:vbyrd/asdf-spectral](https://github.com/vbyrd/asdf-spectral) |
| spin | [aqua:spinnaker/spin](https://github.com/spinnaker/spin) [asdf:pavloos/asdf-spin](https://github.com/pavloos/asdf-spin) |
| spring-boot | [asdf:mise-plugins/mise-spring-boot](https://github.com/mise-plugins/mise-spring-boot) |
Expand Down
4 changes: 3 additions & 1 deletion registry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1551,7 +1551,9 @@ soracom.backends = ["ubi:soracom/soracom-cli", "asdf:gr1m0h/asdf-soracom"]
sourcery.backends = ["asdf:mise-plugins/mise-sourcery"]
spacectl.backends = ["aqua:spacelift-io/spacectl", "asdf:bodgit/asdf-spacectl"]
spago.backends = ["ubi:purescript/spago", "asdf:jrrom/asdf-spago"]
spark.backends = ["asdf:mise-plugins/mise-spark"]
spark.backends = ["aqua:apache/spark", "asdf:mise-plugins/mise-spark"]
spark.depends = ["java"]
spark.test = ["spark-shell --version 2>&1", "version {{version}}"]
spectral.backends = ["aqua:stoplightio/spectral", "asdf:vbyrd/asdf-spectral"]
spin.backends = ["aqua:spinnaker/spin", "asdf:pavloos/asdf-spin"]
spring-boot.backends = ["asdf:mise-plugins/mise-spring-boot"]
Expand Down
2 changes: 1 addition & 1 deletion src/aqua/aqua_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ impl AquaFile {
}

fn apply_override(mut orig: AquaPackage, avo: &AquaPackage) -> AquaPackage {
if orig.r#type != avo.r#type {
if avo.r#type != AquaPackageType::GithubRelease {
orig.r#type = avo.r#type.clone();
}
if !avo.repo_owner.is_empty() {
Expand Down
24 changes: 16 additions & 8 deletions src/backend/aqua.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,7 @@ impl Backend for AquaBackend {
fn _list_remote_versions(&self) -> Result<Vec<String>> {
let pkg = AQUA_REGISTRY.package(&self.id)?;
if !pkg.repo_owner.is_empty() && !pkg.repo_name.is_empty() {
let versions = if let Some("github_tag") = pkg.version_source.as_deref() {
github::list_tags(&format!("{}/{}", pkg.repo_owner, pkg.repo_name))?
} else {
github::list_releases(&format!("{}/{}", pkg.repo_owner, pkg.repo_name))?
.into_iter()
.map(|r| r.tag_name)
.collect_vec()
};
let versions = get_versions(&pkg)?;
Ok(versions
.into_iter()
.filter_map(|v| {
Expand Down Expand Up @@ -581,6 +574,21 @@ impl AquaBackend {
}
}

fn get_versions(pkg: &AquaPackage) -> Result<Vec<String>> {
if let Some("github_tag") = pkg.version_source.as_deref() {
let versions = github::list_tags(&format!("{}/{}", pkg.repo_owner, pkg.repo_name))?;
return Ok(versions);
}
let mut versions = github::list_releases(&format!("{}/{}", pkg.repo_owner, pkg.repo_name))?
.into_iter()
.map(|r| r.tag_name)
.collect_vec();
if versions.is_empty() {
versions = github::list_tags(&format!("{}/{}", pkg.repo_owner, pkg.repo_name))?;
}
Ok(versions)
}

fn validate(pkg: &AquaPackage) -> Result<()> {
let envs: HashSet<&str> = pkg.supported_envs.iter().map(|s| s.as_str()).collect();
let os = os();
Expand Down

0 comments on commit 5ca6035

Please sign in to comment.