Documentation
¶
Overview ¶
Package cli provides a unified command-line interface for the runtime download system. It supports YAML configuration files and integrates with all runtime providers.
Package cli provides command-line interface components with testable abstractions.
Package cli provides the command-line interface for the runtime download system.
Package cli provides release functionality integrated with the download command.
Index ¶
- Variables
- func BuildPromotionUploader(configPath, token string, manifest PackageManifest) (promotion.ReleaseAssetUploader, error)
- func NewApp() *cli.App
- func NewAuditLogger() (*slog.Logger, func(), error)
- func NewLoggers(level slog.Level) (*slog.Logger, *slog.Logger)
- func NewLoggersWithOutputFormat(level slog.Level, outputFormat string) (*slog.Logger, *slog.Logger)
- func ParseLogLevelOrDefault(levelStr string) slog.Level
- func PromoteTestedPackagesFromFiles(db promotion.Store, manifestPath string, testResultsPath string) (promotion.Summary, error)
- func PromoteTestedPackagesFromFilesWithUploader(db promotion.Store, manifestPath string, testResultsPath string, ...) (promotion.Summary, error)
- func ReadPackageTestResultsFile(path string) (promotion.TestResultsFile, error)
- func UploadPromotionEvidenceFiles(uploader promotion.ReleaseAssetUploader, ...) error
- func WritePackageManifest(path string, manifest PackageManifest) error
- type DatabaseStore
- type DownloadResult
- type DownloadSummary
- type GitHubReleaser
- type LoggerConfig
- type PackageManifest
- type PackageManifestEntry
- type PackageManifestStatus
- type PackagingResolveOptions
- type PackagingResolveResult
- type PackagingResolveSkip
- type PackagingResolveSkipReason
- type PackagingResolveTarget
- type ReleaseManager
- type RuntimeManager
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func BuildPromotionUploader ¶
func BuildPromotionUploader(configPath, token string, manifest PackageManifest) (promotion.ReleaseAssetUploader, error)
func NewAuditLogger ¶
NewAuditLogger creates a dedicated logger for verification audit trails. Returns the logger, cleanup function, and error. NOTE: Audit logging configuration was removed, this function is deprecated
func NewLoggers ¶
NewLoggers creates default loggers with JSON output.
func NewLoggersWithOutputFormat ¶
NewLoggersWithOutputFormat creates loggers with awareness of output format. All logs are sent to stderr to keep stdout clean for JSON output. The outputFormat parameter is kept for backward compatibility but all output will be JSON formatted.
func ParseLogLevelOrDefault ¶
ParseLogLevelOrDefault parses a log level string or returns a default level.
func PromoteTestedPackagesFromFiles ¶
func PromoteTestedPackagesFromFiles( db promotion.Store, manifestPath string, testResultsPath string, ) (promotion.Summary, error)
PromoteTestedPackagesFromFiles promotes tested package entries from files.
It reads a manifest + test-result file, validates all entries up front, then updates release artifacts and package records only if all entries are eligible.
func PromoteTestedPackagesFromFilesWithUploader ¶
func PromoteTestedPackagesFromFilesWithUploader( db promotion.Store, manifestPath string, testResultsPath string, uploader promotion.ReleaseAssetUploader, ) (promotion.Summary, error)
PromoteTestedPackagesFromFilesWithUploader promotes tested package entries and optionally uploads package assets to releases when URLs are missing.
func ReadPackageTestResultsFile ¶
func ReadPackageTestResultsFile(path string) (promotion.TestResultsFile, error)
ReadPackageTestResultsFile reads package test results JSON from disk.
func WritePackageManifest ¶
func WritePackageManifest(path string, manifest PackageManifest) error
WritePackageManifest writes a manifest as formatted JSON and ensures parent directories exist for predictable CI/local behavior.
Types ¶
type DatabaseStore ¶
type DatabaseStore interface {
// CreateRelease inserts a new release record into the database.
CreateRelease(release *storage.Release) error
// GetRelease retrieves a release by runtime name and version.
GetRelease(runtime, version string) (*storage.Release, error)
// ListByVersion returns all downloads for a specific runtime and version.
ListByVersion(runtime, version string) ([]*storage.Download, error)
// Close closes the database connection.
Close() error
}
DatabaseStore abstracts database operations for testing.
type DownloadResult ¶
type DownloadResult struct {
Runtime string `json:"runtime"`
Version string `json:"version"`
Platform string `json:"platform"`
URL string `json:"url"`
LocalPath string `json:"local_path"`
FileSize int64 `json:"file_size"`
Success bool `json:"success"`
Error string `json:"error,omitempty"`
DurationMs int64 `json:"duration_ms"`
}
DownloadResult represents a download operation result for JSON output
type DownloadSummary ¶
type DownloadSummary struct {
Runtime string `json:"runtime"`
Version string `json:"version"`
TotalFiles int `json:"total_files"`
Successful int `json:"successful"`
Failed int `json:"failed"`
OutputDir string `json:"output_dir"`
Results []DownloadResult `json:"results"`
}
DownloadSummary represents the summary of download operations for JSON output
type GitHubReleaser ¶
type GitHubReleaser interface {
// CreateRelease creates a new GitHub release with the given parameters.
CreateRelease(tag, name, body string, draft bool) (*github.RepositoryRelease, error)
// UploadAsset uploads a file to an existing GitHub release.
UploadAsset(releaseID int64, filePath string) (*github.ReleaseAsset, error)
// GetAssetDownloadURL returns the public download URL for a release asset.
GetAssetDownloadURL(asset *github.ReleaseAsset) string
// GetReleaseURL returns the HTML URL for a GitHub release.
GetReleaseURL(release *github.RepositoryRelease) string
}
GitHubReleaser abstracts GitHub release operations for testing. Following Dave Cheney's principle: "Accept interfaces, return structs"
type LoggerConfig ¶
LoggerConfig contains configuration for setting up loggers.
type PackageManifest ¶
type PackageManifest struct {
RunID string `json:"run_id"`
Stage string `json:"stage"`
GeneratedAt time.Time `json:"generated_at"`
Targets []PackageManifestEntry `json:"targets"`
Skipped []PackagingResolveSkip `json:"skipped"`
}
PackageManifest captures package orchestration state for a run. In Phase 1 this is emitted at the "resolved" stage and becomes the handoff contract for subsequent build/test/promotion phases.
func NewResolvedPackageManifest ¶
func NewResolvedPackageManifest(runID string, result PackagingResolveResult) PackageManifest
NewResolvedPackageManifest converts resolver output into a stage-scoped manifest.
func ReadPackageManifest ¶
func ReadPackageManifest(path string) (PackageManifest, error)
ReadPackageManifest reads a package manifest JSON from disk.
type PackageManifestEntry ¶
type PackageManifestEntry struct {
Runtime string `json:"runtime"`
Version string `json:"version"`
Target string `json:"target"`
InputMode string `json:"input_mode"`
InputPlatform string `json:"input_platform"`
InputArch string `json:"input_arch"`
InputPath string `json:"input_path"`
InputSHA256 string `json:"input_sha256"`
InputRunID string `json:"input_run_id,omitempty"`
PackageName string `json:"package_name"`
InstallPrefix string `json:"install_prefix"`
Status PackageManifestStatus `json:"status"`
}
PackageManifestEntry represents one packaging unit of work for a runtime/version/target. Status fields are placeholders for upcoming phases.
type PackageManifestStatus ¶
type PackageManifestStatus struct {
Resolved bool `json:"resolved"`
Built bool `json:"built"`
Tested bool `json:"tested"`
Promoted bool `json:"promoted"`
}
PackageManifestStatus tracks state transitions for one target.
type PackagingResolveOptions ¶
type PackagingResolveOptions struct {
// RunID limits results to downloads from a specific run.
RunID string
}
type PackagingResolveResult ¶
type PackagingResolveResult struct {
Targets []PackagingResolveTarget `json:"targets"`
Skipped []PackagingResolveSkip `json:"skipped"`
}
func ResolvePackagingTargets ¶
func ResolvePackagingTargets(cfg *config.Config, db packagingDownloadsStore, opts PackagingResolveOptions) (PackagingResolveResult, error)
ResolvePackagingTargets converts current-run download records into package build targets.
Bigger picture: - Download stage writes verified artifacts into downloads.db with a run_id. - Resolver stage reads only that run_id and prepares package work items. - Build/test/promotion stages consume these targets without re-discovering inputs.
type PackagingResolveSkip ¶
type PackagingResolveSkip struct {
Runtime string `json:"runtime"`
Reason PackagingResolveSkipReason `json:"reason"`
Detail string `json:"detail,omitempty"`
}
type PackagingResolveSkipReason ¶
type PackagingResolveSkipReason string
const ( ResolveSkipPackagingDisabled PackagingResolveSkipReason = "packaging_disabled" ResolveSkipTargetNotEnabled PackagingResolveSkipReason = "target_not_enabled" ResolveSkipNoVerifiedInput PackagingResolveSkipReason = "no_verified_download" )
type PackagingResolveTarget ¶
type PackagingResolveTarget struct {
Runtime string `json:"runtime"`
Version string `json:"version"`
Target packaging.PackageType `json:"target"`
InputMode packaging.InputMode `json:"input_mode"`
InputPlatform string `json:"input_platform"`
InputArch string `json:"input_arch"`
InputPath string `json:"input_path"`
InputSHA256 string `json:"input_sha256"`
InputRunID string `json:"input_run_id,omitempty"`
PackageName string `json:"package_name"`
InstallPrefix string `json:"install_prefix"`
}
type ReleaseManager ¶
type ReleaseManager struct {
// contains filtered or unexported fields
}
ReleaseManager handles the GitHub release process after successful downloads. It accepts interfaces for testability (Dave Cheney's "accept interfaces, return structs").
func NewReleaseManager ¶
func NewReleaseManager(cfg *config.ReleaseConfig, github GitHubReleaser, db DatabaseStore, stdout, stderr *slog.Logger) (*ReleaseManager, error)
NewReleaseManager creates a new release manager with the provided dependencies. Returns nil if auto_release is disabled in the configuration. GitHub client and database are passed as interfaces for testability.
func (*ReleaseManager) CreateAggregatedRelease ¶
func (rm *ReleaseManager) CreateAggregatedRelease( runtimeName string, versions []string, downloadResults []runtime.DownloadResult, outputDir string, releaseConfig *config.ReleaseConfig, ) (*storage.Release, error)
CreateAggregatedRelease creates a single GitHub release with artifacts from multiple versions. This is called after successful downloads for multiple runtime versions.
type RuntimeManager ¶
type RuntimeManager interface {
// GetProvider returns the runtime provider for the given runtime name.
GetProvider(name string) (runtime.RuntimeProvider, error)
// DownloadRuntime downloads runtime binaries for the specified platforms.
DownloadRuntime(
ctx context.Context,
runtimeName string,
version endoflife.VersionInfo,
platforms []platform.Platform,
outputDir string,
concurrency int,
) ([]runtime.DownloadResult, error)
}
RuntimeManager abstracts runtime download operations for testing. This interface mirrors the key methods from runtime.Manager that the CLI needs.