bazel

package
v2.8.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package bazel contains Bazel-specific compatibility helpers used by CI Visibility and other payload-file based flows.

Index

Constants

View Source
const (
	// ManifestFilePathEnv points to the runfiles manifest or manifest rlocation used by offline Bazel mode.
	ManifestFilePathEnv = "DD_TEST_OPTIMIZATION_MANIFEST_FILE"
	// PayloadsInFilesEnv enables writing CI Visibility and telemetry payloads to undeclared output files.
	PayloadsInFilesEnv = "DD_TEST_OPTIMIZATION_PAYLOADS_IN_FILES"
	// UndeclaredOutputsDirEnv points to Bazel's undeclared outputs root where payload files are stored.
	UndeclaredOutputsDirEnv = "TEST_UNDECLARED_OUTPUTS_DIR"
)

Variables

This section is empty.

Functions

func CacheHTTPFile

func CacheHTTPFile(name string) (string, bool)

CacheHTTPFile returns the expected cache/http file path in manifest mode.

func IsGitCLIDisabled

func IsGitCLIDisabled() bool

IsGitCLIDisabled returns true when the current Bazel mode must not invoke the Git CLI.

func IsManifestModeEnabled

func IsManifestModeEnabled() bool

IsManifestModeEnabled returns true when a compatible manifest has been resolved.

func IsPayloadFilesModeEnabled

func IsPayloadFilesModeEnabled() bool

IsPayloadFilesModeEnabled returns true when payload-file mode is enabled through environment variables.

func MsgpackToJSON

func MsgpackToJSON(msgpackPayload []byte) ([]byte, error)

MsgpackToJSON converts any MessagePack payload into JSON bytes.

func ResetForTesting

func ResetForTesting()

ResetForTesting resets cached mode state. This helper is intended for tests that set per-test environment combinations.

func TestOptimizationPathForLog

func TestOptimizationPathForLog(path string) string

TestOptimizationPathForLog shortens runfiles cache paths to .testoptimization-relative form when available.

func WritePayloadFile

func WritePayloadFile(kind PayloadKind, jsonPayload []byte) error

WritePayloadFile writes a JSON payload under Bazel's undeclared outputs root.

Types

type Mode

type Mode struct {
	// ManifestEnabled reports whether a supported manifest was found and can be used for offline cache reads.
	ManifestEnabled bool
	// PayloadFilesEnabled reports whether Bazel payload-file mode is enabled.
	PayloadFilesEnabled bool
	// ManifestPath is the resolved absolute path to the Bazel manifest file when manifest mode is enabled.
	ManifestPath string
	// ManifestDir is the directory that contains the resolved manifest and its cache tree.
	ManifestDir string
	// PayloadsRoot is the root directory that contains per-kind payload output subdirectories.
	PayloadsRoot string
}

Mode stores the process-level Bazel compatibility settings.

func CurrentMode

func CurrentMode() Mode

CurrentMode returns the resolved process-wide Bazel mode.

type PayloadKind

type PayloadKind string

PayloadKind identifies the payload subdirectory and naming strategy used for Bazel payload-file mode.

const (
	// PayloadKindTests writes CI Visibility test event payloads.
	PayloadKindTests PayloadKind = "tests"
	// PayloadKindCoverage writes CI Visibility coverage payloads.
	PayloadKindCoverage PayloadKind = "coverage"
	// PayloadKindTelemetry writes raw top-level telemetry request bodies.
	PayloadKindTelemetry PayloadKind = "telemetry"
)

Jump to

Keyboard shortcuts

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