Skip to content

Commit

Permalink
Merge pull request #1473 from spring-financial-group/feat/create_defa…
Browse files Browse the repository at this point in the history
…ult_merge_type

feat: add default merge type to config.go
  • Loading branch information
jenkins-x-bot authored Sep 1, 2022
2 parents 6bfea59 + deacbcf commit e5bed56
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions cmd/keeper/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The following configuration fields are available:
* `status_update_period`: The field specifies how often Tide will update GitHub status contexts.
Defaults to the value of `sync_period`.
* `queries`: List of queries (described below).
* `default_merge_method`: The default merge type for lighthouse to use, and the merge_method list will override this. Defaults to "merge"
* `merge_method`: A key/value pair of an `org/repo` as the key and merge method to override
the default method of merge as value. Valid options are `squash`, `rebase`, and `merge`.
Defaults to `merge`.
Expand Down
7 changes: 6 additions & 1 deletion pkg/config/keeper/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ type Config struct {
// Queries represents a list of GitHub search queries that collectively
// specify the set of PRs that meet merge requirements.
Queries Queries `json:"queries,omitempty"`
// The default merge type for lighthouse to use, and the merge_method list will override this. Defaults to "merge"
DefaultMergeType PullRequestMergeType `json:"default_merge_method,omitempty"`
// A key/value pair of an org/repo as the key and merge method to override
// the default method of merge. Valid options are squash, rebase, and merge.
MergeType map[string]PullRequestMergeType `json:"merge_method,omitempty"`
Expand Down Expand Up @@ -95,7 +97,7 @@ func (c *Config) MergeMethod(org, repo string) PullRequestMergeType {
return ov
}

return MergeMerge
return c.DefaultMergeType
}

return v
Expand Down Expand Up @@ -128,6 +130,9 @@ func (c *Config) MergeCommitTemplate(org, repo string) MergeCommitTemplate {

// Parse initializes and validates the Config
func (c *Config) Parse() error {
if c.DefaultMergeType == "" {
c.DefaultMergeType = MergeMerge
}
if c.SyncPeriodString == "" {
c.SyncPeriod = time.Minute
} else {
Expand Down
14 changes: 7 additions & 7 deletions pkg/config/lighthouse/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ type Config struct {

// TODO: Move this out of the main config.
Jenkinses []JenkinsConfig `json:"jenkinses,omitempty"`
// LighthouseJobNamespace is the namespace in the cluster that prow
// LighthouseJobNamespace is the namespace in the cluster that lighthouse
// components will use for looking up LighthouseJobs. The namespace
// needs to exist and will not be created by prow.
// needs to exist and will not be created by lighthouse.
// Defaults to "default".
LighthouseJobNamespace string `json:"prowjob_namespace,omitempty"`
// PodNamespace is the namespace in the cluster that prow
// PodNamespace is the namespace in the cluster that lighthouse
// components will use for looking up Pods owned by LighthouseJobs.
// The namespace needs to exist and will not be created by prow.
// The namespace needs to exist and will not be created by lighthouse.
// Defaults to "default".
PodNamespace string `json:"pod_namespace,omitempty"`
// LogLevel enables dynamically updating the log level of the
// standard logger that is used by all prow components.
// standard logger that is used by all lighthouse components.
//
// Valid values:
//
Expand All @@ -64,7 +64,7 @@ type Config struct {
OwnersDirExcludes *OwnersDirExcludes `json:"owners_dir_excludes,omitempty"`
// Pub/Sub Subscriptions that we want to listen to
PubSubSubscriptions PubsubSubscriptions `json:"pubsub_subscriptions,omitempty"`
// GitHubOptions allows users to control how prow applications display GitHub website links.
// GitHubOptions allows users to control how lighthouse applications display GitHub website links.
GitHubOptions GitHubOptions `json:"github,omitempty"`
// ProviderConfig contains optional SCM provider information
ProviderConfig *ProviderConfig `json:"providerConfig,omitempty"`
Expand Down Expand Up @@ -113,7 +113,7 @@ func (c *Config) Parse() error {

// InRepoConfig to enable configuration inside the source code of a repository
//
// this struct mirrors the similar struct inside prow
// this struct mirrors the similar struct inside lighthouse
type InRepoConfig struct {
// Enabled describes whether InRepoConfig is enabled for a given repository. This can
// be set globally, per org or per repo using '*', 'org' or 'org/repo' as key. The
Expand Down

0 comments on commit e5bed56

Please sign in to comment.