prow/spyglass/gcsartifact_fetcher.go
func (af *GCSArtifactFetcher) artifact(key string, artifactName string, sizeLimit int64) (lenses.Artifact, error) {
	src, err := newGCSJobSource(key)
	if err != nil {
		return nil, fmt.Errorf("Failed to get GCS job source from %s: %v", key, err)
	}

	bucketName, prefix := extractBucketPrefixPair(src.jobPath())
	bkt := af.client.Bucket(bucketName)
	obj := &gcsArtifactHandle{bkt.Object(path.Join(prefix, artifactName))}
	artifactLink := &url.URL{
		Scheme: httpsScheme,
		Host:   "storage.googleapis.com",
		Path:   path.Join(src.jobPath(), artifactName),
	}
	return NewGCSArtifact(context.Background(), obj, artifactLink.String(), artifactName, sizeLimit), nil
}
func (af *GCSArtifactFetcher) artifact(key string, artifactName string, sizeLimit int64) (lenses.Artifact, error) {
	src, err := newGCSJobSource(key)
	if err != nil {
		return nil, fmt.Errorf("Failed to get GCS job source from %s: %v", key, err)
	}

	bucketName, prefix := extractBucketPrefixPair(src.jobPath())
	bkt := af.client.Bucket(bucketName)
	obj := &gcsArtifactHandle{bkt.Object(path.Join(prefix, artifactName))}
	artifactLink := &url.URL{
		Scheme: httpsScheme,
		Host:   "storage.googleapis.com",
		Path:   path.Join(src.jobPath(), artifactName),
	}
	return NewGCSArtifact(context.Background(), obj, artifactLink.String(), artifactName, sizeLimit), nil
}
func ( af * GCSArtifactFetcher ) artifact ( key string , artifactName string , sizeLimit int64 ) ( lenses . Artifact , error ) { src , err := newGCSJobSource ( key ) if err != nil { return nil , fmt . Errorf ( " " , key , err ) } bucketName , prefix := extractBucketPrefixPair ( src . jobPath ( ) ) bkt := af . client . Bucket ( bucketName ) obj := & gcsArtifactHandle { bkt . Object ( path . Join ( prefix , artifactName ) ) } artifactLink := & url . URL { Scheme : httpsScheme , Host : " " , Path : path . Join ( src . jobPath ( ) , artifactName ) , } return NewGCSArtifact ( context . Background ( ) , obj , artifactLink . String ( ) , artifactName , sizeLimit ) , nil }
// Artifact constructs a GCS artifact from the given GCS bucket and key. Uses the golang GCS library
// to get read handles. If the artifactName is not a valid key in the bucket a handle will still be
// constructed and returned, but all read operations will fail (dictated by behavior of golang GCS lib).
Artifact constructs a GCS artifact from the given GCS bucket and key . Uses the golang GCS library to get read handles . If the artifactName is not a valid key in the bucket a handle will still be constructed and returned but all read operations will fail ( dictated by behavior of golang GCS lib ) .