Documentation ¶
Index ¶
- Constants
- func BazelCleanIfLowDiskSpace(ctx context.Context, bazelCacheDir, bazelWorkspaceDir, pathToBazel string) error
- func ComputeBenchmarkTestRunnerCLIFlags(benchmarkInfo BenchmarkInfo) []string
- func ExtractOutputsZip(ctx context.Context, outputsZipPath string) (string, error)
- func UploadToGold(ctx context.Context, utgArgs UploadToGoldArgs, outputsZIPOrDir string) error
- func UploadToPerf(ctx context.Context, gcsClient gcs.GCSClient, benchmarkInfo BenchmarkInfo, ...) error
- func ValidateLabelAndReturnOutputsZipPath(checkoutDir, label string) (string, error)
- func WithEnoughSpaceOnBazelCachePartitionTestOnlyContext(ctx context.Context) (context.Context, string)
- type BazelCleanIfLowDiskSpaceContextValue
- type BazelFlags
- type BenchmarkInfo
- type MakeBazelFlagsOpts
- type UploadToGoldArgs
Constants ¶
const BazelCleanIfLowDiskSpaceContextKey = bazelCleanIfLowDiskSpaceContextKeyType("overwriteBazelCleanIfLowDiskSpaceDiskFns")
BazelCleanIfLowDiskSpaceContextKey is a context key that can be used from tests to override the functions used by BazelCleanIfLowDiskSpace to compute the free space on the partition where the Bazel cache lives. Values associated to this context key should be of type BazelCleanIfLowDiskSpaceContextValue.
const PerfGCSBucketName = "skia-perf"
PerfGCSBucketName is the name of the perf.skia.org GCS bucket.
Variables ¶
This section is empty.
Functions ¶
func BazelCleanIfLowDiskSpace ¶
func BazelCleanIfLowDiskSpace(ctx context.Context, bazelCacheDir, bazelWorkspaceDir, pathToBazel string) error
BazelCleanIfLowDiskSpace runs "bazel clean" as a task driver step if disk space is too low. This step should be added at the end of any task driver that shells out to Bazel in order to prevent DiskSpaceLow alerts due to the Bazel cache (usually at /mnt/pd0/bazel_cache) growing too large.
Ideally, we would like to tell Bazel to prevent the cache from growing above a certain size, but there is currently no way to do this. See discussion in the below links:
- https://github.com/bazelbuild/bazel/issues/1035 - https://github.com/bazelbuild/bazel/issues/5139
Testing: Set the BazelCleanIfLowDiskSpaceContextKey context key to override the functions that compute the free space (measured in bytes) on the partition where the Bazel cache lives.
func ComputeBenchmarkTestRunnerCLIFlags ¶
func ComputeBenchmarkTestRunnerCLIFlags(benchmarkInfo BenchmarkInfo) []string
ComputeBenchmarkTestRunnerCLIFlags returns the command-line flags that should be passed to the benchmark test runner.
func ExtractOutputsZip ¶
ExtractOutputsZip extracts the undeclared outputs ZIP archive into a temporary directory, and returns the path to said directory.
func UploadToGold ¶
func UploadToGold(ctx context.Context, utgArgs UploadToGoldArgs, outputsZIPOrDir string) error
UploadToGold uploads any GM results to Gold via goldctl.
func UploadToPerf ¶
func ValidateLabelAndReturnOutputsZipPath ¶
ValidateLabelAndReturnOutputsZipPath validates the given Bazel label and returns the path within the checkout directory where the ZIP archive with undeclared test outputs will be found, if applicable.
func WithEnoughSpaceOnBazelCachePartitionTestOnlyContext ¶
func WithEnoughSpaceOnBazelCachePartitionTestOnlyContext(ctx context.Context) (context.Context, string)
WithEnoughSpaceOnBazelCachePartitionTestOnlyContext returns a context that makes common.BazelCleanIfLowDiskSpace() think there is enough space on the partition where the Bazel cache is found. It also returns a path within said partition where the Bazel cache is assumed to live, which should be passed to the code under test that invokes common.BazelCleanIfLowDiskSpace().
This function is placed here rather than in the testutils Go package to avoid an import cycle.
Types ¶
type BazelCleanIfLowDiskSpaceContextValue ¶
type BazelCleanIfLowDiskSpaceContextValue = struct { GetPartitionMountpoints func() ([]string, error) FreeBytesOnPartition func(string) (uint64, error) }
BazelCleanIfLowDiskSpaceContextValue is the type of the value associated with the BazelCleanIfLowDiskSpaceContextKey context key.
type BazelFlags ¶
type BazelFlags struct { Label *string Config *string DeviceSpecificConfig *string AdditionalArgs *[]string CacheDir *string // contains filtered or unexported fields }
BazelFlags is a struct that holds common flags for task drivers that shell out to Bazel.
func MakeBazelFlags ¶
func MakeBazelFlags(opts MakeBazelFlagsOpts) *BazelFlags
MakeBazelFlags declares common Bazel flags.
func (*BazelFlags) Validate ¶
func (f *BazelFlags) Validate(ctx context.Context)
Validate performs common flag validation steps.
type BenchmarkInfo ¶
type BenchmarkInfo struct { GitCommit string TaskName string TaskID string ChangelistID string PatchsetOrder string }
BenchmarkInfo contains information about the CI task under which a benchmark is executed.
type MakeBazelFlagsOpts ¶
type MakeBazelFlagsOpts struct { Label bool Config bool DeviceSpecificConfig bool AdditionalArgs bool }
MakeBazelFlagsOpts controls which flags are defiend by MakeBazelFlags.
type UploadToGoldArgs ¶
type UploadToGoldArgs struct { BazelLabel string DeviceSpecificBazelConfig string GoldctlPath string GitCommit string ChangelistID string PatchsetOrder string // 1, 2, 3, etc. TryjobID string // TestOnlyAllowAnyBazelLabel should only be used from tests. If true, the // goldctlBazelLabelAllowList will be ignored. // // TODO(lovisolo): Delete once migration is complete. TestOnlyAllowAnyBazelLabel bool }
UploadToGoldArgs gathers the inputs to the UploadToGold function.