artifactsource

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package artifactsource opens and probes agent artifact download sources.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadExpectedSHA256

func ReadExpectedSHA256(ctx context.Context, checksumSource Source) (string, error)

ReadExpectedSHA256 reads a sha256sum-format checksum source and returns the expected hex-encoded SHA256 hash.

Types

type ReachabilityChecker

type ReachabilityChecker struct {
	Log        *slog.Logger
	CheckName  string
	Target     string
	OKMessage  string
	ErrMessage string
	Sources    func() (Sources, error)
}

ReachabilityChecker checks that a set of artifact sources is reachable. Sources must be set. Source names returned by Sources are included in preflight output, so they must be redacted labels rather than raw source strings.

func (ReachabilityChecker) Check

Check probes every configured artifact source and reports failures using only the redacted source names.

func (ReachabilityChecker) Name

func (c ReachabilityChecker) Name() string

Name returns the preflight check name.

type Source

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

Source is a parsed artifact source. It can reference an absolute local path, file:// URL, HTTP(S) URL, or OCI artifact blob using oci://...#title.

func Parse

func Parse(source string) (Source, error)

Parse validates and parses an artifact source string.

func (Source) DecompressTarGz

func (s Source) DecompressTarGz(ctx context.Context) utilio.TarFileSeq

DecompressTarGz returns an iterator that yields files from a gzip-compressed tar artifact source.

func (Source) DownloadToLocalFile

func (s Source) DownloadToLocalFile(ctx context.Context, filename string, perm os.FileMode) error

DownloadToLocalFile downloads the artifact source to filename and sets perm.

func (Source) DownloadWithSHA256Verification

func (s Source) DownloadWithSHA256Verification(ctx context.Context, expectedHash, filename string, perm os.FileMode) error

DownloadWithSHA256Verification downloads the artifact source to filename and verifies the downloaded content against expectedHash.

func (Source) Open

func (s Source) Open(ctx context.Context) (io.ReadCloser, error)

Open opens the artifact source for streaming.

func (Source) Probe

func (s Source) Probe(ctx context.Context) error

Probe checks that the artifact source is reachable without installing it.

func (Source) String

func (s Source) String() string

String returns the original artifact source string.

type Sources

type Sources map[string]Source

Sources maps a redacted source name to a parsed artifact source. Source names are safe to include in preflight output; raw source strings may contain sensitive data and must not be used as map keys.

Jump to

Keyboard shortcuts

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