Documentation
¶
Index ¶
Constants ¶
const (
// ClientMirrorBase is the base URL for OCP client binary downloads.
ClientMirrorBase = "https://mirror.openshift.com/pub/openshift-v4/clients/ocp"
)
Variables ¶
This section is empty.
Functions ¶
func ParseChecksumFile ¶
ParseChecksumFile parses a sha256sum.txt into a map of filename → hash. Format: each line is "{hash} {filename}" (two spaces between hash and name).
func SortVersions ¶
func SortVersions(versions []string)
SortVersions sorts a slice of semver strings in ascending order using numeric comparison (4.9.1 < 4.10.0 < 4.21.3).
Types ¶
type ClientArtifact ¶
type ClientArtifact struct {
Name string `json:"name"` // e.g. "openshift-client-linux-4.17.0.tar.gz"
URL string `json:"url"`
OS string `json:"os"` // "linux", "mac", "windows"
Arch string `json:"arch"` // "amd64", "arm64", "ppc64le", "s390x"
Type string `json:"type"` // "client", "installer", "ccoctl", "opm", "oc-mirror", "other"
Checksum string `json:"checksum"` // SHA256 hex from sha256sum.txt
}
ClientArtifact represents a downloadable OCP client binary.
func FilterArtifactsByPlatform ¶
func FilterArtifactsByPlatform(artifacts []ClientArtifact, platforms []string) []ClientArtifact
FilterArtifactsByPlatform filters artifacts by the given platform list. Platform format: "linux", "linux-arm64", "mac", "mac-arm64", "windows". If platforms is empty, returns all artifacts.
type ClientService ¶
type ClientService struct {
// contains filtered or unexported fields
}
ClientService discovers OCP tracks, releases, and constructs download URLs.
func NewClientService ¶
func NewClientService(logger *slog.Logger) *ClientService
NewClientService creates a new OCP client discovery service.
func (*ClientService) FetchManifest ¶
func (s *ClientService) FetchManifest(ctx context.Context, version string) (*ManifestResult, error)
FetchManifest downloads and parses the sha256sum.txt for a given version, returning all artifacts with their checksums. This is the source of truth for what files are available and their expected hashes.
func (*ClientService) FetchReleases ¶
func (s *ClientService) FetchReleases(ctx context.Context, channel string) (*ReleasesResult, error)
FetchReleases queries the graph API for a specific channel and returns the available patch versions sorted by semver.
func (*ClientService) FetchTracks ¶
func (s *ClientService) FetchTracks(ctx context.Context) (*TracksResult, error)
FetchTracks downloads the graph-data tarball and extracts channel names. Results are cached for 12 hours.
type ManifestResult ¶
type ManifestResult struct {
Version string `json:"version"`
Checksums map[string]string `json:"checksums"` // filename → sha256
Artifacts []ClientArtifact `json:"artifacts"`
}
ManifestResult holds the parsed sha256sum.txt for a version.
type ReleasesResult ¶
type ReleasesResult struct {
Channel string `json:"channel"`
Releases []string `json:"releases"` // semver sorted ascending
Latest string `json:"latest"`
Previous string `json:"previous,omitempty"`
}
ReleasesResult contains the available patch versions for a channel.
type TrackGroup ¶
type TrackGroup struct {
Type string `json:"type"` // "stable", "fast", "eus", "candidate"
Channels []string `json:"channels"` // sorted by minor version descending
}
TrackGroup is a set of channels sharing the same type prefix.
type TracksResult ¶
type TracksResult struct {
Groups []TrackGroup `json:"groups"`
}
TracksResult contains all discovered OCP channels grouped by track type.