utils

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: Apache-2.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

View Source
const IsoDateTimeLayout = "2006-01-02T15:04:05.000-0700"

Variables

This section is empty.

Functions

func CreateDownloadConfiguration added in v0.2.2

func CreateDownloadConfiguration(c *components.Context) (downloadConfiguration *artifactoryUtils.DownloadConfiguration, err error)

func CreateUploadConfiguration added in v0.2.2

func CreateUploadConfiguration(c *components.Context) (uploadConfiguration *artifactoryUtils.UploadConfiguration, err error)

func GetDotGit

func GetDotGit(providedDotGitPath string) (string, error)

GetDotGit Looks for the .git directory in the current directory and its parents.

func GetLastBuildLink(serverDetails *utilsconfig.ServerDetails, buildConfiguration *build.BuildConfiguration) (string, error)

func GetPlainGitLogFromPreviousBuild

func GetPlainGitLogFromPreviousBuild(serverDetails *utilsconfig.ServerDetails, buildConfiguration *build.BuildConfiguration, gitDetails GitLogDetails) (string, error)

GetPlainGitLogFromPreviousBuild Returns the git log output for the VCS revision for the previous build in position previousBuildPos. For previousBuildPos 0 the latest build is returned, for an input 1 the latest -1 is returned, etc. previousBuildPos must be 0 or above. Calls git log with a custom format, and returns the output as is. Return RevisionRangeError if revision isn't found (due to git history modification).

func ParseGitLogFromLastBuild

func ParseGitLogFromLastBuild(serverDetails *utilsconfig.ServerDetails, buildConfiguration *build.BuildConfiguration, gitDetails GitLogDetails, logRegExp *gofrogcmd.CmdOutputPattern) error

ParseGitLogFromLastBuild Parses git commits from the last build's VCS revision. Calls git log with a custom format, and parses each line of the output with regexp. logRegExp is used to parse the log lines.

func ParseGitLogFromLastVcsRevision

func ParseGitLogFromLastVcsRevision(gitDetails GitLogDetails, logRegExp *gofrogcmd.CmdOutputPattern, lastVcsRevision string) (err error)

ParseGitLogFromLastVcsRevision Parses git log line by line, using the parser provided in logRegExp. Git log is parsed from lastVcsRevision to HEAD.

func ParseIsoTimestamp added in v0.8.0

func ParseIsoTimestamp(isoTimestamp string) (time.Time, error)

Types

type BuildAndVcsDetails added in v0.3.0

type BuildAndVcsDetails interface {
	ParseGitLogFromLastVcsRevision(gitDetails GitLogDetails, logRegExp *gofrogcmd.CmdOutputPattern, lastVcsRevision string) (err error)
	GetPlainGitLogFromPreviousBuild(serverDetails *utilsconfig.ServerDetails, buildConfiguration *build.BuildConfiguration, gitDetails GitLogDetails) (string, error)
	GetLastBuildLink(serverDetails *utilsconfig.ServerDetails, buildConfiguration *build.BuildConfiguration) (string, error)
}

type GitLogDetails

type GitLogDetails struct {
	LogLimit     int
	PrettyFormat string
	// Optional
	DotGitPath string
}

type LogCmd

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

func (*LogCmd) GetCmd

func (logCmd *LogCmd) GetCmd() *exec.Cmd

func (*LogCmd) GetEnv

func (logCmd *LogCmd) GetEnv() map[string]string

func (*LogCmd) GetErrWriter

func (logCmd *LogCmd) GetErrWriter() io.WriteCloser

func (*LogCmd) GetStdWriter

func (logCmd *LogCmd) GetStdWriter() io.WriteCloser

type RevisionRangeError

type RevisionRangeError struct {
	ErrorMsg string
}

Error to be thrown when revision could not be found in the git revision range.

func (RevisionRangeError) Error

func (err RevisionRangeError) Error() string

Jump to

Keyboard shortcuts

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