util

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildImage

func BuildImage(tarFile io.Reader, tags []string, labels map[string]string) (response string, err error)

BuildImage builds and image given a tar, a list of tags and labels.

func BuildTarFromDir

func BuildTarFromDir(sourcedir string) (tarContents *bytes.Buffer, err error)

BuildTarFromDir builds a tar file in memory given a sourcedir.

func FetchRepositories

func FetchRepositories() ([]string, error)

FetchRepositories gets all docker repositories in artifactory. this can potentially return a lot of values but, unfortunately by now, we didn't found any way for querying artifactory only for the vulcan-checks folder.

func GetCurrentSDKVersion

func GetCurrentSDKVersion() (string, error)

GetCurrentSDKVersion get the current sdk version. The function supposes the git repo of the sdk is already cloned locally.

func GetLatestTag

func GetLatestTag(tags []string) (latestTag string, found bool)

GetLatestTag given an array of tags returns the last tag without considering alfanumerics values, for instance in for this input ["10","7","something"] will return 10. will return false if len of input is zero or no numeric values are present in the array.

func GoBuildDir

func GoBuildDir(checkDir string) error

GoBuildDir execute `go build .` in a process setting the Dir of the process to checkDir param. Also sets the GOOS var to linux.

func GoTestDir

func GoTestDir(checkDir string) error

GoTestDir execute `go test .` in a process setting the Dir of the process to checkDir param.

func PushImage

func PushImage(imageName string, logger *log.Logger) (response string, err error)

PushImage pushes a image to a given repository using provided credentials.

func RunCheckImage

func RunCheckImage(imgName string, env []string) error

RunCheckImage creates an runs a check in a container.

func RunCheckReportImage

func RunCheckReportImage(imgName string, env []string, target string, host bool) error

RunCheckReportImage creates an runs a check in a container using json output.

Types

type DirLastCommmit

type DirLastCommmit struct {
	Path   string
	Commit string
}

DirLastCommmit stores information about last commit as returned by git log.

func GetLastCommitForDir

func GetLastCommitForDir(dir string) (DirLastCommmit, error)

GetLastCommitForDir returns information about last commit in dir.

func GetLastCommitForDirInRepo

func GetLastCommitForDirInRepo(dir, repoPath string) (DirLastCommmit, error)

GetLastCommitForDirInRepo returns information about last commit in dir.

type ImageTagsInfo

type ImageTagsInfo struct {
	Name string   `json:"name"`
	Tags []string `json:"tags"`
}

ImageTagsInfo represents the info returned by "/[reponame]/[imagename]/tags/list" rest query.

func FetchImagesInfo

func FetchImagesInfo(image string) (result ImageTagsInfo, err error)

FetchImagesInfo get information about images deployed in artifactory.

type ImageVersionInfo

type ImageVersionInfo struct {
	LastModified time.Time
	Commit       string
	SDKVersion   string
	Manifest     manifest.Data
}

ImageVersionInfo stores the info about version of a check, that is the last commit affecting the check, and the sdk version, witch in turn, the last commit in the master branch of the sdk.

func FetchImageTagInfo

func FetchImageTagInfo(image string, tag string) (ImageVersionInfo, error)

FetchImageTagInfo get information about a concrete image version deployed in artifactory.

type RegistryConfig

type RegistryConfig struct {
	RegistryServer string
	RegistryUser   string
	RegistryPass   string
}

RegistryConfig stores the name a credentials for a registry.

Jump to

Keyboard shortcuts

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