artifact

package
v0.57.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 40 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func Run added in v0.18.2

func Run(ctx context.Context, opts flag.Options, targetKind TargetKind) (err error)

Run performs artifact scanning

Types

type InitializeScanner

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

InitializeScanner defines the initialize function signature of scanner

type Runner added in v0.28.0

type Runner interface {
	// ScanImage scans an image
	ScanImage(ctx context.Context, opts flag.Options) (types.Report, error)
	// ScanFilesystem scans a filesystem
	ScanFilesystem(ctx context.Context, opts flag.Options) (types.Report, error)
	// ScanRootfs scans rootfs
	ScanRootfs(ctx context.Context, opts flag.Options) (types.Report, error)
	// ScanRepository scans repository
	ScanRepository(ctx context.Context, opts flag.Options) (types.Report, error)
	// ScanSBOM scans SBOM
	ScanSBOM(ctx context.Context, opts flag.Options) (types.Report, error)
	// ScanVM scans VM
	ScanVM(ctx context.Context, opts flag.Options) (types.Report, error)
	// Filter filter a report
	Filter(ctx context.Context, opts flag.Options, report types.Report) (types.Report, error)
	// Report a writes a report
	Report(ctx context.Context, opts flag.Options, report types.Report) error
	// Close closes runner
	Close(ctx context.Context) error
}

func NewRunner added in v0.28.0

func NewRunner(ctx context.Context, cliOptions flag.Options, 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 RunnerOption added in v0.53.0

type RunnerOption func(*runner)

func WithInitializeScanner added in v0.53.0

func WithInitializeScanner(f InitializeScanner) RunnerOption

WithInitializeScanner takes a custom scanner initialization function. It is useful when Trivy is imported as a library.

type ScannerConfig added in v0.27.1

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

	// Cache
	CacheOptions       cache.Options
	RemoteCacheOptions cache.RemoteOptions

	// Client/Server options
	ServerOption client.ScannerOption

	// Artifact options
	ArtifactOption artifact.Option
}

type TargetKind added in v0.30.0

type TargetKind string

TargetKind represents what kind of artifact Trivy scans

const (
	TargetContainerImage TargetKind = "image"
	TargetFilesystem     TargetKind = "fs"
	TargetRootfs         TargetKind = "rootfs"
	TargetRepository     TargetKind = "repo"
	TargetSBOM           TargetKind = "sbom"
	TargetVM             TargetKind = "vm"
)

Jump to

Keyboard shortcuts

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