artifact

package
v0.29.1 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: Apache-2.0 Imports: 34 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SkipScan = errors.New("skip subsequent processes")
)

Functions

func ConfigRun added in v0.19.0

func ConfigRun(ctx *cli.Context) error

ConfigRun runs scan on config files

func Exit added in v0.28.0

func Exit(c Option, failedResults bool)

func FilesystemRun

func FilesystemRun(ctx *cli.Context) error

FilesystemRun runs scan on filesystem for language-specific dependencies and config files

func ImageRun

func ImageRun(ctx *cli.Context) error

ImageRun runs scan on container image

func RepositoryRun

func RepositoryRun(ctx *cli.Context) error

RepositoryRun runs scan on repository

func RootfsRun added in v0.20.0

func RootfsRun(ctx *cli.Context) error

RootfsRun runs scan on rootfs.

func Run added in v0.18.2

func Run(cliCtx *cli.Context, artifactType ArtifactType) error

Run performs artifact scanning

func SbomRun added in v0.25.0

func SbomRun(ctx *cli.Context) error

SbomRun runs generates sbom for image and package artifacts

func WithCacheClient added in v0.28.0

func WithCacheClient(c cache.Cache) runnerOption

WithCacheClient takes a custom cache implementation

Types

type ArtifactType added in v0.25.0

type ArtifactType string

type InitializeScanner

type InitializeScanner func(context.Context, ScannerConfig) (scanner.Scanner, func(), error)

InitializeScanner defines the initialize function signature of scanner

type Option added in v0.18.2

type Option struct {
	option.GlobalOption
	option.ArtifactOption
	option.DBOption
	option.ImageOption
	option.ReportOption
	option.CacheOption
	option.ConfigOption
	option.RemoteOption
	option.SbomOption
	option.SecretOption
	option.KubernetesOption
	option.OtherOption

	// We don't want to allow disabled analyzers to be passed by users,
	// but it differs depending on scanning modes.
	DisabledAnalyzers []analyzer.Type
}

Option holds the artifact options

func InitOption added in v0.28.0

func InitOption(ctx *cli.Context) (Option, error)

func NewOption added in v0.18.2

func NewOption(c *cli.Context) (Option, error)

NewOption is the factory method to return options

func (*Option) Init added in v0.18.2

func (c *Option) Init() error

Init initializes the artifact options

type Runner added in v0.28.0

type Runner interface {
	// ScanImage scans an image
	ScanImage(ctx context.Context, opt Option) (types.Report, error)
	// ScanFilesystem scans a filesystem
	ScanFilesystem(ctx context.Context, opt Option) (types.Report, error)
	// ScanRootfs scans rootfs
	ScanRootfs(ctx context.Context, opt Option) (types.Report, error)
	// ScanRepository scans repository
	ScanRepository(ctx context.Context, opt Option) (types.Report, error)
	// Filter filter a report
	Filter(ctx context.Context, opt Option, report types.Report) (types.Report, error)
	// Report a writes a report
	Report(opt Option, report types.Report) error
	// Close closes runner
	Close(ctx context.Context) error
}

func NewRunner added in v0.28.0

func NewRunner(cliOption Option, opts ...runnerOption) (Runner, error)

NewRunner initializes Runner that provides scanning functionalities. It is possible to return SkipScan and it must be handled by caller.

type ScannerConfig added in v0.27.1

type ScannerConfig struct {
	// e.g. image name and file path
	Target string

	// Cache
	ArtifactCache      cache.ArtifactCache
	LocalArtifactCache cache.LocalArtifactCache

	// Client/Server options
	RemoteOption client.ScannerOption

	// Artifact options
	ArtifactOption artifact.Option
}

Jump to

Keyboard shortcuts

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