github.com/secure-build/gitlab-runner@v12.5.0+incompatible/helpers/featureflags/flags.go (about)

     1  package featureflags
     2  
     3  import (
     4  	"strconv"
     5  )
     6  
     7  const (
     8  	CmdDisableDelayedErrorLevelExpansion string = "FF_CMD_DISABLE_DELAYED_ERROR_LEVEL_EXPANSION"
     9  	UseLegacyBuildsDirForDocker          string = "FF_USE_LEGACY_BUILDS_DIR_FOR_DOCKER"
    10  	UseLegacyVolumesMountingOrder        string = "FF_USE_LEGACY_VOLUMES_MOUNTING_ORDER"
    11  )
    12  
    13  type FeatureFlag struct {
    14  	Name            string
    15  	DefaultValue    string
    16  	Deprecated      bool
    17  	ToBeRemovedWith string
    18  	Description     string
    19  }
    20  
    21  // REMEMBER to update the documentation after adding or removing a feature flag
    22  //
    23  // Please use `make update_feature_flags_docs` to make the update automatic and
    24  // properly formatted. It will replace the existing table with the new one, computed
    25  // basing on the values below
    26  var flags = []FeatureFlag{
    27  	{
    28  		Name:            CmdDisableDelayedErrorLevelExpansion,
    29  		DefaultValue:    "false",
    30  		Deprecated:      false,
    31  		ToBeRemovedWith: "",
    32  		Description:     "Disables [EnableDelayedExpansion](https://ss64.com/nt/delayedexpansion.html) for error checking for when using [Window Batch](https://docs.gitlab.com/runner/shells/#windows-batch) shell",
    33  	},
    34  	{
    35  		Name:            UseLegacyBuildsDirForDocker,
    36  		DefaultValue:    "false",
    37  		Deprecated:      true,
    38  		ToBeRemovedWith: "12.3",
    39  		Description:     "Disables the new strategy for Docker executor to cache the content of `/builds` directory instead of `/builds/group-org`",
    40  	},
    41  	{
    42  		Name:            UseLegacyVolumesMountingOrder,
    43  		DefaultValue:    "false",
    44  		Deprecated:      true,
    45  		ToBeRemovedWith: "12.6",
    46  		Description:     "Disables the new ordering of volumes mounting when `docker*` executors are being used.",
    47  	},
    48  }
    49  
    50  func GetAll() []FeatureFlag {
    51  	return flags
    52  }
    53  
    54  func IsOn(value string) (bool, error) {
    55  	if value == "" {
    56  		return false, nil
    57  	}
    58  
    59  	on, err := strconv.ParseBool(value)
    60  	if err != nil {
    61  		return false, err
    62  	}
    63  
    64  	return on, nil
    65  }