experiments

package
v3.72.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package experiments provides a global registry of enabled and disabled experiments.

It is intended for internal use by buildkite-agent only.

Index

Constants

View Source
const (
	// Available experiments
	AgentAPI                       = "agent-api"
	DescendingSpawnPriority        = "descending-spawn-priority"
	InterpolationPrefersRuntimeEnv = "interpolation-prefers-runtime-env"
	KubernetesExec                 = "kubernetes-exec"
	NormalisedUploadPaths          = "normalised-upload-paths"
	OverrideZeroExitOnCancel       = "override-zero-exit-on-cancel"
	PTYRaw                         = "pty-raw"
	PolyglotHooks                  = "polyglot-hooks"
	ResolveCommitAfterCheckout     = "resolve-commit-after-checkout"
	UseZZGlob                      = "use-zzglob"

	// Promoted experiments
	ANSITimestamps         = "ansi-timestamps"
	AvoidRecursiveTrap     = "avoid-recursive-trap"
	FlockFileLocks         = "flock-file-locks"
	GitMirrors             = "git-mirrors"
	InbuiltStatusPage      = "inbuilt-status-page"
	IsolatedPluginCheckout = "isolated-plugin-checkout"
	JobAPI                 = "job-api"
)

Variables

View Source
var (
	Available = map[string]struct{}{
		AgentAPI:                       {},
		DescendingSpawnPriority:        {},
		InterpolationPrefersRuntimeEnv: {},
		KubernetesExec:                 {},
		NormalisedUploadPaths:          {},
		OverrideZeroExitOnCancel:       {},
		PolyglotHooks:                  {},
		ResolveCommitAfterCheckout:     {},
		UseZZGlob:                      {},
	}

		ANSITimestamps:         standardPromotionMsg(ANSITimestamps, "v3.48.0"),
		AvoidRecursiveTrap:     standardPromotionMsg(AvoidRecursiveTrap, "v3.66.0"),
		FlockFileLocks:         standardPromotionMsg(FlockFileLocks, "v3.48.0"),
		GitMirrors:             standardPromotionMsg(GitMirrors, "v3.47.0"),
		InbuiltStatusPage:      standardPromotionMsg(InbuiltStatusPage, "v3.48.0"),
		IsolatedPluginCheckout: standardPromotionMsg(IsolatedPluginCheckout, "v3.67.0"),
		JobAPI:                 standardPromotionMsg(JobAPI, "v3.64.0"),
	}
)

Functions

func Disable

func Disable(ctx context.Context, key string) context.Context

Disable a particular experiment in a new context.

func Enabled

func Enabled(ctx context.Context) []string

Enabled returns the keys of all the enabled experiments.

func IsEnabled

func IsEnabled(ctx context.Context, key string) bool

IsEnabled reports whether the named experiment is enabled in the context.

func KnownAndEnabled added in v3.64.0

func KnownAndEnabled(ctx context.Context) []string

KnownAndEnabled returns the keys of all the known and enabled experiments.

Types

type State

type State string
const (
	StateKnown    State = "known"
	StatePromoted State = "promoted"
	StateUnknown  State = "unknown"
)

Experiment states

func Enable

func Enable(ctx context.Context, key string) (newctx context.Context, state State)

Enable a particular experiment in a new context.

func EnableWithWarnings

func EnableWithWarnings(ctx context.Context, l logger.Logger, key string) (context.Context, State)

EnableWithWarnings enables an experiment in a new context, logging information about unknown and promoted experiments.

Jump to

Keyboard shortcuts

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