experiment

package
v0.72.6-alpha20245013001 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package experiment provides utilities used by Terragrunt to support an "experiment" mode. By default experiment mode is disabled, but when enabled, experimental features can be enabled. These features are not yet stable and may change in the future.

Note that any behavior outlined here should be documented in /docs/_docs/04_reference/experiment-mode.md

That is how users will know what to expect when they enable experiment mode, and how to customize it.

Index

Constants

View Source
const (
	// Symlinks is the experiment that allows symlinks to be used in Terragrunt configurations.
	Symlinks = "symlinks"
	// CLIRedesign is an experiment that allows users to use new commands related to the CLI redesign.
	CLIRedesign = "cli-redesign"
	// Stacks is the experiment that allows stacks to be used in Terragrunt.
	Stacks = "stacks"
)
View Source
const (
	// StatusOngoing is the status of an experiment that is ongoing.
	StatusOngoing byte = iota
	// StatusCompleted is the status of an experiment that is completed.
	StatusCompleted
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CompletedExperimentsError added in v0.73.0

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

CompletedExperimentsError is an error that is returned when completed experiments are requested.

func NewCompletedExperimentsError added in v0.73.0

func NewCompletedExperimentsError(experimentsNames []string) *CompletedExperimentsError

func (CompletedExperimentsError) Error added in v0.73.0

func (err CompletedExperimentsError) Error() string

type Experiment

type Experiment struct {
	// Name is the name of the experiment.
	Name string
	// Enabled determines if the experiment is enabled.
	Enabled bool
	// Status is the status of the experiment.
	Status byte
}

Experiment represents an experiment that can be enabled. When the experiment is enabled, Terragrunt will behave in a way that uses some experimental functionality.

func (Experiment) Evaluate

func (exps Experiment) Evaluate() bool

Evaluate returns true the experiment is enabled.

func (Experiment) String

func (exps Experiment) String() string

type Experiments

type Experiments []*Experiment

func NewExperiments

func NewExperiments() Experiments

NewExperiments returns a new Experiments map with all experiments disabled.

Bottom values for each experiment are the defaults, so only the names of experiments need to be set.

func (Experiments) EnableExperiment added in v0.73.0

func (exps Experiments) EnableExperiment(name string) error

EnableExperiment validates that the specified experiment name is valid and enables this experiment.

func (Experiments) Evaluate added in v0.73.0

func (exps Experiments) Evaluate(name string) bool

Evaluate returns true if the experiment is found and enabled otherwise returns false.

func (Experiments) ExperimentMode added in v0.73.0

func (exps Experiments) ExperimentMode()

ExperimentMode enables the experiment mode.

func (Experiments) FilterByStatus added in v0.73.0

func (exps Experiments) FilterByStatus(status byte) Experiments

FilterByStatus returns experiments filtered by the given `status`.

func (Experiments) Find added in v0.73.0

func (exps Experiments) Find(name string) *Experiment

Find searches and returns the experiment by the given `name`.

func (Experiments) Names added in v0.73.0

func (exps Experiments) Names() []string

Names returns all experiment names.

func (Experiments) NotifyCompletedExperiments added in v0.73.0

func (exps Experiments) NotifyCompletedExperiments(logger log.Logger)

NotifyCompletedExperiments logs the experiment names that are Enabled and have completed Status.

type InvalidExperimentNameError added in v0.73.0

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

InvalidExperimentNameError is an error that is returned when an invalid experiment name is requested.

func NewInvalidExperimentNameError added in v0.73.0

func NewInvalidExperimentNameError(allowedNames []string) *InvalidExperimentNameError

func (InvalidExperimentNameError) Error added in v0.73.0

func (err InvalidExperimentNameError) Error() string

Jump to

Keyboard shortcuts

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