sources

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: EUPL-1.2 Imports: 9 Imported by: 0

Documentation

Overview

Package sources provides image download sources for core-devops.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CDNSource

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

CDNSource downloads images from a CDN or S3 bucket.

func NewCDNSource

func NewCDNSource(cfg SourceConfig) *CDNSource

NewCDNSource creates a new CDN source.

func (*CDNSource) Available

func (s *CDNSource) Available() bool

Available checks if CDN URL is configured.

func (*CDNSource) Download

func (s *CDNSource) Download(ctx context.Context, dest string, progress func(downloaded, total int64)) error

Download downloads the image from CDN.

func (*CDNSource) LatestVersion

func (s *CDNSource) LatestVersion(ctx context.Context) (string, error)

LatestVersion fetches version from manifest or returns "latest".

func (*CDNSource) Name

func (s *CDNSource) Name() string

Name returns "cdn".

type GitHubSource

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

GitHubSource downloads images from GitHub Releases.

func NewGitHubSource

func NewGitHubSource(cfg SourceConfig) *GitHubSource

NewGitHubSource creates a new GitHub source.

func (*GitHubSource) Available

func (s *GitHubSource) Available() bool

Available checks if gh CLI is installed and authenticated.

func (*GitHubSource) Download

func (s *GitHubSource) Download(ctx context.Context, dest string, progress func(downloaded, total int64)) error

Download downloads the image from the latest release.

func (*GitHubSource) LatestVersion

func (s *GitHubSource) LatestVersion(ctx context.Context) (string, error)

LatestVersion returns the latest release tag.

func (*GitHubSource) Name

func (s *GitHubSource) Name() string

Name returns "github".

type ImageSource

type ImageSource interface {
	// Name returns the source identifier.
	Name() string
	// Available checks if this source can be used.
	Available() bool
	// LatestVersion returns the latest available version.
	LatestVersion(ctx context.Context) (string, error)
	// Download downloads the image to the destination path.
	// Reports progress via the callback if provided.
	Download(ctx context.Context, dest string, progress func(downloaded, total int64)) error
}

ImageSource defines the interface for downloading dev images.

type SourceConfig

type SourceConfig struct {
	// GitHub configuration
	GitHubRepo string
	// Registry configuration
	RegistryImage string
	// CDN configuration
	CDNURL string
	// Image name (e.g., core-devops-darwin-arm64.qcow2)
	ImageName string
}

SourceConfig holds configuration for a source.

Jump to

Keyboard shortcuts

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