gcs

package
v0.0.0-...-084b0cb Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Default ACLs for this upload
	Default = false
	// PublicRead ACL for this upload.
	PublicRead = true
)

Variables

This section is empty.

Functions

func ClientWithCreds

func ClientWithCreds(ctx context.Context, creds ...string) (*storage.Client, error)

ClientWithCreds returns a storage client, optionally authenticated with the specified .json creds

func Upload

func Upload(ctx context.Context, client *storage.Client, path Path, buf []byte, worldReadable bool) error

Upload writes bytes to the specified Path

Types

type Build

type Build struct {
	Bucket     *storage.BucketHandle
	Context    context.Context
	Prefix     string
	BucketPath string
}

Build points to a build stored under a particular gcs prefix.

func (Build) Artifacts

func (build Build) Artifacts(artifacts chan<- *storage.ObjectAttrs) error

Artifacts writes the object name of all paths under the build's artifact dir to the output channel.

func (Build) Finished

func (build Build) Finished() (*Finished, error)

Finished parses the build's finished metadata.

func (Build) Started

func (build Build) Started() (*Started, error)

Started parses the build's started metadata.

func (Build) String

func (build Build) String() string

func (Build) Suites

func (build Build) Suites(artifacts <-chan *storage.ObjectAttrs, suites chan<- SuitesMeta) error

Suites takes a channel of artifact names, parses those representing junit suites, writing the result to the suites channel.

Note that junit suites are parsed in parallel, so there are no guarantees about suites ordering.

type Builds

type Builds []Build

Builds is a slice of builds.

func ListBuilds

func ListBuilds(ctx context.Context, client *storage.Client, path Path) (Builds, error)

ListBuilds returns the array of builds under path, sorted in monotonically decreasing order.

func (Builds) Len

func (b Builds) Len() int

func (Builds) Less

func (b Builds) Less(i, j int) bool

Expect builds to be in monotonically increasing order. So build8 < build9 < build10 < build888

func (Builds) Swap

func (b Builds) Swap(i, j int)

type Finished

type Finished struct {
	metadata.Finished
	// Running when the job hasn't finished and finished.json doesn't exist
	Running bool
}

Finished holds finished.json data.

type Path

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

Path parses gs://bucket/obj urls

func NewPath

func NewPath(path string) (*Path, error)

func (Path) Bucket

func (g Path) Bucket() string

Bucket returns bucket in gs://bucket/obj

func (Path) Object

func (g Path) Object() string

Object returns path/to/something in gs://bucket/path/to/something

func (Path) ResolveReference

func (g Path) ResolveReference(ref *url.URL) (*Path, error)

ResolveReference returns the path relative to the current path

func (*Path) Set

func (g *Path) Set(v string) error

Set updates value from a gs://bucket/obj string, validating errors.

func (*Path) SetURL

func (g *Path) SetURL(u *url.URL) error

SetURL updates value to the passed in gs://bucket/obj url

func (Path) String

func (g Path) String() string

String returns the gs://bucket/obj url

type Started

type Started struct {
	metadata.Started
	// Pending when the job has not started yet
	Pending bool
}

Started holds started.json data.

type SuitesMeta

type SuitesMeta struct {
	Suites junit.Suites // suites data extracted from file contents
	//Metadata map[string]string // metadata extracted from path name
	Path string
}

SuitesMeta holds testsuites xml and metadata from the filename

Jump to

Keyboard shortcuts

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