artifacts

package
v0.0.0-...-72e4f35 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package artifacts controls how files generated by Fuchsia's CI tasks are written to and read from Cloud Storage. The directory layout is defined below:

gs://BUCKET/

builds/
    BUILD/
        tests/
            TEST/
                ENVIRONMENT/

BUCKET

The Cloud Storage bucket used to store CI artifacts. Multiple buckets can exist
exist using this scheme.

BUILD

Contains all artifacts for a build. The directory's name is the unique BuildBucket
build ID.

TEST

Contains all artifacts relevant to a particular test.  The directory's name is the
canonical name of the test - which is usually a test "suite".

ENVIRONMENT

Contains all test artifacts relevant to a particular test environment. The
directory's name is the canonical name of the test environment. Tests will often
have multiple environment directories, because they often run in multiple
environments per build.

Index

Constants

View Source
const DefaultTestOutputName = "stdout-stderr.txt"

The default name of a test's output file. We only store a single file containing a test's combined stdout and stderr streams today. This will change in the future.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildDirectory

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

BuildDirectory represents a Fuchsia CI build's artifact directory. Refer to the layout in doc.go for the layout of this directory. When amending the layout, prefer adding convenience methods on this type to encourages all clients to create objects within this BuildDirectory using the same layout.

func (BuildDirectory) CopyFile

func (d BuildDirectory) CopyFile(ctx context.Context, src, dest string) (int64, error)

CopyFile copies the object from src to dst, creating all the parent directories of dest if they don't exist. It returns the (compressed, if applicable) size of the object even if it fails to download it.

func (BuildDirectory) List

func (d BuildDirectory) List(ctx context.Context, prefix string) ([]string, error)

List lists all of the objects in this directory with the given prefix. If prefix == "", it will list everything in this directory.

func (BuildDirectory) NewTestOutputObject

func (d BuildDirectory) NewTestOutputObject(ctx context.Context, testName, envName string) *storage.ObjectHandle

NewTestOutputObject creates a new ObjectHandle to hold the output of the given test execution in this BuildDirectory. testName is the name of the test, envName is the canonical name of the test environment. Both are normalized according to normalizePathSegment.

func (BuildDirectory) Object

func (d BuildDirectory) Object(objPath string) *storage.ObjectHandle

Object returns a handle to the given object within this directory. objPath is the path to the object relative to this directory.

type Client

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

Client provides access to the artifacts produced by Fuchsia CI tasks.

func NewClient

func NewClient(ctx context.Context, opts auth.Options) (*Client, error)

NewClient creates a new Client.

func (*Client) GetBuildDir

func (c *Client) GetBuildDir(bucket, build string) Directory

GetBuildDir returns the BuildDirectory for the given build. bucket is the GCS bucket. build is the BuildBucket build ID.

type Directory

type Directory interface {
	Object(string) *storage.ObjectHandle
	CopyFile(ctx context.Context, src, dest string) (int64, error)
	List(context.Context, string) ([]string, error)
}

Directory is an interface for interacting with a Cloud Storage "directory".

type ErrNothingMatchedPrefix

type ErrNothingMatchedPrefix struct {
	BucketName string
	Prefix     string
}

ErrNothingMatchedPrefix is returned when `List()` fails to find any objects in a bucket that match the given prefix.

func (*ErrNothingMatchedPrefix) Error

func (e *ErrNothingMatchedPrefix) Error() string

Jump to

Keyboard shortcuts

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