fetcher

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: MPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrGhAssetNotFound = errors.New("github asset not found")
View Source
var ErrVersionsNotSupported = errors.New("fetcher does not support listing versions")

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	Fetch  Fetch  `yaml:"fetch"`
	Verify Verify `yaml:"verify"`
}

type ArtifactKind added in v0.3.0

type ArtifactKind int
const (
	ArchiveKind ArtifactKind = iota
	SourceKind
)

type Fetch added in v0.7.0

type Fetch struct {
	GitHubRelease *GitHubRelease `yaml:"github_release,omitempty"`
	GitHubTag     *GitHubTag     `yaml:"github_tag,omitempty"`
	HTTP          *HTTP          `yaml:"http,omitempty"`
	OCI           *OCI           `yaml:"oci,omitempty"`
}

func (Fetch) Validate added in v0.7.0

func (f Fetch) Validate() error

type Fetcher

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

func NewFetcher added in v0.7.0

func NewFetcher(resolver auth.Resolver, opts ...FetcherOption) *Fetcher

func (*Fetcher) FetchArtifact added in v0.7.0

func (ft *Fetcher) FetchArtifact(ctx context.Context, artifact *Artifact, kind ArtifactKind, version string, platform Platform) (io.ReadCloser, int64, error)

func (*Fetcher) ListVersions added in v0.7.0

func (ft *Fetcher) ListVersions(ctx context.Context, f Fetch) ([]string, error)

type FetcherOption added in v0.7.0

type FetcherOption func(*Fetcher)

func WithOCIClient added in v0.3.0

func WithOCIClient(c oci.Client) FetcherOption

WithOCIClient overrides the OCI client, e.g. to inject a fake in tests.

type GitHubRelease added in v0.7.0

type GitHubRelease struct {
	Repo              string            `yaml:"repo"`
	AssetName         string            `yaml:"assetName"`
	TemplateOverrides map[string]string `yaml:"templateOverrides,omitempty"`
	ReleaseFilter     string            `yaml:"releaseFilter,omitempty"`
	VersionTemplate   string            `yaml:"versionTemplate,omitempty"`
	ReleaseTemplate   string            `yaml:"releaseTemplate,omitempty"`
}

type GitHubReleaseVersionSource

type GitHubReleaseVersionSource struct {
	Repo            string `yaml:"repo"`
	ReleaseFilter   string `yaml:"releaseFilter,omitempty"`
	VersionTemplate string `yaml:"versionTemplate,omitempty"`
}

type GitHubTag added in v0.7.0

type GitHubTag struct {
	Repo            string `yaml:"repo"`
	TagTemplate     string `yaml:"tagTemplate,omitempty"`
	TagFilter       string `yaml:"tagFilter,omitempty"`
	VersionTemplate string `yaml:"versionTemplate,omitempty"`
}

func (*GitHubTag) RenderTag added in v0.7.0

func (f *GitHubTag) RenderTag(version string) (string, error)

type GitHubTagVersionSource

type GitHubTagVersionSource struct {
	Repo            string `yaml:"repo"`
	TagFilter       string `yaml:"tagFilter,omitempty"`
	VersionTemplate string `yaml:"versionTemplate,omitempty"`
}

type HTTP added in v0.7.0

type HTTP struct {
	URL               string            `yaml:"url"`
	TemplateOverrides map[string]string `yaml:"templateOverrides,omitempty"`
	VersionsFrom      *VersionsFrom     `yaml:"versionsFrom,omitempty"`
}

type OCI added in v0.7.0

type OCI struct {
	Ref               string            `yaml:"ref,omitempty"`
	TemplateOverrides map[string]string `yaml:"templateOverrides,omitempty"`
}

type Platform

type Platform struct {
	OS   string
	Arch string
}

func CurrentPlatform

func CurrentPlatform() Platform

type Verify

type Verify struct {
	Algorithm           string `yaml:"algorithm,omitempty"`
	Checksum            string `yaml:"checksum,omitempty"`
	ChecksumURL         string `yaml:"checksumURL,omitempty"`
	ChecksumGitHubAsset string `yaml:"checksumGitHubAsset,omitempty"`

	// Legacy sha256* aliases imply algorithm sha256; kept so existing
	// manifests keep working unchanged.
	SHA256            string `yaml:"sha256,omitempty"`
	SHA256URL         string `yaml:"sha256URL,omitempty"`
	SHA256GitHubAsset string `yaml:"sha256GitHubAsset,omitempty"`
}

func (Verify) HasChecksumSource added in v0.7.0

func (v Verify) HasChecksumSource() bool

func (Verify) UsesGitHubAsset added in v0.7.0

func (v Verify) UsesGitHubAsset() bool

func (Verify) Validate

func (v Verify) Validate() error

type VersionsFrom

type VersionsFrom struct {
	GitHubRelease *GitHubReleaseVersionSource `yaml:"github_release,omitempty"`
	GitHubTag     *GitHubTagVersionSource     `yaml:"github_tag,omitempty"`
}

func (VersionsFrom) Validate

func (v VersionsFrom) Validate() error

Jump to

Keyboard shortcuts

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