detect

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TODO: maybe makes sense to put detect script under ~/blackduck as well (other than the bootstrap problem)
	DefaultDetectDownloadFilePath = "./detect.sh"
	DefaultDetectURL              = "https://detect.synopsys.com/detect.sh"
	WindowsDetectURL              = "https://detect.synopsys.com/detect.ps1"
	// Modified from here: https://github.com/blackducksoftware/blackduck-docker-inspector/blob/9.1.1/deployment/docker/runDetectAgainstDockerServices/setup.sh
	// TODO: keep sync'd to runDetectAgainstDockerServices.sh and/or delete that bash script
	RunDetectAgainstDockerServicesBashScript = `` /* 5565-byte string literal not displayed */

)

Variables

View Source
var (
	DefaultDetectBlackduckDirectory = fmt.Sprintf("%s/blackduck", util.GetHomeDir())
	DefaultToolsDirectory           = fmt.Sprintf("%s/tools", DefaultDetectBlackduckDirectory)
)

Functions

func FindLocationFromStatus

func FindLocationFromStatus(status *Status) []string

func FindScanStatusFile

func FindScanStatusFile(path string) (string, error)

Types

type Client

type Client struct {
	DetectPath      string
	DetectURL       string
	RestyClient     *resty.Client
	DockerCLIClient *docker.DockerCLIClient
}

func NewClient

func NewClient(detectFilePath, detectURL string) *Client

func NewDefaultClient

func NewDefaultClient() *Client

func (*Client) DownloadDetect

func (c *Client) DownloadDetect() error

func (*Client) DownloadDetectIfNotExists

func (c *Client) DownloadDetectIfNotExists() error

func (*Client) GetAllSquashedScanFlags

func (c *Client) GetAllSquashedScanFlags(squashedImageTarFilePath, fullImageName string) string

GetAllSquashedScanFlags [squashed] docker-inspector + signature + binary

func (*Client) GetAllUnsquashedScanFlags

func (c *Client) GetAllUnsquashedScanFlags(unsquashedImageTarFilePath string) string

GetAllUnsquashedScanFlags [unsquashed] docker-inspector + signature + binary

func (*Client) GetBinaryAndSignatureScanFlags

func (c *Client) GetBinaryAndSignatureScanFlags(imageTarFilePath string) string

GetBinaryAndSignatureScanFlags signature + binary scanners

func (*Client) GetBinaryScanOnlyFlags

func (c *Client) GetBinaryScanOnlyFlags(imageTarFilePath string) string

GetBinaryScanOnlyFlags binary scanner only

func (*Client) GetCodeLocationNameFlag

func (c *Client) GetCodeLocationNameFlag(codeLocationName string) string

GetCodeLocationNameFlag sets up the code location name flag

func (*Client) GetConcurrentDockerInspectorScanFlags

func (c *Client) GetConcurrentDockerInspectorScanFlags() string

GetConcurrentDockerInspectorScanFlags: ask inspector not to cleanup services it spins up to re-use; must wait a bit after first scan and then run concurrently TODO: not working, check application properties to see if flag actually gets passed

https://synopsys.atlassian.net/wiki/spaces/INTDOCS/pages/760381459/Concurrent+Execution

func (*Client) GetDetectDockerImageDefaultScanFlags

func (c *Client) GetDetectDockerImageDefaultScanFlags(fullImageName string) string

GetDetectDockerImageDefaultScanFlags: this is the default scan that detect invokes (which is just docker-inspector + squashed signature scanner)

func (*Client) GetDockerInspectorAndSignatureOnlyScanFlags

func (c *Client) GetDockerInspectorAndSignatureOnlyScanFlags(fullImageName string) string

GetDockerInspectorAndSignatureOnlyScanFlags: explicitly only run DOCKER,SIGNATURE_SCAN scans for specified image

func (*Client) GetDockerInspectorScanOnlyFlags

func (c *Client) GetDockerInspectorScanOnlyFlags(fullImageName string) string

GetDockerInspectorScanOnlyFlags docker-inspector only

func (*Client) GetProjectNameFlag

func (c *Client) GetProjectNameFlag(projectName string) string

GetProjectNameFlag sets up the project name flag

func (*Client) GetProjectVersionNameFlag

func (c *Client) GetProjectVersionNameFlag(projectVersionName string) string

GetProjectVersionNameFlag sets up the project version name flag

func (*Client) GetSignatureScanOnlyFlags

func (c *Client) GetSignatureScanOnlyFlags(imageTarFilePath string) string

GetSignatureScanOnlyFlags signature scanner only

func (*Client) RunImageScan

func (c *Client) RunImageScan(fullImageName, projectName, imageName, imageTag, outputDirName, userSpecifiedDetectFlags string) error

func (*Client) SetupPersistentDockerInspectorServices

func (c *Client) SetupPersistentDockerInspectorServices() error

SetupPersistentDockerInspectorServices: sets up persistent docker services on host; goes together with GetPersistentDockerInspectorServicesFlags https://github.com/blackducksoftware/blackduck-docker-inspector/blob/9.1.1/deployment/docker/runDetectAgainstDockerServices/setup.sh

func (*Client) StopAndCleanupPersistentDockerInspectorServices

func (c *Client) StopAndCleanupPersistentDockerInspectorServices() error

type Status

type Status struct {
	FormatVersion  string        `json:"formatVersion"`
	DetectVersion  string        `json:"detectVersion"`
	ProjectName    string        `json:"projectName"`
	ProjectVersion string        `json:"projectVersion"`
	Detectors      []interface{} `json:"detectors"`
	Status         []struct {
		Key    string `json:"key"`
		Status string `json:"status"`
	} `json:"status"`
	Issues  []interface{} `json:"issues"`
	Results []struct {
		Location string `json:"location"`
		Message  string `json:"message"`
	} `json:"results"`
	UnrecognizedPaths struct {
	} `json:"unrecognizedPaths"`
	CodeLocations []struct {
		CodeLocationName string `json:"codeLocationName"`
	} `json:"codeLocations"`
}

func ParseStatusJSONFile

func ParseStatusJSONFile(path string) (*Status, error)

Jump to

Keyboard shortcuts

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