scanner

package
v2.2.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2019 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunScanner

func RunScanner(configPath string, stop <-chan struct{})

RunScanner ...

Types

type BlackDuckConfig

type BlackDuckConfig struct {
	ConnectionsEnvironmentVariableName string
	TLSVerification                    bool
}

BlackDuckConfig stores the Black Duck configuration

type Config

type Config struct {
	BlackDuck   *BlackDuckConfig
	ImageFacade *ImageFacadeConfig
	Perceptor   *PerceptorConfig
	Scanner     *ScannerConfig

	LogLevel string
}

Config stores the input scanner configurqtion

func GetConfig

func GetConfig(configPath string) (*Config, error)

GetConfig returns the input configuration for Scanner pod

func (*Config) GetLogLevel

func (config *Config) GetLogLevel() (log.Level, error)

GetLogLevel return the log level

type Host

type Host struct {
	Scheme   string `json:"scheme"`
	Domain   string `json:"domain"` // it can be domain name or ip address
	Port     int    `json:"port"`
	User     string `json:"user"`
	Password string `json:"password"`
}

Host configures the Black Duck hosts

type ImageFacadeClient

type ImageFacadeClient struct {
	ImageFacadeHost string
	ImageFacadePort int
	// contains filtered or unexported fields
}

ImageFacadeClient ...

func NewImageFacadeClient

func NewImageFacadeClient(imageFacadeHost string, imageFacadePort int) *ImageFacadeClient

NewImageFacadeClient ...

func (*ImageFacadeClient) PullImage

func (ifp *ImageFacadeClient) PullImage(image *common.Image) error

PullImage ...

type ImageFacadeClientInterface

type ImageFacadeClientInterface interface {
	PullImage(image *common.Image) error
}

ImageFacadeClientInterface ...

type ImageFacadeConfig

type ImageFacadeConfig struct {
	Host string
	Port int
}

ImageFacadeConfig stores the image facade configuration

func (*ImageFacadeConfig) GetHost

func (ifc *ImageFacadeConfig) GetHost() string

GetHost return the image facade host

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager ...

func NewManager

func NewManager(config *Config, stop <-chan struct{}) (*Manager, error)

NewManager return the manager type

func (*Manager) StartRequestingScanJobs

func (sm *Manager) StartRequestingScanJobs()

StartRequestingScanJobs will start asking for work

type OSType

type OSType int

OSType describes the state of an image in perceptor

const (
	OSTypeLinux OSType = iota
	OSTypeMac   OSType = iota
)

.....

func (OSType) String

func (t OSType) String() string

String .....

type PerceptorClient

type PerceptorClient struct {
	Resty *resty.Client
	Host  string
	Port  int
}

PerceptorClient stores the Perceptor configurations

func NewPerceptorClient

func NewPerceptorClient(host string, port int) *PerceptorClient

NewPerceptorClient return the Perceptor client configuration

func (*PerceptorClient) GetNextImage

func (pc *PerceptorClient) GetNextImage() (*api.NextImage, error)

GetNextImage return the next image or artifact from the queue

func (*PerceptorClient) PostFinishedScan

func (pc *PerceptorClient) PostFinishedScan(scan *api.FinishedScanClientJob) error

PostFinishedScan updates the perceptor about the Black Duck scan

type PerceptorClientInterface

type PerceptorClientInterface interface {
	GetNextImage() (*api.NextImage, error)
	PostFinishedScan(scan *api.FinishedScanClientJob) error
}

PerceptorClientInterface provides an interface for accessing the perceptor

type PerceptorConfig

type PerceptorConfig struct {
	Host string
	Port int
}

PerceptorConfig stores the perceptor client configuration

type ScanClient

type ScanClient struct {
	// contains filtered or unexported fields
}

ScanClient implements ScanClientInterface using the Black Duck hub and scan client programs.

func NewScanClient

func NewScanClient(tlsVerification bool) (*ScanClient, error)

NewScanClient requires hub login credentials

func (*ScanClient) Scan

func (sc *ScanClient) Scan(scheme string, host string, port int, username string, password string, path string, projectName string, versionName string, scanName string) error

Scan executes the Black Duck scan for the input artifact

func (*ScanClient) ScanSh

func (sc *ScanClient) ScanSh(hubScheme string, host string, port int, username string, password string, path string, projectName string, versionName string, scanName string) error

ScanSh invokes scan.cli.sh example:

BD_HUB_PASSWORD=??? ./bin/scan.cli.sh --host ??? --port 443 --scheme https --username sysadmin --insecure --name ??? --release ??? --project ??? ???.tar

type ScanClientInfo

type ScanClientInfo struct {
	HubVersion string
	RootPath   string
	OSType     OSType
}

ScanClientInfo ...

func DownloadScanClient

func DownloadScanClient(osType OSType, cliRootPath string, hubScheme string, hubHost string, hubUser string, hubPassword string, hubPort int, timeout time.Duration) (*ScanClientInfo, error)

DownloadScanClient downloads the Black Duck scan client

func NewScanClientInfo

func NewScanClientInfo(hubVersion string, rootPath string, osType OSType) *ScanClientInfo

NewScanClientInfo ...

func (*ScanClientInfo) ScanCliImplJarPath

func (sci *ScanClientInfo) ScanCliImplJarPath() string

ScanCliImplJarPath ...

func (*ScanClientInfo) ScanCliJarPath

func (sci *ScanClientInfo) ScanCliJarPath() string

ScanCliJarPath ...

func (*ScanClientInfo) ScanCliJavaPath

func (sci *ScanClientInfo) ScanCliJavaPath() string

ScanCliJavaPath ...

func (*ScanClientInfo) ScanCliShPath

func (sci *ScanClientInfo) ScanCliShPath() string

ScanCliShPath ...

func (*ScanClientInfo) ScanCliZipPath

func (sci *ScanClientInfo) ScanCliZipPath() string

ScanCliZipPath ...

type ScanClientInterface

type ScanClientInterface interface {
	Scan(scheme string, host string, port int, username string, password string, path string, projectName string, versionName string, scanName string) error
}

ScanClientInterface ...

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

Scanner stores the scanner configurations

func NewScanner

func NewScanner(ifClient ImageFacadeClientInterface, scanClient ScanClientInterface, imageDirectory string, stop <-chan struct{}) *Scanner

NewScanner return the Scanner configurations

func (*Scanner) ScanFile

func (scanner *Scanner) ScanFile(scheme string, host string, port int, username string, password string, path string, blackDuckProjectName string, blackDuckVersionName string, blackDuckScanName string) error

ScanFile runs the scan client against a single file

func (*Scanner) ScanFullDockerImage

func (scanner *Scanner) ScanFullDockerImage(apiImage *api.ImageSpec) error

ScanFullDockerImage runs the scan client on a full tar from 'docker export'

type ScannerConfig

type ScannerConfig struct {
	ImageDirectory       string
	Port                 int
	ClientTimeoutSeconds int
}

ScannerConfig stores the scanner configuration

func (*ScannerConfig) GetImageDirectory

func (config *ScannerConfig) GetImageDirectory() string

GetImageDirectory return the image directory to store the pulled artifactory

Jump to

Keyboard shortcuts

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