Documentation ¶
Index ¶
- Constants
- func ApplyVersioningModel(model, projectVersion string) string
- func DetermineProjectCoordinates(nameTemplate, versionScheme string, gav Coordinates) (string, string)
- func DetermineProjectCoordinatesWithCustomVersion(nameTemplate, versionScheme, customVersion string, gav Coordinates) (string, string)
- type Artifact
- type Coordinates
- type Docker
- type GoMod
- type Gradle
- type HelmChart
- type INIfile
- type JSONfile
- type Maven
- func (m *Maven) GetArtifactID() (string, error)
- func (m *Maven) GetCoordinates() (Coordinates, error)
- func (m *Maven) GetGroupID() (string, error)
- func (m *Maven) GetPackaging() (string, error)
- func (m *Maven) GetVersion() (string, error)
- func (m *Maven) SetVersion(version string) error
- func (m *Maven) VersioningScheme() string
- type Options
- type Pip
- type PropertiesFile
- type Utils
- type Versionfile
- type YAMLDescriptor
- type YAMLfile
Constants ¶
const ( // NameRegex is used to match the pip descriptor artifact name NameRegex = "(?s)(.*)name=['\"](.*?)['\"](.*)" // VersionRegex is used to match the pip descriptor artifact version VersionRegex = "(?s)(.*)version=['\"](.*?)['\"](.*)" )
const ( // SchemeMajorVersion is the versioning scheme based on the major version only SchemeMajorVersion = `{{(split "." (split "-" .Version)._0)._0}}` // SchemeMajorMinorVersion is the versioning scheme based on the major version only SchemeMajorMinorVersion = `{{(split "." (split "-" .Version)._0)._0}}.{{(split "." (split "-" .Version)._0)._1}}` // SchemeSemanticVersion is the versioning scheme based on the major.minor.micro version SchemeSemanticVersion = `` /* 128-byte string literal not displayed */ // SchemeFullVersion is the versioning scheme based on the full version SchemeFullVersion = "{{.Version}}" )
const ( VersioningModelFull string = "full" VersioningModelSemantic string = "semantic" VersioningModelMajorMinor string = "major-minor" VersioningModelMajor string = "major" )
Variables ¶
This section is empty.
Functions ¶
func ApplyVersioningModel ¶ added in v1.140.0
func DetermineProjectCoordinates ¶ added in v1.38.0
func DetermineProjectCoordinates(nameTemplate, versionScheme string, gav Coordinates) (string, string)
DetermineProjectCoordinates resolves the coordinates of the project for use in 3rd party scan tools
func DetermineProjectCoordinatesWithCustomVersion ¶ added in v1.125.0
func DetermineProjectCoordinatesWithCustomVersion(nameTemplate, versionScheme, customVersion string, gav Coordinates) (string, string)
DetermineProjectCoordinatesWithCustomVersion resolves the coordinates of the project for use in 3rd party scan tools It considers a custom version if provided instead of using the GAV version adapted according to the versionScheme
Types ¶
type Artifact ¶
type Artifact interface { VersioningScheme() string GetVersion() (string, error) SetVersion(string) error GetCoordinates() (Coordinates, error) }
Artifact defines the versioning operations for various build tools
type Coordinates ¶ added in v1.38.0
type Coordinates struct { GroupID string `json:"groupId"` ArtifactID string `json:"artifactId"` Version string `json:"version"` Packaging string `json:"packaging"` BuildPath string `json:"buildPath"` URL string `json:"url"` PURL string `json:"purl"` }
Coordinates to address the artifact coordinates like groupId, artifactId, version and packaging
type Docker ¶ added in v1.23.0
type Docker struct {
// contains filtered or unexported fields
}
Docker defines an artifact based on a Dockerfile
func (*Docker) GetArtifactID ¶ added in v1.124.0
GetArtifactID returns the current ID of the artifact
func (*Docker) GetCoordinates ¶ added in v1.38.0
func (d *Docker) GetCoordinates() (Coordinates, error)
GetCoordinates returns the coordinates
func (*Docker) GetVersion ¶ added in v1.23.0
GetVersion returns the current version of the artifact
func (*Docker) SetVersion ¶ added in v1.23.0
SetVersion updates the version of the artifact
func (*Docker) VersioningScheme ¶ added in v1.23.0
VersioningScheme returns the relevant versioning scheme
type GoMod ¶ added in v1.51.0
type GoMod struct {
// contains filtered or unexported fields
}
GoMod utility to interact with Go Modules specific versioning
func (*GoMod) GetCoordinates ¶ added in v1.51.0
func (m *GoMod) GetCoordinates() (Coordinates, error)
GetCoordinates returns the go.mod build descriptor coordinates
func (*GoMod) GetVersion ¶ added in v1.51.0
GetVersion returns the go.mod descriptor version property
func (*GoMod) SetVersion ¶ added in v1.51.0
SetVersion sets the go.mod descriptor version property
func (*GoMod) VersioningScheme ¶ added in v1.51.0
VersioningScheme returns the relevant versioning scheme
type Gradle ¶ added in v1.51.0
type Gradle struct {
// contains filtered or unexported fields
}
Gradle defines a maven artifact used for versioning
func (*Gradle) GetArtifactID ¶ added in v1.51.0
GetArtifactID returns the current ID of the artifact
func (*Gradle) GetCoordinates ¶ added in v1.51.0
func (g *Gradle) GetCoordinates() (Coordinates, error)
GetCoordinates reads the coordinates from the maven pom.xml descriptor file
func (*Gradle) GetGroupID ¶ added in v1.216.0
GetGroupID returns the current ID of the Group
func (*Gradle) GetVersion ¶ added in v1.51.0
GetVersion returns the current version of the artifact
func (*Gradle) SetVersion ¶ added in v1.51.0
SetVersion updates the version of the artifact
func (*Gradle) VersioningScheme ¶ added in v1.51.0
VersioningScheme returns the relevant versioning scheme
type HelmChart ¶ added in v1.204.0
type HelmChart struct {
// contains filtered or unexported fields
}
JSONfile defines an artifact using a json file for versioning
func (*HelmChart) GetCoordinates ¶ added in v1.204.0
func (h *HelmChart) GetCoordinates() (Coordinates, error)
GetCoordinates returns the coordinates
func (*HelmChart) GetVersion ¶ added in v1.204.0
GetVersion returns the current version of the artifact with a JSON-based build descriptor
func (*HelmChart) SetVersion ¶ added in v1.204.0
SetVersion updates the version of the artifact with a JSON-based build descriptor
func (*HelmChart) VersioningScheme ¶ added in v1.204.0
VersioningScheme returns the relevant versioning scheme
type INIfile ¶ added in v1.23.0
type INIfile struct {
// contains filtered or unexported fields
}
INIfile defines an artifact using a ini file for versioning
func (*INIfile) GetCoordinates ¶ added in v1.38.0
func (i *INIfile) GetCoordinates() (Coordinates, error)
GetCoordinates returns the coordinates
func (*INIfile) GetVersion ¶ added in v1.23.0
GetVersion returns the current version of the artifact with a ini-file-based build descriptor
func (*INIfile) SetVersion ¶ added in v1.23.0
SetVersion updates the version of the artifact with a ini-file-based build descriptor
func (*INIfile) VersioningScheme ¶ added in v1.23.0
VersioningScheme returns the relevant versioning scheme
type JSONfile ¶ added in v1.23.0
type JSONfile struct {
// contains filtered or unexported fields
}
JSONfile defines an artifact using a json file for versioning
func (*JSONfile) GetCoordinates ¶ added in v1.38.0
func (j *JSONfile) GetCoordinates() (Coordinates, error)
GetCoordinates returns the coordinates
func (*JSONfile) GetVersion ¶ added in v1.23.0
GetVersion returns the current version of the artifact with a JSON-based build descriptor
func (*JSONfile) SetVersion ¶ added in v1.23.0
SetVersion updates the version of the artifact with a JSON-based build descriptor
func (*JSONfile) VersioningScheme ¶ added in v1.23.0
VersioningScheme returns the relevant versioning scheme
type Maven ¶
type Maven struct {
// contains filtered or unexported fields
}
Maven defines a maven artifact used for versioning
func (*Maven) GetArtifactID ¶ added in v1.38.0
GetArtifactID returns the current ID of the artifact
func (*Maven) GetCoordinates ¶ added in v1.38.0
func (m *Maven) GetCoordinates() (Coordinates, error)
GetCoordinates reads the coordinates from the maven pom.xml descriptor file
func (*Maven) GetGroupID ¶ added in v1.38.0
GetGroupID returns the current ID of the Group
func (*Maven) GetPackaging ¶ added in v1.38.0
GetPackaging returns the current ID of the Group
func (*Maven) GetVersion ¶
GetVersion returns the current version of the artifact
func (*Maven) SetVersion ¶
SetVersion updates the version of the artifact
func (*Maven) VersioningScheme ¶
VersioningScheme returns the relevant versioning scheme
type Options ¶
type Options struct { ProjectSettingsFile string DockerImage string GlobalSettingsFile string M2Path string Defines []string VersionSource string VersionSection string VersionField string VersioningScheme string HelmUpdateAppVersion bool CAPVersioningPreference string }
Options define build tool specific settings in order to properly retrieve e.g. the version / coordinates of an artifact
type Pip ¶ added in v1.38.0
type Pip struct {
// contains filtered or unexported fields
}
Pip utility to interact with Python specific versioning
func (*Pip) GetCoordinates ¶ added in v1.38.0
func (p *Pip) GetCoordinates() (Coordinates, error)
GetCoordinates returns the pip build descriptor coordinates
func (*Pip) GetVersion ¶ added in v1.38.0
GetVersion returns the Pip descriptor version property
func (*Pip) SetVersion ¶ added in v1.38.0
SetVersion sets the Pip descriptor version property
func (*Pip) VersioningScheme ¶ added in v1.38.0
VersioningScheme returns the relevant versioning scheme
type PropertiesFile ¶ added in v1.106.0
type PropertiesFile struct {
// contains filtered or unexported fields
}
PropertiesFile defines an artifact using a properties file for versioning
func (*PropertiesFile) GetCoordinates ¶ added in v1.106.0
func (p *PropertiesFile) GetCoordinates() (Coordinates, error)
GetCoordinates returns the coordinates
func (*PropertiesFile) GetVersion ¶ added in v1.106.0
func (p *PropertiesFile) GetVersion() (string, error)
GetVersion returns the current version of the artifact with a ini-file-based build descriptor
func (*PropertiesFile) SetVersion ¶ added in v1.106.0
func (p *PropertiesFile) SetVersion(version string) error
SetVersion updates the version of the artifact with a ini-file-based build descriptor
func (*PropertiesFile) VersioningScheme ¶ added in v1.106.0
func (p *PropertiesFile) VersioningScheme() string
VersioningScheme returns the relevant versioning scheme
type Utils ¶ added in v1.107.0
type Utils interface { Stdout(out io.Writer) Stderr(err io.Writer) RunExecutable(e string, p ...string) error DownloadFile(url, filename string, header http.Header, cookies []*http.Cookie) error Glob(pattern string) (matches []string, err error) FileExists(filename string) (bool, error) Copy(src, dest string) (int64, error) MkdirAll(path string, perm os.FileMode) error FileWrite(path string, content []byte, perm os.FileMode) error FileRead(path string) ([]byte, error) FileRemove(path string) error }
Utils defines the versioning operations for various build tools
type Versionfile ¶ added in v1.23.0
type Versionfile struct {
// contains filtered or unexported fields
}
Versionfile defines an artifact containing the version in a file, e.g. VERSION
func (*Versionfile) GetCoordinates ¶ added in v1.38.0
func (v *Versionfile) GetCoordinates() (Coordinates, error)
GetCoordinates returns the coordinates
func (*Versionfile) GetVersion ¶ added in v1.23.0
func (v *Versionfile) GetVersion() (string, error)
GetVersion returns the current version of the artifact
func (*Versionfile) SetVersion ¶ added in v1.23.0
func (v *Versionfile) SetVersion(version string) error
SetVersion updates the version of the artifact
func (*Versionfile) VersioningScheme ¶ added in v1.23.0
func (v *Versionfile) VersioningScheme() string
VersioningScheme returns the relevant versioning scheme
type YAMLDescriptor ¶ added in v1.38.0
YAMLDescriptor holds the unique identifier combination for an artifact
type YAMLfile ¶ added in v1.23.0
type YAMLfile struct {
// contains filtered or unexported fields
}
YAMLfile defines an artifact using a yaml file for versioning
func (*YAMLfile) GetArtifactID ¶ added in v1.38.0
GetArtifactID returns the current ID of the artifact
func (*YAMLfile) GetCoordinates ¶ added in v1.38.0
func (y *YAMLfile) GetCoordinates() (Coordinates, error)
GetCoordinates returns the coordinates
func (*YAMLfile) GetVersion ¶ added in v1.23.0
GetVersion returns the current version of the artifact with a YAML-based build descriptor
func (*YAMLfile) SetVersion ¶ added in v1.23.0
SetVersion updates the version of the artifact with a YAML-based build descriptor
func (*YAMLfile) VersioningScheme ¶ added in v1.23.0
VersioningScheme returns the relevant versioning scheme