Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(config): changed two feature flags types from boolean to string. #184

Merged
merged 1 commit into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pkg/settings/global/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ func NewDefaultSettings() Settings {
EventLogsOnly: false,
},
UserWritePermissionsCheckEnabled: false,
MultipleBranchesEnabled: true,
DinghyIgnoreRegexp2Enabled: true,
MultipleBranchesEnabled: "true",
DinghyIgnoreRegexp2Enabled: "true",
}
}

Expand Down Expand Up @@ -158,13 +158,13 @@ type Settings struct {
// SQL configuration for dinghy
SQL Sqlconfig `json:"sql,omitempty" yaml:"sql"`
// Enable regexp2 for .dinghyignore file
DinghyIgnoreRegexp2Enabled bool `json:"dinghyIgnoreRegexp2Enabled" yaml:"dinghyIgnoreRegexp2Enabled"`
DinghyIgnoreRegexp2Enabled string `json:"dinghyIgnoreRegexp2Enabled" yaml:"dinghyIgnoreRegexp2Enabled"`
// Check user's write permissions by calling Fiat /authorize/${user}/roles before updating application
UserWritePermissionsCheckEnabled bool `json:"userWritePermissionsCheckEnabled" yaml:"userWritePermissionsCheckEnabled"`
// Users for whom we should ignore and skip write permissions validations
IgnoreUsersPermissions []string `json:"ignoreUsersWritePermissions" yaml:"ignoreUsersWritePermissions"`
// Enable processing of multiple branches in single repository
MultipleBranchesEnabled bool `json:"multipleBranchesEnabled" yaml:"multipleBranchesEnabled"`
MultipleBranchesEnabled string `json:"multipleBranchesEnabled" yaml:"multipleBranchesEnabled"`
// Enable using savePipeline and updatePipeline tasks from Orca
UpsertPipelineUsingOrcaTaskEnabled bool `json:"upsertPipelineUsingOrcaTaskEnabled" yaml:"upsertPipelineUsingOrcaTaskEnabled"`
}
Expand Down Expand Up @@ -259,7 +259,7 @@ type RepoConfig struct {

func (s *Settings) GetRepoConfig(provider, repo, branch string) *RepoConfig {
var match = func(repositoryConfiguration RepoConfig) bool {
if s.MultipleBranchesEnabled {
if "true" == s.MultipleBranchesEnabled {
return repositoryConfiguration.Provider == provider && repositoryConfiguration.Repo == repo && repositoryConfiguration.Branch == branch
}
return repositoryConfiguration.Provider == provider && repositoryConfiguration.Repo == repo
Expand Down
4 changes: 2 additions & 2 deletions pkg/settings/global/settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func TestSettings_GetRepoConfig(t *testing.T) {
},
"when feature flag enabled, search by provider and repo and branch": {
settings: Settings{
MultipleBranchesEnabled: true,
MultipleBranchesEnabled: "true",
RepoConfig: []RepoConfig{
{
Provider: "github",
Expand All @@ -106,7 +106,7 @@ func TestSettings_GetRepoConfig(t *testing.T) {
},
"when feature flag disabled, search just by provider and repo": {
settings: Settings{
MultipleBranchesEnabled: false,
MultipleBranchesEnabled: "false",
RepoConfig: []RepoConfig{
{
Provider: "github",
Expand Down
2 changes: 1 addition & 1 deletion pkg/web/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ func (wa *WebAPI) buildPipelines(

var ignoreFile IgnoreFile

if s.DinghyIgnoreRegexp2Enabled {
if "true" == s.DinghyIgnoreRegexp2Enabled {
ignoreFile = NewRegexp2IgnoreFile(ignoreFilePatterns, l)
} else {
ignoreFile = NewRegexpIgnoreFile(ignoreFilePatterns, l)
Expand Down
6 changes: 3 additions & 3 deletions pkg/web/routes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ func TestShouldRunValidationWhenBranchIsWrongAndIsMaster(t *testing.T) {
Ref: "master",
}
s := &global.Settings{
MultipleBranchesEnabled: true,
MultipleBranchesEnabled: "true",
DinghyFilename: "dinghyfile",
TemplateOrg: "test_org",
TemplateRepo: "test_repo",
Expand Down Expand Up @@ -696,7 +696,7 @@ func TestBuildPipelinesWhenDinghyIgnoreRegexp2Enabled(t *testing.T) {
},
},
GitHubToken: "test_github_token",
DinghyIgnoreRegexp2Enabled: true,
DinghyIgnoreRegexp2Enabled: "true",
}

sc := source.NewMockSourceConfiguration(c)
Expand Down Expand Up @@ -753,7 +753,7 @@ func TestBuildPipelinesWhenDinghyIgnoreRegexp2Disabled(t *testing.T) {
},
},
GitHubToken: "test_github_token",
DinghyIgnoreRegexp2Enabled: false,
DinghyIgnoreRegexp2Enabled: "false",
}

sc := source.NewMockSourceConfiguration(c)
Expand Down
Loading