Documentation ¶
Index ¶
- Constants
- type Bucket
- type FinishedFile
- type StartedFile
- type Utils
- func (u *Utils) CheckFinishedStatus(job string, buildNumber int) (bool, error)
- func (u *Utils) CheckStartedStatus(job string, buildNumber int) (*StartedFile, error)
- func (u *Utils) GetFileFromJenkinsGoogleBucket(job string, buildNumber int, path string) (*http.Response, error)
- func (u *Utils) GetLastestBuildNumberFromJenkinsGoogleBucket(job string) (int, error)
- func (u *Utils) GetPathToJenkinsGoogleBucket(job string, buildNumber int) string
- func (u *Utils) ListFilesInBuild(job string, buildNumber int, prefix string) ([]string, error)
- func (u *Utils) ListFilesWithPrefix(prefix string) ([]string, error)
Constants ¶
const ( // GCSListAPIHost is the host of the api for a bucket GCSListAPIHost = "www.googleapis.com" // GCSBucketHost is the host for GCS bucket directory requests GCSBucketHost = "storage.googleapis.com" )
const ( // KubekinsBucket is the name of the kubekins bucket KubekinsBucket = "kubernetes-jenkins" // LogDir is the directory of kubekins LogDir = "logs" // PullLogDir is the directory of the pr builder jenkins PullLogDir = "pr-logs" // PullKey is a string to look for in a job name to figure out if it's // a pull (presubmit) job. PullKey = "pull" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket struct {
// contains filtered or unexported fields
}
Bucket represents a GCS bucket. It will craft file and list requests for you.
func NewTestBucket ¶
NewTestBucket constructs a new bucket pointing at a specific host.
func (*Bucket) ExpandListURL ¶
ExpandListURL produces the URL for a list API query which will list files enclosed by the provided path. Note that there's currently no way to get a path that ends in '/'.
func (*Bucket) ExpandPathURL ¶
ExpandPathURL turns the given path into a complete URL, good for accessing a file.
type FinishedFile ¶
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 information 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 ¶
NewTestUtils returns new Utils struct for a given url pointing to a file server.
func NewWithPresubmitDetection ¶
NewWithPresubmitDetection returns new Utils struct for a given bucket name and subdirectory. If a job name contains the presubmitKey, it will be gotten from the presubmitDirectory and trigger the dereferencing logic.
func (*Utils) CheckFinishedStatus ¶
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) GetLastestBuildNumberFromJenkinsGoogleBucket ¶
GetLastestBuildNumberFromJenkinsGoogleBucket reads a the number of last completed build of the given job from the Google project's GCS bucket.
func (*Utils) GetPathToJenkinsGoogleBucket ¶
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. Note: the purpose of this function was to allow us to change the host (to gubernator) without breaking detection of old links.
func (*Utils) ListFilesInBuild ¶
ListFilesInBuild takes build info and list all file names with matching prefix The returned file name included the complete path from bucket root