Documentation
¶
Overview ¶
Package bundle provides CLI commands for managing UDS bundles.
Package util provides shared utility functions for CLI commands.
Index ¶
- Variables
- func NewBundleCommand(streams iostreams.IOStreams) *cobra.Command
- func NewCreateCommand(streams iostreams.IOStreams) *cobra.Command
- func NewDeployCommand(streams iostreams.IOStreams) *cobra.Command
- func NewDevCommand(streams iostreams.IOStreams) *cobra.Command
- func NewDevDeployCommand(streams iostreams.IOStreams) *cobra.Command
- func NewInspectCommand(streams iostreams.IOStreams) *cobra.Command
- func NewPullCommand(streams iostreams.IOStreams) *cobra.Command
- func NewPushCommand(streams iostreams.IOStreams) *cobra.Command
- func NewReconfigureCommand(streams iostreams.IOStreams) *cobra.Command
- func NewRemoveCommand(streams iostreams.IOStreams) *cobra.Command
- func NewSignCommand(streams iostreams.IOStreams) *cobra.Command
- func NewVerifyCommand(streams iostreams.IOStreams) *cobra.Command
- func PromptConfirmation(streams iostreams.IOStreams, message string) (bool, error)
- func ResolvePrinter(cmd *cobra.Command) (printer.ResourcePrinter, error)
- func ValidateArtifactReference(ref string) error
- func ValidateBundlePath(ref string, opts ...ValidateBundlePathOption) error
- func ValidateDevDeployPath(ref string) error
- func ValidateDir(path string) error
- type CLIFlags
- type ConfigResolver
- func (r *ConfigResolver) Defaults() bundle.ConfigOptions
- func (r *ConfigResolver) MergeHCL(base bundle.ConfigOptions, hcl *bundle.ConfigOptions) bundle.ConfigOptions
- func (r *ConfigResolver) OverlayCLI(flags CLIFlags, base bundle.ConfigOptions) bundle.ConfigOptions
- func (r *ConfigResolver) Resolve(ctx context.Context, streams iostreams.IOStreams, flags CLIFlags, ...) (*bundle.UDSBundleConfig, string, error)
- type CreateOptions
- type DeployOptions
- type DevDeployOptions
- type InspectOptions
- type PullOptions
- type PushOptions
- type ReconfigureOptions
- type RemoveOptions
- type SignOptions
- type ValidateBundlePathOption
- type VerifyOptions
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidArgument = errors.New("invalid command argument") ErrPathNotFound = errors.New("path not found") ErrInvalidPath = errors.New("invalid path") ErrUnsupportedSource = errors.New("unsupported bundle source") ErrParseConfig = errors.New("parsing bundle config") ErrAccessDefaults = errors.New("accessing bundle defaults") ErrParseBundle = errors.New("parsing bundle") ErrInvalidBundle = errors.New("invalid bundle") ErrForceRequired = errors.New("operation requires force") ErrPullBundle = errors.New("pulling bundle") ErrPushBundle = errors.New("pushing bundle") ErrCreateWorkspace = errors.New("creating bundle workspace") ErrResolvePath = errors.New("resolving path") ErrUnsafePullOutput = errors.New("unsafe pull output path") ErrReadConfirmation = errors.New("reading confirmation") ErrWriteDefinitionNotice = errors.New("writing bundle definition notice") )
Functions ¶
func NewBundleCommand ¶
NewBundleCommand creates the bundle parent command.
func NewCreateCommand ¶
NewCreateCommand creates the create command.
func NewDeployCommand ¶
NewDeployCommand creates the artifact deploy command.
func NewDevCommand ¶
NewDevCommand creates the bundle development parent command.
func NewDevDeployCommand ¶
NewDevDeployCommand creates the bundle definition deploy command.
func NewInspectCommand ¶
NewInspectCommand creates the inspect command.
func NewPullCommand ¶
NewPullCommand creates the pull command.
func NewPushCommand ¶
NewPushCommand creates the push command.
func NewReconfigureCommand ¶
NewReconfigureCommand creates the reconfigure command.
func NewRemoveCommand ¶
NewRemoveCommand creates the remove command.
func NewSignCommand ¶
NewSignCommand creates the bundle sign command.
func NewVerifyCommand ¶
NewVerifyCommand creates the bundle verify command.
func PromptConfirmation ¶
PromptConfirmation writes message + " y/N: " to streams.ErrOut, reads one line from streams.In, and returns true for "y" or "yes" (case-insensitive). EOF and bare Enter ("unexpected newline") are treated as a "no" (false, nil). Any other read error is returned so callers can distinguish a real I/O failure.
func ResolvePrinter ¶
func ResolvePrinter(cmd *cobra.Command) (printer.ResourcePrinter, error)
ResolvePrinter resolves the --output flag into a ResourcePrinter. This centralizes the printer resolution logic shared by all bundle commands.
func ValidateArtifactReference ¶
ValidateArtifactReference validates a local or OCI bundle artifact reference.
func ValidateBundlePath ¶
func ValidateBundlePath(ref string, opts ...ValidateBundlePathOption) error
ValidateBundlePath checks if a user-provided bundle reference is valid. Use this in Validate() methods. Pass AllowArtifactBundlePath() for commands that also accept .tar.zst bundle artifact.
It checks:
- Empty string → error
- OCI references → error (not yet supported)
- tar.zst archives → validated for existence if AllowArtifactBundlePath(); error otherwise
- Path exists on filesystem
- If directory, contains bundle.uds.hcl
- If file, is named bundle.uds.hcl
Returns nil if valid, or an error describing the problem.
func ValidateDevDeployPath ¶
ValidateDevDeployPath validates bundle definition input and redirects artifact users to the production deploy command.
func ValidateDir ¶
ValidateDir checks that the given path exists and is a directory.
Types ¶
type CLIFlags ¶
type CLIFlags struct {
ConfigPath string // --config (always read; empty when unset)
LogLevel string
LogLevelChanged bool
Architecture string
ArchitectureChanged bool
PlainHTTP bool
PlainHTTPChanged bool
SkipTLSVerify bool
SkipTLSVerifyChanged bool
TmpDir string
TmpDirChanged bool
Concurrency int
ConcurrencyChanged bool
Prompt bool
}
CLIFlags holds a snapshot of CLI flag values together with their Changed() bits. It exists so config resolution does not depend on *cobra.Command, keeping command execution independent of Cobra.
func SnapshotFlags ¶
SnapshotFlags reads every CLI flag the resolver needs from cmd, plus its Changed() bit.
type ConfigResolver ¶
type ConfigResolver struct{}
ConfigResolver encapsulates the four-layer config resolution logic: defaults → defaults.uds.hcl → config.uds.hcl → CLI flags.
func NewConfigResolver ¶
func NewConfigResolver() *ConfigResolver
NewConfigResolver returns a new ConfigResolver.
func (*ConfigResolver) Defaults ¶
func (r *ConfigResolver) Defaults() bundle.ConfigOptions
Defaults returns ConfigOptions with sensible defaults per ADR-0006.
func (*ConfigResolver) MergeHCL ¶
func (r *ConfigResolver) MergeHCL(base bundle.ConfigOptions, hcl *bundle.ConfigOptions) bundle.ConfigOptions
MergeHCL merges HCL-parsed options into a defaults base. Only non-zero HCL values overwrite the base. This is necessary because gohcl decodes missing fields as Go zero values, so a partial options {} block would otherwise erase defaults for unset fields.
Limitation: bool fields cannot distinguish "explicitly set to false" from "not set" in HCL. If a user writes `plain_http = false` in config.uds.hcl, it looks the same as omitting the field. This is acceptable because false is the default for all bool options.
func (*ConfigResolver) OverlayCLI ¶
func (r *ConfigResolver) OverlayCLI(flags CLIFlags, base bundle.ConfigOptions) bundle.ConfigOptions
OverlayCLI overlays CLI flag values onto a base ConfigOptions. Only flags explicitly set by the user (Changed bits in flags) are applied. This ensures config.uds.hcl values are preserved unless the user overrides them on the command line.
func (*ConfigResolver) Resolve ¶
func (r *ConfigResolver) Resolve(ctx context.Context, streams iostreams.IOStreams, flags CLIFlags, bundlePath string) (*bundle.UDSBundleConfig, string, error)
Resolve applies defaults, config, and explicit CLI flags in precedence order. bundlePath is the user-provided bundle path (directory or file); when non-empty, Resolve looks for defaults.uds.hcl in that directory. Pass "" to skip defaults. Returns the merged UDSBundleConfig and the config file path (empty if no --config flag).
type CreateOptions ¶
type CreateOptions struct {
BundlePath string // Path to bundle file or directory (user input, resolved in Run)
Prompt bool
Config *bundle.UDSBundleConfig
Printer printer.ResourcePrinter
Signing bundle.SigningOptions
iostreams.IOStreams
}
CreateOptions holds options for the create command.
func NewCreateOptions ¶
func NewCreateOptions(streams iostreams.IOStreams) *CreateOptions
NewCreateOptions returns a CreateOptions with default values.
func (*CreateOptions) Complete ¶
func (o *CreateOptions) Complete(cmd *cobra.Command, args []string) error
Complete fills in options from command line args.
func (*CreateOptions) Run ¶
func (o *CreateOptions) Run(ctx context.Context) error
Run executes the create command.
func (*CreateOptions) Validate ¶
func (o *CreateOptions) Validate() error
Validate validates the options without modifying state. Config validation is performed by the library entry point.
type DeployOptions ¶
type DeployOptions struct {
BundlePath string
Packages []string
Force bool
Config *bundle.UDSBundleConfig
Verification VerifyOptions
Printer printer.ResourcePrinter
iostreams.IOStreams
// contains filtered or unexported fields
}
DeployOptions holds options for artifact deployment.
func NewDeployOptions ¶
func NewDeployOptions(streams iostreams.IOStreams) *DeployOptions
NewDeployOptions returns artifact deploy options with default values.
func (*DeployOptions) Complete ¶
func (o *DeployOptions) Complete(cmd *cobra.Command, args []string) error
Complete fills artifact deploy options from command-line arguments.
func (*DeployOptions) Run ¶
func (o *DeployOptions) Run(ctx context.Context) error
Run executes local or OCI artifact deployment.
func (*DeployOptions) Validate ¶
func (o *DeployOptions) Validate() error
Validate validates artifact deploy options without modifying state.
type DevDeployOptions ¶
type DevDeployOptions struct {
BundlePath string
Packages []string
Force bool
Config *bundlepkg.UDSBundleConfig
Printer printer.ResourcePrinter
iostreams.IOStreams
// contains filtered or unexported fields
}
DevDeployOptions holds options for bundle definition deployment.
func NewDevDeployOptions ¶
func NewDevDeployOptions(streams iostreams.IOStreams) *DevDeployOptions
NewDevDeployOptions returns development deploy options with default values.
func (*DevDeployOptions) Complete ¶
func (o *DevDeployOptions) Complete(cmd *cobra.Command, args []string) error
Complete fills development deploy options from command-line arguments.
func (*DevDeployOptions) Run ¶
func (o *DevDeployOptions) Run(ctx context.Context) error
Run executes bundle definition deployment.
func (*DevDeployOptions) Validate ¶
func (o *DevDeployOptions) Validate() error
Validate validates development deploy options without modifying state.
type InspectOptions ¶
type InspectOptions struct {
BundlePath string // Path to a .tar.zst artifact or OCI reference
Config *bundle.UDSBundleConfig
Printer printer.ResourcePrinter
Verification VerifyOptions
iostreams.IOStreams
}
InspectOptions holds the options for the inspect command.
func NewInspectOptions ¶
func NewInspectOptions(streams iostreams.IOStreams) *InspectOptions
NewInspectOptions returns a new InspectOptions with default values.
func (*InspectOptions) Complete ¶
func (o *InspectOptions) Complete(cmd *cobra.Command, args []string) error
Complete fills in options from command line args.
func (*InspectOptions) Run ¶
func (o *InspectOptions) Run(ctx context.Context) error
Run executes the inspect command.
func (*InspectOptions) Validate ¶
func (o *InspectOptions) Validate() error
Validate validates the options without modifying state.
type PullOptions ¶
type PullOptions struct {
OCIReference string
OutputDir string
Prompt bool
Config *bundle.UDSBundleConfig
Verification VerifyOptions
Printer printer.ResourcePrinter
iostreams.IOStreams
}
PullOptions holds options for the pull command.
func NewPullOptions ¶
func NewPullOptions(streams iostreams.IOStreams) *PullOptions
NewPullOptions returns a PullOptions with default values.
func (*PullOptions) Complete ¶
func (o *PullOptions) Complete(cmd *cobra.Command, args []string) error
Complete fills in options from command line args.
func (*PullOptions) Run ¶
func (o *PullOptions) Run(ctx context.Context) error
Run executes the pull command.
func (*PullOptions) Validate ¶
func (o *PullOptions) Validate() error
Validate validates the options. Config validation is performed by the library entry point.
type PushOptions ¶
type PushOptions struct {
Tarball string
OCIReference string
Prompt bool
Config *bundle.UDSBundleConfig
Printer printer.ResourcePrinter
iostreams.IOStreams
}
PushOptions holds options for the push command.
func NewPushOptions ¶
func NewPushOptions(streams iostreams.IOStreams) *PushOptions
NewPushOptions returns a PushOptions with default values.
func (*PushOptions) Complete ¶
func (o *PushOptions) Complete(cmd *cobra.Command, args []string) error
Complete fills in options from command line args.
func (*PushOptions) Run ¶
func (o *PushOptions) Run(ctx context.Context) error
Run executes the push command.
func (*PushOptions) Validate ¶
func (o *PushOptions) Validate() error
Validate validates the options. Config validation is performed by the library entry point.
type ReconfigureOptions ¶
type ReconfigureOptions struct {
Source string
DefaultsFile string
Suffix string
OutputDir string
Prompt bool
Config *bundle.UDSBundleConfig
Signing bundle.SigningOptions
Verification VerifyOptions
Printer printer.ResourcePrinter
iostreams.IOStreams
}
ReconfigureOptions holds options for the reconfigure command.
func NewReconfigureOptions ¶
func NewReconfigureOptions(streams iostreams.IOStreams) *ReconfigureOptions
NewReconfigureOptions returns a ReconfigureOptions with default values.
func (*ReconfigureOptions) Complete ¶
func (o *ReconfigureOptions) Complete(cmd *cobra.Command, args []string) error
Complete fills in options from command args and flags.
func (*ReconfigureOptions) Run ¶
func (o *ReconfigureOptions) Run(ctx context.Context) error
Run executes the reconfigure command.
func (*ReconfigureOptions) Validate ¶
func (o *ReconfigureOptions) Validate() error
Validate checks that options are valid.
type RemoveOptions ¶
type RemoveOptions struct {
BundlePath string // Path to bundle file or directory (user input, resolved in Run)
Packages []string
Force bool
Prompt bool
Config *bundle.UDSBundleConfig
Printer printer.ResourcePrinter
iostreams.IOStreams
// contains filtered or unexported fields
}
RemoveOptions holds options for the remove command.
func NewRemoveOptions ¶
func NewRemoveOptions(streams iostreams.IOStreams) *RemoveOptions
NewRemoveOptions returns a RemoveOptions with default values.
func (*RemoveOptions) Complete ¶
func (o *RemoveOptions) Complete(cmd *cobra.Command, args []string) error
Complete fills in options from command line args.
func (*RemoveOptions) Run ¶
func (o *RemoveOptions) Run(ctx context.Context) error
Run executes the remove command. Validate() must have populated o.parsedBundle.
func (*RemoveOptions) Validate ¶
func (o *RemoveOptions) Validate() error
Validate validates the options. It parses the bundle and runs the package selection checks (ValidatePackageNames and, unless --force, dependency safety) before Run() so invalid input fails fast even when the operator declines the prompt. The library layer (RemoveBundle) re-validates as the authoritative gate for direct callers. The parsed bundle is cached on o.parsedBundle for Run() to consume.
type SignOptions ¶
type SignOptions struct {
Source string
Signing bundlepkg.SigningOptions
Config *bundlepkg.UDSBundleConfig
iostreams.IOStreams
}
SignOptions holds options for the bundle sign command.
func (*SignOptions) Complete ¶
func (o *SignOptions) Complete(cmd *cobra.Command, args []string) error
Complete fills sign options from command arguments and flags.
func (*SignOptions) Run ¶
func (o *SignOptions) Run(ctx context.Context) error
Run signs a bundle artifact.
func (*SignOptions) Validate ¶
func (o *SignOptions) Validate() error
Validate validates sign options.
type ValidateBundlePathOption ¶
type ValidateBundlePathOption func(*validateBundlePathConfig)
ValidateBundlePathOption configures ValidateBundlePath behavior.
func AllowArtifactBundlePath ¶
func AllowArtifactBundlePath() ValidateBundlePathOption
AllowArtifactBundlePath enables .tar.zst bundle artifact paths in ValidateBundlePath. Pass this to commands that support artifact deployment (e.g. deploy).
type VerifyOptions ¶
type VerifyOptions struct {
Source string
Config *bundlepkg.UDSBundleConfig
PublicKey string
Identity string
IdentityRE string
Issuer string
IssuerRE string
TrustedRoot string
SkipSignatureVerification bool
iostreams.IOStreams
}
VerifyOptions holds options for the bundle verify command.
func (*VerifyOptions) Complete ¶
func (o *VerifyOptions) Complete(cmd *cobra.Command, args []string) error
Complete fills verification options from command arguments, config, and flags.
func (*VerifyOptions) Run ¶
func (o *VerifyOptions) Run(ctx context.Context) error
Run verifies a bundle artifact.
func (*VerifyOptions) Validate ¶
func (o *VerifyOptions) Validate() error
Validate validates verification command options.