build

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command *cli.Command = &cli.Command{
	Name:    commandName,
	Aliases: []string{"b"},
	Usage:   "Build the project",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:     "project-file",
			Aliases:  []string{"f"},
			Usage:    "The project file to use",
			Required: true,
			EnvVars:  []string{"3LV_PROJECT_FILE"},
		},
		&cli.StringFlag{
			Name:     "system-name",
			Aliases:  []string{"s"},
			Usage:    "The system name to use",
			Required: true,
			EnvVars:  []string{"3LV_SYSTEM_NAME"},
		},
		&cli.StringFlag{
			Name:    "build-context",
			Aliases: []string{"c"},
			Usage:   "The build context to use",
			EnvVars: []string{"3LV_BUILD_CONTEXT"},
		},
		&cli.StringFlag{
			Name:    "registry",
			Aliases: []string{"r"},
			Usage:   "The registry to use. Image name will be prefixed with this value.",
			EnvVars: []string{"3LV_REGISTRY"},
		},
		&cli.StringFlag{
			Name:    "go-main-package-directory",
			Usage:   "The main package directory to use when building a Go application",
			EnvVars: []string{"3LV_GO_MAIN_PACKAGE_DIRECTORY"},
		},
		&cli.StringFlag{
			Name:    "cache-tag",
			Usage:   "The cache tag to use",
			Value:   "latest-cache",
			EnvVars: []string{"3LV_CACHE_TAG"},
		},
		&cli.StringFlag{
			Name:    "severity",
			Aliases: []string{"S"},
			Usage:   "The severity to use when scanning the image: can be any combination of CRITICAL, HIGH, MEDIUM, LOW, or UNKNOWN separated by commas",
			Value:   "CRITICAL,HIGH",
			EnvVars: []string{"3LV_SEVERITY"},
		},
		&cli.StringFlag{
			Name:    "azure-tenant-id",
			Usage:   "The tenant ID to use when authenticating with the Azure Container Registry.",
			Hidden:  true,
			EnvVars: []string{"3LV_AZURE_TENANT_ID"},
		},
		&cli.StringFlag{
			Name:    "azure-subscription-id",
			Usage:   "The subscription ID to use when authenticating with the Azure Container Registry.",
			Hidden:  true,
			EnvVars: []string{"3LV_AZURE_SUBSCRIPTION_ID"},
		},
		&cli.StringFlag{
			Name:    "azure-client-id",
			Usage:   "The client ID to use when authenticating with the registry. Must be combined with --azure-federated-token.",
			Hidden:  true,
			EnvVars: []string{"3LV_AZURE_CLIENT_ID"},
		},
		&cli.StringFlag{
			Name:    "azure-federated-token",
			Usage:   "The federated token to use when authenticating with the Azure Container Registry. Must be combined with --client-id.",
			Hidden:  true,
			EnvVars: []string{"3LV_AZURE_FEDERATED_TOKEN"},
		},
		&cli.StringSliceFlag{
			Name:    "additional-tags",
			Aliases: []string{"t"},
			Usage:   "The additional tags to use",
			EnvVars: []string{"3LV_ADDITIONAL_TAGS"},
		},
		&cli.StringSliceFlag{
			Name:    "include-files",
			Aliases: []string{"i"},
			Usage:   "The files to include in the build context",
			EnvVars: []string{"3LV_INCLUDE_FILES"},
		},
		&cli.StringSliceFlag{
			Name:    "include-directories",
			Aliases: []string{"I"},
			Usage:   "The directories to include in the build context",
			EnvVars: []string{"3LV_INCLUDE_DIRECTORIES"},
		},
		&cli.StringSliceFlag{
			Name:    "scan-formats",
			Aliases: []string{"F"},
			Usage:   "The formats to use when outputting the scan results: can be table, json, sarif or markdown.",
			Value:   cli.NewStringSlice("table"),
			Action: func(c *cli.Context, formats []string) error {
				for _, format := range formats {
					if format != "table" && format != "json" && format != "sarif" && format != "markdown" {
						return cli.Exit("Invalid format provided", 1)
					}
				}

				return nil
			},
			EnvVars: []string{"3LV_SCAN_FORMATS"},
		},
		&cli.BoolFlag{
			Name:    "push",
			Aliases: []string{"p"},
			Usage:   "Push the image to the registry",
			Value:   false,
			EnvVars: []string{"3LV_PUSH"},
		},
		&cli.BoolFlag{
			Name:    "generate-only",
			Aliases: []string{"G"},
			Usage:   "Generates a Dockerfile, but does not build the image",
			Value:   false,
			EnvVars: []string{"3LV_GENERATE_ONLY"},
		},
		&cli.BoolFlag{
			Name:    "scan-disable-error",
			Aliases: []string{"D"},
			Usage:   "Disables Trivy scan returning a non-zero exit code if vulnerabilities are found",
			Value:   false,
			EnvVars: []string{"3LV_SCAN_DISABLE_ERROR"},
		},
		&cli.BoolFlag{
			Name:    "scan-skip-db-update",
			Aliases: []string{"U"},
			Usage:   "Skip updating the Trivy database.",
			Value:   false,
			EnvVars: []string{"3LV_SCAN_SKIP_DB_UPDATE"},
		},
		&cli.BoolFlag{
			Name:    "skip-authentication",
			Usage:   "Skip authentication when pushing the image to the registry",
			Value:   false,
			EnvVars: []string{"3LV_SKIP_AUTHENTICATION"},
		},
	},
	Action: Build,
}

Functions

func Build

func Build(c *cli.Context) error

Types

type CSharpProjectFile

type CSharpProjectFile struct {
	XMLName       xml.Name `xml:"Project"`
	SDK           string   `xml:"Sdk,attr"`
	PropertyGroup PropertyGroup
}

type DockerfileVariablesDotnet

type DockerfileVariablesDotnet struct {
	CsprojFile       string // required
	AssemblyName     string // required
	BaseImageTag     string // required
	RuntimeBaseImage string // required
}

type DockerfileVariablesGo added in v0.4.1

type DockerfileVariablesGo struct {
	ModuleDirectory      string // required
	BuildContext         string // required
	MainPackageDirectory string // required
	IncludeFiles         []string
	IncludeDirectories   []string
}

type GenerateDockerfileOptions

type GenerateDockerfileOptions struct {
	GoMainPackageDirectory string
	BuildContext           string
	IncludeFiles           []string
	IncludeDirectories     []string
}

type PropertyGroup

type PropertyGroup struct {
	AssemblyName    string
	TargetFramework string
}

Jump to

Keyboard shortcuts

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