Skip to content
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
31 changes: 30 additions & 1 deletion registry/oc.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
backends = ["conda:openshift-cli", "asdf:mise-plugins/mise-oc"]
description = "OpenShift Client CLI (oc)"
os = ["linux", "macos", "windows"]
test = { cmd = "oc version --client", expected = "{{version}}" }

[[backends]]
full = "http:oc"

[backends.options]
bin = "oc"
version_list_url = "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/"
version_regex = 'href="(\d+\.\d+\.\d+)/"'

[backends.options.platforms.linux-x64]
url = "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/{{ version }}/openshift-client-linux-{{ version }}.tar.gz"

[backends.options.platforms.linux-arm64]
url = "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/{{ version }}/openshift-client-linux-arm64-{{ version }}.tar.gz"

[backends.options.platforms.macos-x64]
url = "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/{{ version }}/openshift-client-mac-{{ version }}.tar.gz"

[backends.options.platforms.macos-arm64]
url = "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/{{ version }}/openshift-client-mac-arm64-{{ version }}.tar.gz"

[backends.options.platforms.windows-x64]
url = "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/{{ version }}/openshift-client-windows-{{ version }}.zip"

[[backends]]
full = "conda:openshift-cli"

[[backends]]
full = "asdf:mise-plugins/mise-oc"
23 changes: 23 additions & 0 deletions registry/openshift-install.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
description = "OpenShift installer for deploying OpenShift clusters"
os = ["linux", "macos"]
test = { cmd = "openshift-install version", expected = "{{version}}" }

[[backends]]
full = "http:openshift-install"

[backends.options]
bin = "openshift-install"
version_list_url = "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/"
version_regex = 'href="(\d+\.\d+\.\d+)/"'

[backends.options.platforms.linux-x64]
url = "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/{{ version }}/openshift-install-linux-{{ version }}.tar.gz"

[backends.options.platforms.linux-arm64]
url = "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/{{ version }}/openshift-install-linux-arm64-{{ version }}.tar.gz"

[backends.options.platforms.macos-x64]
url = "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/{{ version }}/openshift-install-mac-{{ version }}.tar.gz"

[backends.options.platforms.macos-arm64]
url = "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/{{ version }}/openshift-install-mac-arm64-{{ version }}.tar.gz"
Comment thread
konono marked this conversation as resolved.
23 changes: 17 additions & 6 deletions src/backend/version_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,16 @@ pub async fn fetch_versions(
) -> Result<Vec<String>> {
use crate::http::HTTP;

// Fetch the content
let response = HTTP.get_text(version_list_url).await?;
let content = response.trim();
let content = if version_regex.is_some() {
// When a regex is provided, the caller expects to parse arbitrary
// content (including HTML directory listings), so bypass the HTML rejection
// in get_text.
let resp = HTTP.get_async(version_list_url).await?;
resp.text().await?
} else {
HTTP.get_text(version_list_url).await?
};
Comment thread
greptile-apps[bot] marked this conversation as resolved.
let content = content.trim();

// Parse versions based on format
parse_version_list(content, version_regex, version_json_path, version_expr)
Expand Down Expand Up @@ -88,9 +95,13 @@ pub fn parse_version_list(
}
}

// If no versions extracted yet, treat as line-separated or single version
// This provides fallback for all cases including failed JSON parsing
if versions.is_empty() {
// If no versions extracted yet and no explicit extraction method was provided,
// treat as line-separated or single version.
// When version_regex or version_expr is set, zero matches means the content
// didn't contain the expected data — don't fall through to line-splitting
// which would emit garbage (e.g. raw HTML lines as "versions").
let explicit_method = version_regex.is_some() || version_expr.is_some();
if versions.is_empty() && !explicit_method {
for line in trimmed.lines() {
let line = line.trim();
// Skip empty lines and comments
Expand Down
Loading