release

package
v1.16.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package release provides helpers to download and verify binaries released on GitHub.

The downloader knows how to construct a release download URL, fetch the tarball, validate its checksum and extract the contained name to a destination path.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryProvider

type BinaryProvider interface {
	Get(ctx context.Context, version string) (string, error)
}

BinaryProvider is a small abstraction around downloading a specific name for a given version. Implementations should return the path of the downloaded name on success.

type BinaryVersionChecker added in v1.16.3

type BinaryVersionChecker func(ctx context.Context, binary string) error

BinaryVersionChecker is a function that verifies the version of a downloaded binary matches the requested version. It takes a context and the path to the binary as input and returns an error if the version check fails (e.g., version mismatch or command execution error).

type BinaryVersionCheckerFactory added in v1.16.3

type BinaryVersionCheckerFactory func(requestedVersion string, os string, arch string) (BinaryVersionChecker, error)

BinaryVersionCheckerFactory is a factory function that creates a BinaryVersionChecker for a specific requested version and OS/architecture pair. This allows for customizable version checking logic that may vary based on the target platform or version.

func NewStaticCommandVersionCheckerFactory added in v1.16.3

func NewStaticCommandVersionCheckerFactory(args []string, outputParser func(stdout string) (string, error), comparator BinaryVersionComparator) BinaryVersionCheckerFactory

type BinaryVersionComparator added in v1.16.3

type BinaryVersionComparator func(requestedVersion string, actualVersion string) error

BinaryVersionComparator is a function that compares a requested version with the actual version extracted from a binary. It returns an error if the versions do not match according to the comparison logic (e.g., semver equality check).

func NewSemverEqualityComparator added in v1.16.3

func NewSemverEqualityComparator() BinaryVersionComparator

type GithubReleaseBinaryLocator

type GithubReleaseBinaryLocator func(releaseDir string, name string, version string, os string, arch string) (string, error)

func NewDefaultBinaryLocator

func NewDefaultBinaryLocator() GithubReleaseBinaryLocator

func NewOPStackBinaryLocator

func NewOPStackBinaryLocator() GithubReleaseBinaryLocator

type GithubReleaseCachePather

type GithubReleaseCachePather func() (string, error)

func NewHomeDirCachePather

func NewHomeDirCachePather(namespace string) GithubReleaseCachePather

func NewStaticCachePather added in v1.16.3

func NewStaticCachePather(cacheDir string) GithubReleaseCachePather

type GithubReleaseChecksummer

type GithubReleaseChecksummer func(r io.Reader) error

GithubReleaseChecksummer reads the downloaded archive data and validates its checksum. It should return an error if the checksum does not match.

func NewDefaultChecksummer

func NewDefaultChecksummer(expectedChecksum string) GithubReleaseChecksummer

type GithubReleaseChecksummerFactory

type GithubReleaseChecksummerFactory func(os string, arch string) (GithubReleaseChecksummer, error)

GithubReleaseChecksummerFactory returns a GithubReleaseChecksummer for a specific OS/architecture pair. This allows providing precomputed checksums for different release artifacts.

func NewStaticChecksummerFactory

func NewStaticChecksummerFactory(checksums map[string]string) GithubReleaseChecksummerFactory

type GithubReleaseDownloader

type GithubReleaseDownloader struct {
	// contains filtered or unexported fields
}

func NewGithubReleaseDownloader

func NewGithubReleaseDownloader(owner string, repo string, name string, opts ...GithubReleaseDownloaderOption) *GithubReleaseDownloader

func (*GithubReleaseDownloader) Get

func (d *GithubReleaseDownloader) Get(ctx context.Context, version string) (string, error)

type GithubReleaseOSGetter

type GithubReleaseOSGetter func() (string, string, error)

GithubReleaseOSGetter returns the OS and architecture string used to select the appropriate release artifact (e.g. "linux", "amd64"). The function may inspect the runtime or be overridden for testing.

func NewDefaultOSGetter

func NewDefaultOSGetter() GithubReleaseOSGetter

type GithubReleaseURLGetter

type GithubReleaseURLGetter func(owner string, repo string, name string, version string, os string, arch string) (string, error)

GithubReleaseURLGetter constructs the download URL for a given owner/repo and version for the provided os/arch pair.

func NewDefaultURLGetter

func NewDefaultURLGetter() GithubReleaseURLGetter

func NewOPStackURLGetter

func NewOPStackURLGetter() GithubReleaseURLGetter

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL