versioning

package
v1.227.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
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=['\"](.*?)['\"](.*)"
)
View Source
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}}"
)
View Source
const (
	VersioningModelFull       string = "full"
	VersioningModelSemantic   string = "semantic"
	VersioningModelMajorMinor string = "major-minor"
	VersioningModelMajor      string = "major"
)

Variables

This section is empty.

Functions

func ApplyVersioningModel

func ApplyVersioningModel(model, projectVersion string) string

func DetermineProjectCoordinates

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

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

func GetArtifact

func GetArtifact(buildTool, buildDescriptorFilePath string, opts *Options, utils Utils) (Artifact, error)

GetArtifact returns the build tool specific implementation for retrieving version, etc. of an artifact

type Coordinates

type Coordinates struct {
	GroupID    string
	ArtifactID string
	Version    string
	Packaging  string
}

Coordinates to address the artifact coordinates like groupId, artifactId, version and packaging

type Docker

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

Docker defines an artifact based on a Dockerfile

func (*Docker) GetArtifactID

func (d *Docker) GetArtifactID() (string, error)

GetArtifactID returns the current ID of the artifact

func (*Docker) GetCoordinates

func (d *Docker) GetCoordinates() (Coordinates, error)

GetCoordinates returns the coordinates

func (*Docker) GetVersion

func (d *Docker) GetVersion() (string, error)

GetVersion returns the current version of the artifact

func (*Docker) SetVersion

func (d *Docker) SetVersion(version string) error

SetVersion updates the version of the artifact

func (*Docker) VersioningScheme

func (d *Docker) VersioningScheme() string

VersioningScheme returns the relevant versioning scheme

type GoMod

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

GoMod utility to interact with Go Modules specific versioning

func (*GoMod) GetCoordinates

func (m *GoMod) GetCoordinates() (Coordinates, error)

GetCoordinates returns the go.mod build descriptor coordinates

func (*GoMod) GetVersion

func (m *GoMod) GetVersion() (string, error)

GetVersion returns the go.mod descriptor version property

func (*GoMod) SetVersion

func (m *GoMod) SetVersion(v string) error

SetVersion sets the go.mod descriptor version property

func (*GoMod) VersioningScheme

func (m *GoMod) VersioningScheme() string

VersioningScheme returns the relevant versioning scheme

type Gradle

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

Gradle defines a maven artifact used for versioning

func (*Gradle) GetArtifactID

func (g *Gradle) GetArtifactID() (string, error)

GetArtifactID returns the current ID of the artifact

func (*Gradle) GetCoordinates

func (g *Gradle) GetCoordinates() (Coordinates, error)

GetCoordinates reads the coordinates from the maven pom.xml descriptor file

func (*Gradle) GetGroupID

func (g *Gradle) GetGroupID() (string, error)

GetGroupID returns the current ID of the Group

func (*Gradle) GetVersion

func (g *Gradle) GetVersion() (string, error)

GetVersion returns the current version of the artifact

func (*Gradle) SetVersion

func (g *Gradle) SetVersion(version string) error

SetVersion updates the version of the artifact

func (*Gradle) VersioningScheme

func (g *Gradle) VersioningScheme() string

VersioningScheme returns the relevant versioning scheme

type HelmChart

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

JSONfile defines an artifact using a json file for versioning

func (*HelmChart) GetCoordinates

func (h *HelmChart) GetCoordinates() (Coordinates, error)

GetCoordinates returns the coordinates

func (*HelmChart) GetVersion

func (h *HelmChart) GetVersion() (string, error)

GetVersion returns the current version of the artifact with a JSON-based build descriptor

func (*HelmChart) SetVersion

func (h *HelmChart) SetVersion(version string) error

SetVersion updates the version of the artifact with a JSON-based build descriptor

func (*HelmChart) VersioningScheme

func (h *HelmChart) VersioningScheme() string

VersioningScheme returns the relevant versioning scheme

type INIfile

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

INIfile defines an artifact using a ini file for versioning

func (*INIfile) GetCoordinates

func (i *INIfile) GetCoordinates() (Coordinates, error)

GetCoordinates returns the coordinates

func (*INIfile) GetVersion

func (i *INIfile) GetVersion() (string, error)

GetVersion returns the current version of the artifact with a ini-file-based build descriptor

func (*INIfile) SetVersion

func (i *INIfile) SetVersion(version string) error

SetVersion updates the version of the artifact with a ini-file-based build descriptor

func (*INIfile) VersioningScheme

func (i *INIfile) VersioningScheme() string

VersioningScheme returns the relevant versioning scheme

type JSONfile

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

JSONfile defines an artifact using a json file for versioning

func (*JSONfile) GetCoordinates

func (j *JSONfile) GetCoordinates() (Coordinates, error)

GetCoordinates returns the coordinates

func (*JSONfile) GetVersion

func (j *JSONfile) GetVersion() (string, error)

GetVersion returns the current version of the artifact with a JSON-based build descriptor

func (*JSONfile) SetVersion

func (j *JSONfile) SetVersion(version string) error

SetVersion updates the version of the artifact with a JSON-based build descriptor

func (*JSONfile) VersioningScheme

func (j *JSONfile) VersioningScheme() string

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

func (m *Maven) GetArtifactID() (string, error)

GetArtifactID returns the current ID of the artifact

func (*Maven) GetCoordinates

func (m *Maven) GetCoordinates() (Coordinates, error)

GetCoordinates reads the coordinates from the maven pom.xml descriptor file

func (*Maven) GetGroupID

func (m *Maven) GetGroupID() (string, error)

GetGroupID returns the current ID of the Group

func (*Maven) GetPackaging

func (m *Maven) GetPackaging() (string, error)

GetPackaging returns the current ID of the Group

func (*Maven) GetVersion

func (m *Maven) GetVersion() (string, error)

GetVersion returns the current version of the artifact

func (*Maven) SetVersion

func (m *Maven) SetVersion(version string) error

SetVersion updates the version of the artifact

func (*Maven) VersioningScheme

func (m *Maven) VersioningScheme() string

VersioningScheme returns the relevant versioning scheme

type Options

type Options struct {
	ProjectSettingsFile  string
	DockerImage          string
	GlobalSettingsFile   string
	M2Path               string
	VersionSource        string
	VersionSection       string
	VersionField         string
	VersioningScheme     string
	HelmUpdateAppVersion bool
}

Options define build tool specific settings in order to properly retrieve e.g. the version / coordinates of an artifact

type Pip

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

Pip utility to interact with Python specific versioning

func (*Pip) GetCoordinates

func (p *Pip) GetCoordinates() (Coordinates, error)

GetCoordinates returns the pip build descriptor coordinates

func (*Pip) GetVersion

func (p *Pip) GetVersion() (string, error)

GetVersion returns the Pip descriptor version property

func (*Pip) SetVersion

func (p *Pip) SetVersion(v string) error

SetVersion sets the Pip descriptor version property

func (*Pip) VersioningScheme

func (p *Pip) VersioningScheme() string

VersioningScheme returns the relevant versioning scheme

type PropertiesFile

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

PropertiesFile defines an artifact using a properties file for versioning

func (*PropertiesFile) GetCoordinates

func (p *PropertiesFile) GetCoordinates() (Coordinates, error)

GetCoordinates returns the coordinates

func (*PropertiesFile) GetVersion

func (p *PropertiesFile) GetVersion() (string, error)

GetVersion returns the current version of the artifact with a ini-file-based build descriptor

func (*PropertiesFile) SetVersion

func (p *PropertiesFile) SetVersion(version string) error

SetVersion updates the version of the artifact with a ini-file-based build descriptor

func (*PropertiesFile) VersioningScheme

func (p *PropertiesFile) VersioningScheme() string

VersioningScheme returns the relevant versioning scheme

type Utils

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

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

Versionfile defines an artifact containing the version in a file, e.g. VERSION

func (*Versionfile) GetCoordinates

func (v *Versionfile) GetCoordinates() (Coordinates, error)

GetCoordinates returns the coordinates

func (*Versionfile) GetVersion

func (v *Versionfile) GetVersion() (string, error)

GetVersion returns the current version of the artifact

func (*Versionfile) SetVersion

func (v *Versionfile) SetVersion(version string) error

SetVersion updates the version of the artifact

func (*Versionfile) VersioningScheme

func (v *Versionfile) VersioningScheme() string

VersioningScheme returns the relevant versioning scheme

type YAMLDescriptor

type YAMLDescriptor struct {
	GroupID    string
	ArtifactID string
	Version    string
}

YAMLDescriptor holds the unique identifier combination for an artifact

type YAMLfile

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

YAMLfile defines an artifact using a yaml file for versioning

func (*YAMLfile) GetArtifactID

func (y *YAMLfile) GetArtifactID() (string, error)

GetArtifactID returns the current ID of the artifact

func (*YAMLfile) GetCoordinates

func (y *YAMLfile) GetCoordinates() (Coordinates, error)

GetCoordinates returns the coordinates

func (*YAMLfile) GetVersion

func (y *YAMLfile) GetVersion() (string, error)

GetVersion returns the current version of the artifact with a YAML-based build descriptor

func (*YAMLfile) SetVersion

func (y *YAMLfile) SetVersion(version string) error

SetVersion updates the version of the artifact with a YAML-based build descriptor

func (*YAMLfile) VersioningScheme

func (y *YAMLfile) VersioningScheme() string

VersioningScheme returns the relevant versioning scheme

Jump to

Keyboard shortcuts

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