annotations

package
v0.0.0-...-65129fa Latest Latest
Warning

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

Go to latest
Published: May 15, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ImageAnnotationPrefix = "quality.image.openshift.io"

ImageAnnotationPrefix is the prefix used for BlackDuckAnnotations in image annotations

View Source
var PodAnnotationPrefix = "quality.pod.openshift.io"

PodAnnotationPrefix is the prefix used for BlackDuckAnnotations in pod annotations

Functions

func CompareBlackDuckAnnotationJSON

func CompareBlackDuckAnnotationJSON(old string, new string) bool

CompareBlackDuckAnnotationJSON takes 2 strings that are marshaled BlackDuckAnnotations and compares them. Returns true if the unmarshaling is successful and the values are the same.

func CreateImageAnnotations

func CreateImageAnnotations(obj interface{}, name string, count int) map[string]string

CreateImageAnnotations returns a map of annotations from a ImageAnnotationData object

func CreateImageLabels

func CreateImageLabels(obj interface{}, name string, count int) map[string]string

CreateImageLabels returns a map of labels from a ImageAnnotationData object

func CreatePodAnnotations

func CreatePodAnnotations(obj interface{}) map[string]string

CreatePodAnnotations returns a map of annotations from a PodAnnotationData object

func CreatePodLabels

func CreatePodLabels(obj interface{}) map[string]string

CreatePodLabels returns a map of labels from a PodAnnotationData object func CreatePodLabels(podData *annotations.PodAnnotationData) map[string]string {

func MapContainsBlackDuckEntries

func MapContainsBlackDuckEntries(origMap map[string]string, newMap map[string]string) bool

MapContainsBlackDuckEntries returns true if the origMap contains all the important blackduck entries from the newMap

func RemoveRegistryInfo

func RemoveRegistryInfo(d string) string

RemoveRegistryInfo will take a string and return a string that removes any registry name information and replaces all / with .

func ShortenLabelContent

func ShortenLabelContent(data string) string

ShortenLabelContent will ensure the data is less than the 63 character limit and doesn't contain any characters that are not allowed

Types

type BlackDuckAnnotation

type BlackDuckAnnotation struct {
	Name           string         `json:"name"`
	Description    string         `json:"description"`
	Timestamp      string         `json:"timestamp"`
	Reference      string         `json:"reference"`
	ScannerVersion string         `json:"scannerVersion"`
	Compliant      bool           `json:"compliant"`
	Summary        []summaryEntry `json:"summary"`
}

BlackDuckAnnotation create annotations that correspond to the Openshift Container Security guide (https://docs.openshift.com/container-platform/3.9/security/container_content.html)

func CreateBlackDuckPolicyAnnotation

func CreateBlackDuckPolicyAnnotation(hasPolicyViolations bool, url string, policyCount int, version string) *BlackDuckAnnotation

CreateBlackDuckPolicyAnnotation returns an annotation containing policy violations

func CreateBlackDuckVulnerabilityAnnotation

func CreateBlackDuckVulnerabilityAnnotation(hasVulns bool, url string, vulnCount int, version string) *BlackDuckAnnotation

CreateBlackDuckVulnerabilityAnnotation returns an annotation containing vulnerabilities

func NewBlackDuckAnnotationFromJSON

func NewBlackDuckAnnotationFromJSON(data string) (*BlackDuckAnnotation, error)

NewBlackDuckAnnotationFromJSON takes a string that is a marshaled BlackDuckAnnotation struct and returns a BlackDuckAnnotation

func (*BlackDuckAnnotation) AsString

func (bda *BlackDuckAnnotation) AsString() string

AsString makes a map corresponding to the Openshift Container Security guide (https://docs.openshift.com/container-platform/3.9/security/container_content.html)

func (*BlackDuckAnnotation) Compare

func (bda *BlackDuckAnnotation) Compare(newBda *BlackDuckAnnotation) bool

Compare checks if the passed in BlackDuckAnnotation contains the same values while ignoring fields that will be different (like timestamp). Returns true if the values are the same, false otherwise

Jump to

Keyboard shortcuts

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