entities

package
v0.0.0-...-e472556 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: Apache-2.0 Imports: 9 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsEqualDependencySlices

func IsEqualDependencySlices(actual, other []Dependency) (bool, error)

func IsEqualModuleSlices

func IsEqualModuleSlices(actual, other []Module) (bool, error)

Types

type AffectedIssue

type AffectedIssue struct {
	Key        string `json:"key,omitempty"`
	Url        string `json:"url,omitempty"`
	Summary    string `json:"summary,omitempty"`
	Aggregated bool   `json:"aggregated,omitempty"`
}

type Agent

type Agent struct {
	Name    string `json:"name,omitempty"`
	Version string `json:"version,omitempty"`
}

type Artifact

type Artifact struct {
	Name string `json:"name,omitempty"`
	Type string `json:"type,omitempty"`
	Path string `json:"path,omitempty"`
	Checksum
}

type BuildInfo

type BuildInfo struct {
	Name          string   `json:"name,omitempty"`
	Number        string   `json:"number,omitempty"`
	Agent         *Agent   `json:"agent,omitempty"`
	BuildAgent    *Agent   `json:"buildAgent,omitempty"`
	Modules       []Module `json:"modules,omitempty"`
	Started       string   `json:"started,omitempty"`
	Properties    Env      `json:"properties,omitempty"`
	Principal     string   `json:"artifactoryPrincipal,omitempty"`
	BuildUrl      string   `json:"url,omitempty"`
	Issues        *Issues  `json:"issues,omitempty"`
	PluginVersion string   `json:"artifactoryPluginVersion,omitempty"`
	VcsList       []Vcs    `json:"vcs,omitempty"`
}

func New

func New() *BuildInfo

func (*BuildInfo) Append

func (targetBuildInfo *BuildInfo) Append(buildInfo *BuildInfo)

Append the modules of the received build info to this build info. If the two build info instances contain modules with identical names, these modules are merged. When merging the modules, the artifacts and dependencies remain unique according to their checksum.

func (*BuildInfo) ExcludeEnv

func (targetBuildInfo *BuildInfo) ExcludeEnv(patterns ...string) error

ExcludeEnv gets one or more wildcard patterns and filters out environment variables that match at least one of them.

func (*BuildInfo) IncludeEnv

func (targetBuildInfo *BuildInfo) IncludeEnv(patterns ...string) error

IncludeEnv gets one or more wildcard patterns and filters out environment variables that don't match any of them.

func (*BuildInfo) SetAgentName

func (targetBuildInfo *BuildInfo) SetAgentName(agentName string)

func (*BuildInfo) SetAgentVersion

func (targetBuildInfo *BuildInfo) SetAgentVersion(agentVersion string)

func (*BuildInfo) SetBuildAgentVersion

func (targetBuildInfo *BuildInfo) SetBuildAgentVersion(buildAgentVersion string)

func (*BuildInfo) SetPluginVersion

func (targetBuildInfo *BuildInfo) SetPluginVersion(pluginVersion string)

func (*BuildInfo) ToCycloneDxBom

func (targetBuildInfo *BuildInfo) ToCycloneDxBom() (*cdx.BOM, error)

type Checksum

type Checksum struct {
	Sha1   string `json:"sha1,omitempty"`
	Md5    string `json:"md5,omitempty"`
	Sha256 string `json:"sha256,omitempty"`
}

func (*Checksum) IsEmpty

func (c *Checksum) IsEmpty() bool

func (*Checksum) IsEqual

func (c *Checksum) IsEqual(other Checksum) (bool, error)

If the 'other' checksum matches the current one, return true. 'other' checksum may contain regex values for sha1, sha256 and md5.

type Dependency

type Dependency struct {
	Id          string     `json:"id,omitempty"`
	Type        string     `json:"type,omitempty"`
	Scopes      []string   `json:"scopes,omitempty"`
	RequestedBy [][]string `json:"requestedBy,omitempty"`
	Checksum
}

func (*Dependency) IsEqual

func (d *Dependency) IsEqual(other Dependency) (bool, error)

If the 'other' Dependency matches the current one, return true. 'other' Dependency may contain regex values for Id and Checksum.

func (*Dependency) NodeHasLoop

func (d *Dependency) NodeHasLoop() bool

func (*Dependency) UpdateRequestedBy

func (d *Dependency) UpdateRequestedBy(parentId string, parentRequestedBy [][]string)

type Env

type Env map[string]string

type General

type General struct {
	Timestamp time.Time `json:"Timestamp,omitempty"`
}

type Issues

type Issues struct {
	Tracker                *Tracker        `json:"tracker,omitempty"`
	AggregateBuildIssues   bool            `json:"aggregateBuildIssues,omitempty"`
	AggregationBuildStatus string          `json:"aggregationBuildStatus,omitempty"`
	AffectedIssues         []AffectedIssue `json:"affectedIssues,omitempty"`
}

type Module

type Module struct {
	Type              ModuleType   `json:"type,omitempty"`
	Properties        interface{}  `json:"properties,omitempty"`
	Id                string       `json:"id,omitempty"`
	Artifacts         []Artifact   `json:"artifacts,omitempty"`
	ExcludedArtifacts []Artifact   `json:"excludedArtifacts,omitempty"`
	Dependencies      []Dependency `json:"dependencies,omitempty"`
	// Used in aggregated builds - this field stores the checksums of the referenced build-info JSON.
	Checksum
}

type ModuleType

type ModuleType string
const (
	TimeFormat           = "2006-01-02T15:04:05.000-0700"
	BuildInfoEnvPrefix   = "buildInfo.env."
	RequestedByMaxLength = 15

	// Build type
	Build ModuleType = "build"

	// Package managers types
	Generic   ModuleType = "generic"
	Maven     ModuleType = "maven"
	Gradle    ModuleType = "gradle"
	Docker    ModuleType = "docker"
	Npm       ModuleType = "npm"
	Nuget     ModuleType = "nuget"
	Go        ModuleType = "go"
	Python    ModuleType = "python"
	Terraform ModuleType = "terraform"
)

type Partial

type Partial struct {
	ModuleType   ModuleType   `json:"Type,omitempty"`
	Artifacts    []Artifact   `json:"Artifacts,omitempty"`
	Dependencies []Dependency `json:"Dependencies,omitempty"`
	Env          Env          `json:"Env,omitempty"`
	Timestamp    int64        `json:"Timestamp,omitempty"`
	ModuleId     string       `json:"ModuleId,omitempty"`
	Issues       *Issues      `json:"Issues,omitempty"`
	VcsList      []Vcs        `json:"vcs,omitempty"`
	Checksum
}

type Partials

type Partials []*Partial

func (Partials) Len

func (partials Partials) Len() int

func (Partials) Less

func (partials Partials) Less(i, j int) bool

func (Partials) Swap

func (partials Partials) Swap(i, j int)

type PublishedBuildInfo

type PublishedBuildInfo struct {
	Uri       string    `json:"uri,omitempty"`
	BuildInfo BuildInfo `json:"buildInfo,omitempty"`
}

PublishedBuildInfo represents the response structure returned from Artifactory when getting a build-info.

type Tracker

type Tracker struct {
	Name    string `json:"name,omitempty"`
	Version string `json:"version,omitempty"`
}

type Vcs

type Vcs struct {
	Url      string `json:"url,omitempty"`
	Revision string `json:"revision,omitempty"`
	Branch   string `json:"branch,omitempty"`
	Message  string `json:"message,omitempty"`
}

Jump to

Keyboard shortcuts

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