Documentation
¶
Overview ¶
Package generate provides the "generate" command.
Index ¶
- func DefaultConfigPath() string
- func DefaultImageDigestUpdater(client *registry.HTTPClient, flags *Flags) (generate.IImageDigestUpdater, error)
- func DefaultImageFormatter(flags *Flags) (generate.IImageFormatter, error)
- func DefaultImageParser(flags *Flags) (generate.IImageParser, error)
- func DefaultLoadEnv(path string) error
- func DefaultPathCollector(flags *Flags) (generate.IPathCollector, error)
- func DefaultWrapperManager(client *registry.HTTPClient, configPath string) (*registry.WrapperManager, error)
- func NewGenerateCmd(client *registry.HTTPClient) (*cobra.Command, error)
- func SetupGenerator(client *registry.HTTPClient, flags *Flags) (generate.IGenerator, error)
- type Flags
- type FlagsWithSharedNames
- type FlagsWithSharedValues
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultConfigPath ¶
func DefaultConfigPath() string
DefaultConfigPath returns the default location of docker's config.json for all platforms. If the platform does not have a home directory, it returns an empty string.
func DefaultImageDigestUpdater ¶
func DefaultImageDigestUpdater( client *registry.HTTPClient, flags *Flags, ) (generate.IImageDigestUpdater, error)
DefaultImageDigestUpdater creates an IImageDigestUpdater that works with Dockerfiles, Composefiles, and Kubernetesfiles.
If all "ExcludePaths" are true or any of the three's flags, are nil, an error is returned.
DefaultImageDigestUpdater relies on DefaultWrapperManager and is subject to the same error conditions.
func DefaultImageFormatter ¶ added in v0.7.2
func DefaultImageFormatter(flags *Flags) (generate.IImageFormatter, error)
DefaultImageFormatter creates an IImageFormatter that works with Dockerfiles, Composefiles, and Kubernetesfiles.
ImageFormatters are set according to the flag, "ExcludePaths". If all "ExcludePaths" are true or any of the three's flags, are nil, an error is returned.
func DefaultImageParser ¶
func DefaultImageParser(flags *Flags) (generate.IImageParser, error)
DefaultImageParser creates an IImageParser that works with Dockerfiles, Composefiles, and Kubernetesfiles.
ImageParsers are set according to the flag, "ExcludePaths". If all "ExcludePaths" are true or any of the three's flags, are nil, an error is returned.
func DefaultLoadEnv ¶
DefaultLoadEnv loads .env files based on the path. If a path does not exist and that path is not ".env", an error will occur.
func DefaultPathCollector ¶
func DefaultPathCollector(flags *Flags) (generate.IPathCollector, error)
DefaultPathCollector creates an IPathCollector that works with Dockerfiles, Composefiles, and Kubernetesfiles.
For all three, respectively, the defaults are ["Dockerfile"], ["docker-compose.yml", "docker-compose.yaml"], and ["deployment.yml", "deployment.yaml", "pod.yml", "pod.yaml", "job.yml", "job.yaml"].
PathCollectors are set according to the flag, "ExcludePaths". If all "ExcludePaths" are true or any of the three's flags, are nil, an error is returned.
func DefaultWrapperManager ¶
func DefaultWrapperManager( client *registry.HTTPClient, configPath string, ) (*registry.WrapperManager, error)
DefaultWrapperManager creates a WrapperManager for querying registries for image digests. The returned wrapper manager uses all possible first party and contrib wrappers. The default wrapper queries Dockerhub for digests and is used if the manager is unable to select a more specific wrapper.
func NewGenerateCmd ¶
func NewGenerateCmd(client *registry.HTTPClient) (*cobra.Command, error)
NewGenerateCmd creates the command 'generate' used in 'docker lock generate'.
func SetupGenerator ¶
func SetupGenerator( client *registry.HTTPClient, flags *Flags, ) (generate.IGenerator, error)
SetupGenerator creates a Generator configured for docker-lock's cli.
Types ¶
type Flags ¶
type Flags struct {
DockerfileFlags *FlagsWithSharedNames
ComposefileFlags *FlagsWithSharedNames
KubernetesfileFlags *FlagsWithSharedNames
}
Flags holds all command line options for Dockerfiles, Composefiles, and Kubernetesfiles.
func NewFlags ¶
func NewFlags( baseDir string, lockfileName string, configPath string, envPath string, ignoreMissingDigests bool, dockerfilePaths []string, composefilePaths []string, kubernetesfilePaths []string, dockerfileGlobs []string, composefileGlobs []string, kubernetesfileGlobs []string, dockerfileRecursive bool, composefileRecursive bool, kubernetesfileRecursive bool, dockerfileExcludeAll bool, composefileExcludeAll bool, kubernetesfileExcludeAll bool, ) (*Flags, error)
NewFlags returns Flags for Dockerfiles, Composefiles, and Kubernetesfiles, subject to the validation logic in NewFlagsWithSharedNames and NewFlagsWithSharedValues.
type FlagsWithSharedNames ¶
type FlagsWithSharedNames struct {
}
FlagsWithSharedNames represents flags whose values differ for Dockerfiles, Composefiles, and Kubernetesfiles.
func NewFlagsWithSharedNames ¶
func NewFlagsWithSharedNames( baseDir string, manualPaths []string, globs []string, recursive bool, excludePaths bool, ) (*FlagsWithSharedNames, error)
NewFlagsWithSharedNames returns Flags whose values differ between Dockerfiles, Composefiles, and Kubernetesfiles, after validating its fields.
baseDir must be the current working directory or a sub directory.
manualPaths and globs must be in the current working directory or in a sub directory.
Absolute paths are not supported.
type FlagsWithSharedValues ¶
type FlagsWithSharedValues struct {
}
FlagsWithSharedValues represents flags whose values are the same for Dockerfiles, Composefiles and Kubernetesfiles.
func NewFlagsWithSharedValues ¶
func NewFlagsWithSharedValues( baseDir string, lockfileName string, configPath string, envPath string, ignoreMissingDigests bool, ) (*FlagsWithSharedValues, error)
NewFlagsWithSharedValues returns Flags that are shared among Dockerfiles, Composefiles, and Kubernetesfiles, after validating its fields.
baseDir must be the current working directory or a sub directory. Absolute paths are not supported.
lockfileName may not contain slashes.