generate

package
v0.8.10 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package generate provides the "generate" command.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultImageDigestUpdater

func DefaultImageDigestUpdater(
	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.

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 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"], ["compose.yml", "compose.yaml", "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 NewGenerateCmd

func NewGenerateCmd() (*cobra.Command, error)

NewGenerateCmd creates the command 'generate' used in 'docker lock generate'.

func SetupGenerator

func SetupGenerator(
	flags *Flags,
) (generate.IGenerator, error)

SetupGenerator creates a Generator configured for docker-lock's cli.

Types

type Flags

type Flags struct {
	FlagsWithSharedValues *FlagsWithSharedValues
	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,
	ignoreMissingDigests bool,
	updateExistingDigests 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 {
	ManualPaths  []string
	Globs        []string
	Recursive    bool
	ExcludePaths bool
}

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 {
	BaseDir               string
	LockfileName          string
	IgnoreMissingDigests  bool
	UpdateExistingDigests bool
}

FlagsWithSharedValues represents flags whose values are the same for Dockerfiles, Composefiles and Kubernetesfiles.

func NewFlagsWithSharedValues

func NewFlagsWithSharedValues(
	baseDir string,
	lockfileName string,
	ignoreMissingDigests bool,
	updateExistingDigests 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.

Jump to

Keyboard shortcuts

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