Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var MustGatherClean = BinarySpec{ Name: "must-gather-clean", Source: &GitHubSource{Owner: "openshift", Repo: "must-gather-clean"}, AssetPattern: "{name}-{os}-{arch}.tar.gz", WindowsAssetPattern: "{name}-{os}-{arch}.exe.zip", ChecksumAsset: "SHA256_SUM", }
MustGatherClean is the BinarySpec for the openshift/must-gather-clean tool.
Functions ¶
func Resolve ¶
Resolve returns the path to the binary. It checks in order: 1. An explicit path provided by the user (verified to exist). 2. The locally cached binary, if its version matches the latest release. 3. The latest release, downloaded and cached when a newer version is available. 4. A previously cached binary as a fallback when the source is unreachable.
cacheDir overrides the default cache directory. If empty, HCPCTL_CACHE_DIR env var is checked, then the OS user cache directory is used.
func ResolveMustGatherClean ¶
func ResolveMustGatherClean(ctx context.Context, explicitPath, version, cacheDir string) (string, error)
ResolveMustGatherClean resolves the path to the must-gather-clean binary. If explicitPath is non-empty, it verifies the file exists and returns it. Otherwise, it downloads the release and caches it locally. version pins to a specific release (empty uses latest). cacheDir overrides the default cache directory (empty uses default).
Types ¶
type BinarySpec ¶
type BinarySpec struct {
Name string // binary name, e.g. "must-gather-clean"
Source Source // where to download from (e.g. GitHubSource)
AssetPattern string // template for non-Windows: "{name}-{os}-{arch}.tar.gz"
WindowsAssetPattern string // template for Windows: "{name}-{os}-{arch}.exe.zip"
ChecksumAsset string // release asset containing SHA256 checksums (e.g. "SHA256_SUM")
PinnedVersion string // pin to a specific version (e.g. "v0.0.3") via --must-gather-clean-version; empty means use latest
}
BinarySpec defines a downloadable binary.
type GitHubSource ¶
type GitHubSource struct {
Owner string // GitHub organization, e.g. "openshift"
Repo string // GitHub repository, e.g. "must-gather-clean"
APIBaseURL string
DownloadBaseURL string
// contains filtered or unexported fields
}
GitHubSource downloads binaries from GitHub releases.
func (*GitHubSource) LatestTagName ¶
func (s *GitHubSource) LatestTagName(ctx context.Context) (string, error)