Commit c78ed0bc authored by Kamil Trzciński's avatar Kamil Trzciński 💬 Committed by Tomasz Maczukin

Allow to configure FF using config.toml

parent a6b68244
......@@ -648,11 +648,11 @@ func (b *Build) GetAllVariables() JobVariables {
}
variables := make(JobVariables, 0)
variables = append(variables, b.GetDefaultFeatureFlagsVariables()...)
if b.Runner != nil {
variables = append(variables, b.Runner.GetVariables()...)
}
variables = append(variables, b.GetDefaultVariables()...)
variables = append(variables, b.GetDefaultFeatureFlagsVariables()...)
variables = append(variables, b.GetCITLSVariables()...)
variables = append(variables, b.Variables...)
variables = append(variables, b.GetSharedEnvVariable())
......
......@@ -941,6 +941,40 @@ func TestIsFeatureFlagOn(t *testing.T) {
}
}
func TestAllowToOverwriteFeatureFlagWithRunnerVariables(t *testing.T) {
tests := map[string]struct {
variable string
expectedValue bool
}{
"it has default value of FF": {
variable: "",
expectedValue: true,
},
"it enables FF": {
variable: "FF_K8S_USE_ENTRYPOINT_OVER_COMMAND=true",
expectedValue: true,
},
"it disable FF": {
variable: "FF_K8S_USE_ENTRYPOINT_OVER_COMMAND=false",
expectedValue: false,
},
}
for name, test := range tests {
t.Run(name, func(t *testing.T) {
build := new(Build)
build.Runner = &RunnerConfig{
RunnerSettings: RunnerSettings{
Environment: []string{test.variable},
},
}
result := build.IsFeatureFlagOn("FF_K8S_USE_ENTRYPOINT_OVER_COMMAND")
assert.Equal(t, test.expectedValue, result)
})
}
}
func TestStartBuild(t *testing.T) {
type startBuildArgs struct {
rootDir string
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment