Documentation
¶
Overview ¶
go: build !windows build !windows
Index ¶
- func CommandAction(handler func(args []string, stdout io.Writer) error) func(cmd *cobra.Command, args []string) error
- func HelloFromV2() string
- func ImageDestFlags(global *GlobalOptions, shared *SharedImageOptions, ...) (pflag.FlagSet, *imageDestOptions)
- func ImageSrcFlags(global *GlobalOptions, shared *SharedImageOptions, ...) (pflag.FlagSet, *imageOptions)
- func NoteCloseFailure(err error, description string, closeErr error) error
- func ParseManifestFormat(manifestFormat string) (string, error)
- func PromptForPassphrase(privateKeyFile string, stdin, stdout *os.File) (string, error)
- func ReexecIfNecessaryForImages(imageNames ...string) error
- func RetryFlags() (pflag.FlagSet, *retry.Options)
- type CopyOptions
- type DeprecatedTLSVerifyOption
- type ErrorShouldDisplayUsage
- type GlobalOptions
- type Mirror
- type MirrorCopy
- type MirrorCopyInterface
- type MirrorDelete
- type MirrorDeleteInterface
- type MirrorInterface
- type Mode
- type SharedImageOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommandAction ¶
func CommandAction(handler func(args []string, stdout io.Writer) error) func(cmd *cobra.Command, args []string) error
commandAction intermediates between the RunE interface and the real handler, primarily to ensure that cobra.Command is not available to the handler, which in turn makes sure that the cmd.Flags() etc. flag access functions are not used, and everything is done using the *Options structures and the *Var() methods of cmd.Flag(). handler may return errorShouldDisplayUsage to cause c.Help to be called.
func HelloFromV2 ¶
func HelloFromV2() string
func ImageDestFlags ¶
func ImageDestFlags(global *GlobalOptions, shared *SharedImageOptions, deprecatedTLSVerify *DeprecatedTLSVerifyOption, flagPrefix, credsOptionAlias string) (pflag.FlagSet, *imageDestOptions)
imageDestFlags prepares a collection of CLI flags writing into imageDestOptions, and the managed imageDestOptions structure.
func ImageSrcFlags ¶
func ImageSrcFlags(global *GlobalOptions, shared *SharedImageOptions, deprecatedTLSVerify *DeprecatedTLSVerifyOption, flagPrefix, credsOptionAlias string) (pflag.FlagSet, *imageOptions)
imageFlags prepares a collection of CLI flags writing into imageOptions, and the managed imageOptions structure.
func NoteCloseFailure ¶
noteCloseFailure returns (possibly-nil) err modified to account for (non-nil) closeErr. The error for closeErr is annotated with description (which is not a format string) Typical usage:
defer func() {
if err := something.Close(); err != nil {
returnedErr = noteCloseFailure(returnedErr, "closing something", err)
}
}
func ParseManifestFormat ¶
parseManifestFormat parses format parameter for copy and sync command. It returns string value to use as manifest MIME type
func PromptForPassphrase ¶
promptForPassphrase interactively prompts for a passphrase related to privateKeyFile
Types ¶
type CopyOptions ¶
type CopyOptions struct {
Global *GlobalOptions
DeprecatedTLSVerify *DeprecatedTLSVerifyOption
SrcImage *imageOptions
DestImage *imageDestOptions
RetryOpts *retry.Options
AdditionalTags []string // For docker-archive: destinations, in addition to the name:tag specified as destination, also add these
RemoveSignatures bool // Do not copy signatures from the source image
SignByFingerprint string // Sign the image using a GPG key with the specified fingerprint
SignBySigstorePrivateKey string // Sign the image using a sigstore private key
SignPassphraseFile string // Path pointing to a passphrase file when signing (for either signature format, but only one of them)
SignIdentity string // Identity of the signed image, must be a fully specified docker reference
DigestFile string // Write digest to this file
Format string // Force conversion of the image to a specified format
All bool // Copy all of the images if the source is a list
MultiArch string // How to handle multi architecture images
PreserveDigests bool // Preserve digests during copy
EncryptLayer []int // The list of layers to encrypt
EncryptionKeys []string // Keys needed to encrypt the image
DecryptionKeys []string // Keys needed to decrypt the image
Mode string // 2 options disktoMirror or mirrorToDisk (for now)
Dev bool // developer mode - will be removed when completed
Destination string // what to target to
UUID uuid.UUID // set uuid
ImageType string // release, catalog-operator, additionalImage
}
type DeprecatedTLSVerifyOption ¶
type DeprecatedTLSVerifyOption struct {
// contains filtered or unexported fields
}
deprecatedTLSVerifyOption represents a deprecated --tls-verify option, which was accepted for all subcommands, for a time. Every user should call deprecatedTLSVerifyOption.warnIfUsed() as part of handling the CLI, whether or not the value actually ends up being used. DO NOT ADD ANY NEW USES OF THIS; just call dockerImageFlags with an appropriate, possibly empty, flagPrefix.
func DeprecatedTLSVerifyFlags ¶
func DeprecatedTLSVerifyFlags() (pflag.FlagSet, *DeprecatedTLSVerifyOption)
deprecatedTLSVerifyFlags prepares the CLI flag writing into deprecatedTLSVerifyOption, and the managed deprecatedTLSVerifyOption structure. DO NOT ADD ANY NEW USES OF THIS; just call dockerImageFlags with an appropriate, possibly empty, flagPrefix.
func (*DeprecatedTLSVerifyOption) WarnIfUsed ¶
func (opts *DeprecatedTLSVerifyOption) WarnIfUsed(alternatives []string)
warnIfUsed warns if tlsVerify was set by the user, and suggests alternatives (which should start with "--"). Every user should call this as part of handling the CLI, whether or not the value actually ends up being used.
type ErrorShouldDisplayUsage ¶
type ErrorShouldDisplayUsage struct {
Error error
}
errorShouldDisplayUsage is a subtype of error used by command handlers to indicate that cli.ShowSubcommandHelp should be called.
type GlobalOptions ¶
type GlobalOptions struct {
LogLevel string // one of info, debug, trace
TlsVerify bool // Require HTTPS and verify certificates (for docker: and docker-daemon:)
PolicyPath string // Path to a signature verification policy file
InsecurePolicy bool // Use an "allow everything" signature verification policy
RegistriesDirPath string // Path to a "registries.d" registry configuration directory
OverrideArch string // Architecture to use for choosing images, instead of the runtime one
OverrideOS string // OS to use for choosing images, instead of the runtime one
OverrideVariant string // Architecture variant to use for choosing images, instead of the runtime one
CommandTimeout time.Duration // Timeout for the command execution
RegistriesConfPath string // Path to the "registries.conf" file
TmpDir string // Path to use for big temporary files
Dir string // working directory
From string // local storage for diskToMirror workflow
Port uint16 // HTTP port used by oc-mirror's local storage instance
ConfigPath string // Path to use for imagesetconfig
ReleaseFrom string // Used for release mirroring (diskToMirror)
OperatorsFrom string // Used for operators mirroring (diskToMirror)
AdditionalFrom string // Used for additionalImages mirroring (diskToMirror)
Quiet bool // Suppress output information when copying images
Force bool // Force the copy/mirror even if there is nothing to update
V2 bool // Redirect the flow to oc-mirror v2 - PLEASE DO NOT USE that. V2 is still under development and it is not ready to be used.
}
func (*GlobalOptions) CommandTimeoutContext ¶
func (opts *GlobalOptions) CommandTimeoutContext() (context.Context, context.CancelFunc)
commandTimeoutContext returns a context.Context and a cancellation callback based on opts. The caller should usually "defer cancel()" immediately after calling this.
func (*GlobalOptions) GetPolicyContext ¶
func (opts *GlobalOptions) GetPolicyContext() (*signature.PolicyContext, error)
getPolicyContext returns a *signature.PolicyContext based on opts.
func (*GlobalOptions) NewSystemContext ¶
func (opts *GlobalOptions) NewSystemContext() *types.SystemContext
newSystemContext returns a *types.SystemContext corresponding to opts. It is guaranteed to return a fresh instance, so it is safe to make additional updates to it.
type Mirror ¶
type Mirror struct {
Mode string
// contains filtered or unexported fields
}
Mirror
type MirrorCopy ¶
type MirrorCopy struct{}
func (*MirrorCopy) CopyImage ¶
func (o *MirrorCopy) CopyImage(ctx context.Context, pc *signature.PolicyContext, destRef, srcRef types.ImageReference, co *copy.Options) ([]byte, error)
type MirrorCopyInterface ¶
type MirrorCopyInterface interface {
CopyImage(ctx context.Context, pc *signature.PolicyContext, destRef, srcRef types.ImageReference, opts *copy.Options) ([]byte, error)
}
func NewMirrorCopy ¶
func NewMirrorCopy() MirrorCopyInterface
type MirrorDelete ¶
type MirrorDelete struct{}
func (*MirrorDelete) DeleteImage ¶
func (o *MirrorDelete) DeleteImage(ctx context.Context, image string, co *CopyOptions) error
type MirrorDeleteInterface ¶
type MirrorDeleteInterface interface {
DeleteImage(ctx context.Context, image string, opts *CopyOptions) error
}
func NewMirrorDelete ¶
func NewMirrorDelete() MirrorDeleteInterface
type MirrorInterface ¶
type MirrorInterface interface {
Run(ctx context.Context, src, dest string, mode Mode, opts *CopyOptions, stdout bufio.Writer) (retErr error)
Check(ctx context.Context, image string, opts *CopyOptions) (bool, error)
}
MirrorInterface used to mirror images with container/images (skopeo)
func New ¶
func New(mc MirrorCopyInterface, md MirrorDeleteInterface) MirrorInterface
New returns new Mirror instance
type SharedImageOptions ¶
type SharedImageOptions struct {
// contains filtered or unexported fields
}
sharedImageOptions collects CLI flags which are image-related, but do not change across images. This really should be a part of globalOptions, but that would break existing users of (skopeo copy --authfile=).
func SharedImageFlags ¶
func SharedImageFlags() (pflag.FlagSet, *SharedImageOptions)
sharedImageFlags prepares a collection of CLI flags writing into sharedImageOptions, and the managed sharedImageOptions structure.