cli

package
v1.13.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2025 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultArch = "x86_64"

Variables

View Source
var HandledError = errors.New("handled error")

Functions

func Map

func Map[T any, R any](input []T, transformer func(T) R) []R

func PickLatestMajorVersion

func PickLatestMajorVersion(versions api.PackageVersionsResult, rwxPackage string, _ string) (string, error)

func PickLatestMinorVersion

func PickLatestMinorVersion(versions api.PackageVersionsResult, rwxPackage string, major string) (string, error)

Types

type APIClient

type APIClient interface {
	GetDebugConnectionInfo(debugKey string) (api.DebugConnectionInfo, error)
	GetDispatch(api.GetDispatchConfig) (*api.GetDispatchResult, error)
	InitiateRun(api.InitiateRunConfig) (*api.InitiateRunResult, error)
	InitiateDispatch(api.InitiateDispatchConfig) (*api.InitiateDispatchResult, error)
	ObtainAuthCode(api.ObtainAuthCodeConfig) (*api.ObtainAuthCodeResult, error)
	AcquireToken(tokenUrl string) (*api.AcquireTokenResult, error)
	Lint(api.LintConfig) (*api.LintResult, error)
	Whoami() (*api.WhoamiResult, error)
	SetSecretsInVault(api.SetSecretsInVaultConfig) (*api.SetSecretsInVaultResult, error)
	GetPackageVersions() (*api.PackageVersionsResult, error)
	ResolveBaseLayer(api.ResolveBaseLayerConfig) (api.ResolveBaseLayerResult, error)
	StartImagePush(cfg api.StartImagePushConfig) (api.StartImagePushResult, error)
	ImagePushStatus(pushID string) (api.ImagePushStatusResult, error)
}

type BaseLayerRunFile

type BaseLayerRunFile struct {
	Spec         BaseLayerSpec
	OriginalBase BaseLayerSpec
	ResolvedBase BaseLayerSpec
	OriginalPath string
	Error        error
}

func (BaseLayerRunFile) HasChanges

func (rf BaseLayerRunFile) HasChanges() bool

type BaseLayerSpec

type BaseLayerSpec struct {
	Os   string `yaml:"os"`
	Tag  string `yaml:"tag"`
	Arch string `yaml:"arch"`
}

func (BaseLayerSpec) Equal

func (b BaseLayerSpec) Equal(other BaseLayerSpec) bool

func (BaseLayerSpec) Merge

func (b BaseLayerSpec) Merge(other BaseLayerSpec) BaseLayerSpec

func (BaseLayerSpec) TagVersion

func (b BaseLayerSpec) TagVersion() *semver.Version

type Config

type Config struct {
	APIClient   APIClient
	SSHClient   SSHClient
	GitClient   GitClient
	Stdout      io.Writer
	StdoutIsTTY bool
	Stderr      io.Writer
	StderrIsTTY bool
}

func (Config) Validate

func (c Config) Validate() error

type DebugTaskConfig

type DebugTaskConfig struct {
	DebugKey string
}

func (DebugTaskConfig) Validate

func (c DebugTaskConfig) Validate() error

type GetDispatchConfig

type GetDispatchConfig struct {
	DispatchId string
}

type GetDispatchRun

type GetDispatchRun struct {
	RunId  string
	RunUrl string
}

type GitClient added in v1.13.0

type GitClient interface {
	GetBranch() string
	GetCommit() string
	GetOriginUrl() string
	GeneratePatchFile(destDir string) git.PatchFile
}

type InitiateDispatchConfig

type InitiateDispatchConfig struct {
	DispatchKey string
	Params      map[string]string
	Ref         string
	Json        bool
	Title       string
}

func (InitiateDispatchConfig) Validate

func (c InitiateDispatchConfig) Validate() error

type InitiateRunConfig

type InitiateRunConfig struct {
	InitParameters map[string]string
	Json           bool
	RwxDirectory   string
	MintFilePath   string
	NoCache        bool
	TargetedTasks  []string
	Title          string
	GitBranch      string
	GitSha         string
}

func (InitiateRunConfig) Validate

func (c InitiateRunConfig) Validate() error

type LintConfig

type LintConfig struct {
	RwxDirectory string
	OutputFormat LintOutputFormat
}

func NewLintConfig

func NewLintConfig(rwxDir string, formatString string) (LintConfig, error)

func (LintConfig) Validate

func (c LintConfig) Validate() error

type LintOutputFormat

type LintOutputFormat int
const (
	LintOutputNone LintOutputFormat = iota
	LintOutputOneLine
	LintOutputMultiLine
)

type LoginConfig

type LoginConfig struct {
	DeviceName         string
	AccessTokenBackend accesstoken.Backend
	OpenUrl            func(url string) error
	PollInterval       time.Duration
}

func (LoginConfig) Validate

func (c LoginConfig) Validate() error

type MintYAMLFile

type MintYAMLFile struct {
	Entry RwxDirectoryEntry
	Doc   *YAMLDoc
}

type PackageVersion added in v1.9.0

type PackageVersion struct {
	Original     string
	Name         string
	Version      string
	MajorVersion string
}

type PushImageConfig added in v1.12.0

type PushImageConfig struct {
	TaskID       string
	References   []reference.Named
	DockerCLI    dockercli.AuthConfigurator
	JSON         bool
	Wait         bool
	OpenURL      func(url string) error
	PollInterval time.Duration
}

func NewPushImageConfig added in v1.12.0

func NewPushImageConfig(taskID string, references []string, json bool, wait bool, openURL func(url string) error) (PushImageConfig, error)

type PushImageOutput added in v1.12.0

type PushImageOutput struct {
	PushID string `json:"push_id,omitempty"`
	RunURL string `json:"run_url,omitempty"`
	Status string `json:"status,omitempty"`
}

type ResolveBaseConfig

type ResolveBaseConfig struct {
	RwxDirectory string
	Files        []string
	Os           string
	Tag          string
	Arch         string
}

func (ResolveBaseConfig) Validate

func (c ResolveBaseConfig) Validate() error

type ResolveBaseResult

type ResolveBaseResult struct {
	ErroredRunFiles []BaseLayerRunFile
	UpdatedRunFiles []BaseLayerRunFile
}

func (ResolveBaseResult) HasChanges

func (r ResolveBaseResult) HasChanges() bool

type ResolvePackagesConfig added in v1.9.0

type ResolvePackagesConfig struct {
	RwxDirectory        string
	Files               []string
	LatestVersionPicker func(versions api.PackageVersionsResult, rwxPackage string, _ string) (string, error)
}

func (ResolvePackagesConfig) PickLatestVersion added in v1.9.0

func (c ResolvePackagesConfig) PickLatestVersion(versions api.PackageVersionsResult, rwxPackage string) (string, error)

func (ResolvePackagesConfig) Validate added in v1.9.0

func (c ResolvePackagesConfig) Validate() error

type ResolvePackagesResult added in v1.9.0

type ResolvePackagesResult struct {
	ResolvedPackages map[string]string
}

func (ResolvePackagesResult) HasChanges added in v1.9.0

func (r ResolvePackagesResult) HasChanges() bool

type RwxDirectoryEntry

type RwxDirectoryEntry = api.RwxDirectoryEntry

type SSHClient

type SSHClient interface {
	Close() error
	Connect(addr string, cfg gossh.ClientConfig) error
	InteractiveSession() error
}

type Service

type Service struct {
	Config
}

Service holds the main business logic of the CLI.

func NewService

func NewService(cfg Config) (Service, error)

func (Service) DebugTask

func (s Service) DebugTask(cfg DebugTaskConfig) error

DebugRunConfig will connect to a running task over SSH. Key exchange is facilitated over the Cloud API.

func (Service) GetDispatch

func (s Service) GetDispatch(cfg GetDispatchConfig) ([]GetDispatchRun, error)

func (Service) InitiateDispatch

func (s Service) InitiateDispatch(cfg InitiateDispatchConfig) (*api.InitiateDispatchResult, error)

func (Service) InitiateRun

func (s Service) InitiateRun(cfg InitiateRunConfig) (*api.InitiateRunResult, error)

InitiateRun will connect to the Cloud API and start a new run in Mint.

func (Service) Lint

func (s Service) Lint(cfg LintConfig) (*api.LintResult, error)

func (Service) Login

func (s Service) Login(cfg LoginConfig) error

func (Service) PushImage added in v1.12.0

func (s Service) PushImage(config PushImageConfig) error

func (Service) ResolveBase

func (s Service) ResolveBase(cfg ResolveBaseConfig) (ResolveBaseResult, error)

func (Service) ResolvePackages added in v1.9.0

func (s Service) ResolvePackages(cfg ResolvePackagesConfig) (ResolvePackagesResult, error)

func (Service) SetSecretsInVault

func (s Service) SetSecretsInVault(cfg SetSecretsInVaultConfig) error

func (Service) UpdateBase

func (s Service) UpdateBase(cfg UpdateBaseConfig) (ResolveBaseResult, error)

func (Service) UpdatePackages added in v1.9.0

func (s Service) UpdatePackages(cfg UpdatePackagesConfig) error

func (Service) Whoami

func (s Service) Whoami(cfg WhoamiConfig) error

type SetSecretsInVaultConfig

type SetSecretsInVaultConfig struct {
	Secrets []string
	Vault   string
	File    string
}

func (SetSecretsInVaultConfig) Validate

func (c SetSecretsInVaultConfig) Validate() error

type TaskDefinition

type TaskDefinition = api.TaskDefinition

type UpdateBaseConfig

type UpdateBaseConfig struct {
	RwxDirectory string
	Files        []string
}

func (UpdateBaseConfig) Validate

func (c UpdateBaseConfig) Validate() error

type UpdatePackagesConfig added in v1.9.0

type UpdatePackagesConfig struct {
	RwxDirectory             string
	Files                    []string
	ReplacementVersionPicker func(versions api.PackageVersionsResult, rwxPackage string, major string) (string, error)
}

func (UpdatePackagesConfig) Validate added in v1.9.0

func (c UpdatePackagesConfig) Validate() error

type WhoamiConfig

type WhoamiConfig struct {
	Json bool
}

func (WhoamiConfig) Validate

func (c WhoamiConfig) Validate() error

type YAMLDoc

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

func ParseYAMLDoc

func ParseYAMLDoc(content string) (*YAMLDoc, error)

func ParseYAMLFile

func ParseYAMLFile(path string) (*YAMLDoc, error)

func (*YAMLDoc) AllTasksAreEmbeddedRuns added in v1.12.0

func (doc *YAMLDoc) AllTasksAreEmbeddedRuns() bool

func (*YAMLDoc) Bytes

func (doc *YAMLDoc) Bytes() []byte

func (*YAMLDoc) ForEachNode

func (doc *YAMLDoc) ForEachNode(yamlPath string, f func(node ast.Node) error) error

func (*YAMLDoc) HasBase

func (doc *YAMLDoc) HasBase() bool

func (*YAMLDoc) HasChanges

func (doc *YAMLDoc) HasChanges() bool

func (*YAMLDoc) HasTasks

func (doc *YAMLDoc) HasTasks() bool

func (*YAMLDoc) InsertBefore

func (doc *YAMLDoc) InsertBefore(beforeYamlPath string, value any) error

func (*YAMLDoc) IsListOfTasks

func (doc *YAMLDoc) IsListOfTasks() bool

func (*YAMLDoc) IsRunDefinition

func (doc *YAMLDoc) IsRunDefinition() bool

func (*YAMLDoc) MergeAtPath

func (doc *YAMLDoc) MergeAtPath(yamlPath string, value any) error

func (*YAMLDoc) ReadStringAtPath

func (doc *YAMLDoc) ReadStringAtPath(yamlPath string) (string, error)

func (*YAMLDoc) ReplaceAtPath

func (doc *YAMLDoc) ReplaceAtPath(yamlPath string, replacement any) error

func (*YAMLDoc) SetAtPath

func (doc *YAMLDoc) SetAtPath(yamlPath string, value any) error

func (*YAMLDoc) String

func (doc *YAMLDoc) String() string

func (*YAMLDoc) TryReadStringAtPath

func (doc *YAMLDoc) TryReadStringAtPath(yamlPath string) string

func (*YAMLDoc) WriteFile

func (doc *YAMLDoc) WriteFile(path string) error

Jump to

Keyboard shortcuts

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