utils

package
v0.0.0-...-9815b6b Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2016 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GCSListAPIURLTemplate is the template of GCS list api for a bucket
	GCSListAPIURLTemplate = "https://www.googleapis.com/storage/v1/b/%s/o"
	// GCSBucketURLTemplate is the tempalate for a GCS bucket directory
	GCSBucketURLTemplate = "https://storage.googleapis.com/%s/%s"
	// KubekinsBucket is the name of the kubekins bucket
	KubekinsBucket = "kubernetes-jenkins"
	// LogDir is the directory of kubekins
	LogDir = "logs"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FinishedFile

type FinishedFile struct {
	Result    string `json:"result"`
	Timestamp uint64 `json:"timestamp"`
}

FinishedFile is a type in which we store test result in GCS as finished.json

type StartedFile

type StartedFile struct {
	Version     string `json:"version"`
	Timestamp   uint64 `json:"timestamp"`
	JenkinsNode string `json:"jenkins-node"`
}

StartedFile is a type in which we store test starting informatio in GCS as started.json

type Utils

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

Utils is a struct handling all communication with a given bucket

func NewTestUtils

func NewTestUtils(url string) *Utils

NewTestUtils returnes new Utils struct for a given url pointing to a file server

func NewUtils

func NewUtils(bucket, directory string) *Utils

NewUtils returnes new Utils struct for a given bucket name and subdirectory

func (*Utils) CheckFinishedStatus

func (u *Utils) CheckFinishedStatus(job string, buildNumber int) (bool, error)

CheckFinishedStatus reads the finished.json file for a given job and build number. It returns true if the result stored there is success, and false otherwise.

func (*Utils) CheckStartedStatus

func (u *Utils) CheckStartedStatus(job string, buildNumber int) (*StartedFile, error)

CheckStartedStatus reads the started.json file for a given job and build number. It returns true if the result stored there is success, and false otherwise.

func (*Utils) GetFileFromJenkinsGoogleBucket

func (u *Utils) GetFileFromJenkinsGoogleBucket(job string, buildNumber int, path string) (*http.Response, error)

GetFileFromJenkinsGoogleBucket reads data from Google project's GCS bucket for the given job and buildNumber. Returns a response with file stored under a given (relative) path or an error.

func (*Utils) GetGCSDirectoryURL

func (u *Utils) GetGCSDirectoryURL() string

GetGCSDirectoryURL returns the url of the bucket directory

func (*Utils) GetGCSListURL

func (u *Utils) GetGCSListURL() string

GetGCSListURL returns the url to the list api

func (*Utils) GetLastestBuildNumberFromJenkinsGoogleBucket

func (u *Utils) GetLastestBuildNumberFromJenkinsGoogleBucket(job string) (int, error)

GetLastestBuildNumberFromJenkinsGoogleBucket reads a the number of last completed build of the given job from the Google project's GCS bucket .

func (*Utils) GetPathToJenkinsGoogleBucket

func (u *Utils) GetPathToJenkinsGoogleBucket(job string, buildNumber int) string

GetPathToJenkinsGoogleBucket returns a GCS path containing the artifacts for a given job and buildNumber. This only formats the path. It doesn't include a host or protocol necessary for a full URI.

func (*Utils) ListFilesInBuild

func (u *Utils) ListFilesInBuild(job string, buildNumber int, prefix string) ([]string, error)

ListFilesInBuild takes build info and list all file names with matching prefix The returned file name included the complete path from bucket root

func (*Utils) ListFilesWithPrefix

func (u *Utils) ListFilesWithPrefix(prefix string) ([]string, error)

ListFilesWithPrefix returns all files with matching prefix in the bucket The returned file name included the complete path from bucket root

Jump to

Keyboard shortcuts

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