Documentation
¶
Overview ¶
Package bazel contains Bazel-specific compatibility helpers used by CI Visibility and other payload-file based flows.
Index ¶
- Constants
- func CacheHTTPFile(name string) (string, bool)
- func IsGitCLIDisabled() bool
- func IsManifestModeEnabled() bool
- func IsPayloadFilesModeEnabled() bool
- func MsgpackToJSON(msgpackPayload []byte) ([]byte, error)
- func ResetForTesting()
- func TestOptimizationPathForLog(path string) string
- func WritePayloadFile(kind PayloadKind, jsonPayload []byte) error
- type Mode
- type PayloadKind
Constants ¶
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 ¶
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 ¶
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 ¶
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" )