get.porter.sh/porter@v1.3.0/pkg/experimental/experimental.go (about)

     1  package experimental
     2  
     3  const (
     4  	// NoopFeature is a placeholder feature flag that allows us to test our feature flag functions even when there are no active feature flags
     5  	NoopFeature = "no-op"
     6  
     7  	// DependenciesV2 is the name of the experimental feature flag for PEP003 - Advanced Dependencies.
     8  	DependenciesV2 = "dependencies-v2"
     9  
    10  	// FullControlDockerfile is the name of the experimental feature flag giving authors full control of the bundle image Dockerfile
    11  	FullControlDockerfile = "full-control-dockerfile"
    12  )
    13  
    14  // FeatureFlags is an enum of possible feature flags
    15  type FeatureFlags int
    16  
    17  const (
    18  	// FlagNoopFeature is a placeholder feature flag that allows us to test our feature flag functions even when there are no active feature flags
    19  	FlagNoopFeature FeatureFlags = iota + 1
    20  
    21  	// FlagDependenciesV2 gates the changes from PEP003 - Advanced Dependencies.
    22  	FlagDependenciesV2
    23  
    24  	// FlagFullControlDockerfile gates the changes required for giving authors full control of the bundle image Dockerfile
    25  	FlagFullControlDockerfile
    26  )
    27  
    28  // ParseFlags converts a list of feature flag names into a bit map for faster lookups.
    29  func ParseFlags(flags []string) FeatureFlags {
    30  	var experimental FeatureFlags
    31  	for _, flag := range flags {
    32  		switch flag {
    33  		case NoopFeature:
    34  			experimental = experimental | FlagNoopFeature
    35  		case DependenciesV2:
    36  			experimental = experimental | FlagDependenciesV2
    37  		case FullControlDockerfile:
    38  			experimental = experimental | FlagFullControlDockerfile
    39  		}
    40  	}
    41  	return experimental
    42  }