Documentation
¶
Overview ¶
Package artifactsource opens and probes agent artifact download sources.
Index ¶
- func ReadExpectedSHA256(ctx context.Context, checksumSource Source) (string, error)
- type ReachabilityChecker
- type Source
- func (s Source) DecompressTarGz(ctx context.Context) utilio.TarFileSeq
- func (s Source) DownloadToLocalFile(ctx context.Context, filename string, perm os.FileMode) error
- func (s Source) DownloadWithSHA256Verification(ctx context.Context, expectedHash, filename string, perm os.FileMode) error
- func (s Source) Open(ctx context.Context) (io.ReadCloser, error)
- func (s Source) Probe(ctx context.Context) error
- func (s Source) String() string
- type Sources
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
func (c ReachabilityChecker) Check(ctx context.Context) []preflight.Result
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 (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 ¶
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.