utils

package
v0.0.0-...-152d858 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2018 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const ARTIFACT_PATTERN = "artifactPattern"
View Source
const BUILD_NAME = "build.name"

For key/value binding

View Source
const BUILD_NUMBER = "build.number"
View Source
const BuildInfoDetails = "details"
View Source
const BuildTempPath = "jfrog/builds/"
View Source
const ClassworldsConf = `` /* 166-byte string literal not displayed */
View Source
const DEPLOYER_PREFIX = "deployer."
View Source
const GENERATED_BUILD_INFO = "buildInfo.generated"
View Source
const GENERATED_BUILD_INFO_TEMP_PREFIX = "generatedBuildInfo"
View Source
const GradleInitScript = `` /* 1344-byte string literal not displayed */
View Source
const IVY_DESCRIPTOR = "deployIvyDescriptors"
View Source
const IVY_PATTERN = "ivyPattern"
View Source
const MAVEN_DESCRIPTOR = "deployMavenDescriptors"
View Source
const PASSWORD = "password"
View Source
const PROPERTIES_TEMP_PATH = "jfrog/properties/"
View Source
const PROPERTIES_TEMP_PREFIX = "buildInfoProperties"

For path and temp files

View Source
const RELEASE_REPO = "releaseRepo"
View Source
const REPO = "repo"
View Source
const RESOLVER_PREFIX = "resolver."
View Source
const SERVER_ID = "serverId"
View Source
const SNAPSHOT_REPO = "snapshotRepo"
View Source
const URL = "url"
View Source
const USERNAME = "username"

Variables

View Source
var BuildTypes = []string{
	"maven",
	"gradle",
}
View Source
var RepoTypes = []string{
	"local",
	"remote",
	"virtual",
}

Functions

func CheckIfRepoExists

func CheckIfRepoExists(repository string, artDetails auth.ArtifactoryDetails) error

func ConvertResultItemArrayToDeleteItemArray

func ConvertResultItemArrayToDeleteItemArray(resultItems []servicesutils.ResultItem) []services.DeleteItem

func CreateBuildInfoPropertiesFile

func CreateBuildInfoPropertiesFile(buildName, buildNumber string, config *viper.Viper, buildType BuildType) (string, error)

func CreateBuildProperties

func CreateBuildProperties(buildName, buildNumber string) (string, error)

func CreateServiceManager

func CreateServiceManager(artDetails *config.ArtifactoryDetails, isDryRun bool) (*artifactory.ArtifactoryServicesManager, error)

func DownloadFromBintrayIfNeeded

func DownloadFromBintrayIfNeeded(downloadPath, filename, targetPath string) error

Download file from Bintray. downloadPath: Bintray download path in the following format: subject/repo/path/version/filename. filename: the file full name. targetPath: local download target path.

func GetBuildDir

func GetBuildDir(buildName, buildNumber string) (string, error)

func GetEncryptedPasswordFromArtifactory

func GetEncryptedPasswordFromArtifactory(artifactoryAuth auth.ArtifactoryDetails) (string, error)

func GetGeneratedBuildsInfo

func GetGeneratedBuildsInfo(buildName, buildNumber string) ([]*buildinfo.BuildInfo, error)

func GetJfrogSecurityDir

func GetJfrogSecurityDir() (string, error)

func GetRegExp

func GetRegExp(regex string) (*regexp.Regexp, error)

func GetRepositories

func GetRepositories(artDetails auth.ArtifactoryDetails, repoType ...RepoType) ([]string, error)

func ReadBuildInfoGeneralDetails

func ReadBuildInfoGeneralDetails(buildName, buildNumber string) (*buildinfo.General, error)

func ReadConfigFile

func ReadConfigFile(configPath string, configType ConfigType) (*viper.Viper, error)

func ReadPartialBuildInfoFiles

func ReadPartialBuildInfoFiles(buildName, buildNumber string) (buildinfo.Partials, error)

func RemoveBuildDir

func RemoveBuildDir(buildName, buildNumber string) error

func RunCmd

func RunCmd(config CmdConfig) error

func RunCmdOutput

func RunCmdOutput(config CmdConfig) ([]byte, error)

func RunCmdWithOutputParser

func RunCmdWithOutputParser(config CmdConfig, regExpStruct ...*CmdOutputPattern) error

Executes the command and captures the output. Analyze each line to match the provided regex.

func SaveBuildGeneralDetails

func SaveBuildGeneralDetails(buildName, buildNumber string) error

func SaveBuildInfo

func SaveBuildInfo(buildName, buildNumber string, buildInfo *buildinfo.BuildInfo) error

func SavePartialBuildInfo

func SavePartialBuildInfo(buildName, buildNumber string, populatePartialBuildInfoFunc populatePartialBuildInfo) error

Types

type BuildConfigMapping

type BuildConfigMapping map[BuildType][]*map[string]string

type BuildConfiguration

type BuildConfiguration struct {
	BuildName   string
	BuildNumber string
}

type BuildInfoConfiguration

type BuildInfoConfiguration struct {
	DryRun     bool
	EnvInclude string
	EnvExclude string
	// contains filtered or unexported fields
}

func (*BuildInfoConfiguration) GetArtifactoryDetails

func (config *BuildInfoConfiguration) GetArtifactoryDetails() auth.ArtifactoryDetails

func (*BuildInfoConfiguration) IsDryRun

func (config *BuildInfoConfiguration) IsDryRun() bool

func (*BuildInfoConfiguration) SetArtifactoryDetails

func (config *BuildInfoConfiguration) SetArtifactoryDetails(art auth.ArtifactoryDetails)

type BuildType

type BuildType int
const (
	MAVEN BuildType = iota
	GRADLE
)

func (BuildType) String

func (buildType BuildType) String() string

type CmdConfig

type CmdConfig interface {
	GetCmd() *exec.Cmd
	GetEnv() map[string]string
	GetStdWriter() io.WriteCloser
	GetErrWriter() io.WriteCloser
}

type CmdOutputPattern

type CmdOutputPattern struct {
	RegExp *regexp.Regexp

	ExecFunc func() (string, error)
	// contains filtered or unexported fields
}

RegExp - The regexp that the line will be searched upon. matchedResult - The result string that was found by the regex line - The output line from the external process ExecFunc - The function to execute

func (*CmdOutputPattern) ErrorOnNotFound

func (reg *CmdOutputPattern) ErrorOnNotFound() (string, error)

func (*CmdOutputPattern) MaskCredentials

func (reg *CmdOutputPattern) MaskCredentials() (string, error)

Mask the credentials information from the line. The credentials are build as user:password For example: http://user:password@127.0.0.1:8081/artifactory/path/to/repo

type ConfigType

type ConfigType string
const (
	YAML       ConfigType = "yaml"
	PROPERTIES ConfigType = "properties"
)

type RepoType

type RepoType int
const (
	LOCAL RepoType = iota
	REMOTE
	VIRTUAL
)

func (RepoType) String

func (repoType RepoType) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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