in prow/plugins/config.go [1625:1775]
func ResolveBugzillaOptions(parent, child BugzillaBranchOptions) BugzillaBranchOptions {
output := BugzillaBranchOptions{}
if child.ExcludeDefaults == nil || !*child.ExcludeDefaults {
// populate with the parent
if parent.ExcludeDefaults != nil {
output.ExcludeDefaults = parent.ExcludeDefaults
}
if parent.ValidateByDefault != nil {
output.ValidateByDefault = parent.ValidateByDefault
}
if parent.IsOpen != nil {
output.IsOpen = parent.IsOpen
}
if parent.TargetRelease != nil {
output.TargetRelease = parent.TargetRelease
}
if parent.ValidStates != nil {
output.ValidStates = parent.ValidStates
}
if parent.Statuses != nil {
output.Statuses = parent.Statuses
output.ValidStates = mergeStatusesIntoStates(output.ValidStates, parent.Statuses)
}
if parent.DependentBugStates != nil {
output.DependentBugStates = parent.DependentBugStates
}
if parent.DependentBugStatuses != nil {
output.DependentBugStatuses = parent.DependentBugStatuses
output.DependentBugStates = mergeStatusesIntoStates(output.DependentBugStates, parent.DependentBugStatuses)
}
if parent.DependentBugTargetReleases != nil {
output.DependentBugTargetReleases = parent.DependentBugTargetReleases
}
if parent.DeprecatedDependentBugTargetRelease != nil {
logrusutil.ThrottledWarnf(&warnDependentBugTargetRelease, 5*time.Minute, "Please update plugins.yaml to use dependent_bug_target_releases instead of the deprecated dependent_bug_target_release")
if parent.DependentBugTargetReleases == nil {
output.DependentBugTargetReleases = &[]string{*parent.DeprecatedDependentBugTargetRelease}
} else if !sets.NewString(*parent.DependentBugTargetReleases...).Has(*parent.DeprecatedDependentBugTargetRelease) {
dependentBugTargetReleases := append(*output.DependentBugTargetReleases, *parent.DeprecatedDependentBugTargetRelease)
output.DependentBugTargetReleases = &dependentBugTargetReleases
}
}
if parent.StatusAfterValidation != nil {
output.StatusAfterValidation = parent.StatusAfterValidation
output.StateAfterValidation = &BugzillaBugState{Status: *output.StatusAfterValidation}
}
if parent.StateAfterValidation != nil {
output.StateAfterValidation = parent.StateAfterValidation
}
if parent.AddExternalLink != nil {
output.AddExternalLink = parent.AddExternalLink
}
if parent.StatusAfterMerge != nil {
output.StatusAfterMerge = parent.StatusAfterMerge
output.StateAfterMerge = &BugzillaBugState{Status: *output.StatusAfterMerge}
}
if parent.StateAfterMerge != nil {
output.StateAfterMerge = parent.StateAfterMerge
}
if parent.StateAfterClose != nil {
output.StateAfterClose = parent.StateAfterClose
}
if parent.AllowedGroups != nil {
output.AllowedGroups = sets.NewString(output.AllowedGroups...).Insert(parent.AllowedGroups...).List()
}
}
// override with the child
if child.ExcludeDefaults != nil {
output.ExcludeDefaults = child.ExcludeDefaults
}
if child.ValidateByDefault != nil {
output.ValidateByDefault = child.ValidateByDefault
}
if child.IsOpen != nil {
output.IsOpen = child.IsOpen
}
if child.TargetRelease != nil {
output.TargetRelease = child.TargetRelease
}
if child.ValidStates != nil {
output.ValidStates = child.ValidStates
}
if child.Statuses != nil {
output.Statuses = child.Statuses
if child.ValidStates == nil {
output.ValidStates = nil
}
output.ValidStates = mergeStatusesIntoStates(output.ValidStates, child.Statuses)
}
if child.DependentBugStates != nil {
output.DependentBugStates = child.DependentBugStates
}
if child.DependentBugStatuses != nil {
output.DependentBugStatuses = child.DependentBugStatuses
if child.DependentBugStates == nil {
output.DependentBugStates = nil
}
output.DependentBugStates = mergeStatusesIntoStates(output.DependentBugStates, child.DependentBugStatuses)
}
if child.DependentBugTargetReleases != nil {
output.DependentBugTargetReleases = child.DependentBugTargetReleases
}
if child.DeprecatedDependentBugTargetRelease != nil {
logrusutil.ThrottledWarnf(&warnDependentBugTargetRelease, 5*time.Minute, "Please update plugins.yaml to use dependent_bug_target_releases instead of the deprecated dependent_bug_target_release")
if child.DependentBugTargetReleases == nil {
output.DependentBugTargetReleases = &[]string{*child.DeprecatedDependentBugTargetRelease}
} else if !sets.NewString(*child.DependentBugTargetReleases...).Has(*child.DeprecatedDependentBugTargetRelease) {
dependentBugTargetReleases := append(*output.DependentBugTargetReleases, *child.DeprecatedDependentBugTargetRelease)
output.DependentBugTargetReleases = &dependentBugTargetReleases
}
}
if child.StatusAfterValidation != nil {
output.StatusAfterValidation = child.StatusAfterValidation
if child.StateAfterValidation == nil {
output.StateAfterValidation = &BugzillaBugState{Status: *child.StatusAfterValidation}
}
}
if child.StateAfterValidation != nil {
output.StateAfterValidation = child.StateAfterValidation
}
if child.AddExternalLink != nil {
output.AddExternalLink = child.AddExternalLink
}
if child.StatusAfterMerge != nil {
output.StatusAfterMerge = child.StatusAfterMerge
if child.StateAfterMerge == nil {
output.StateAfterMerge = &BugzillaBugState{Status: *child.StatusAfterMerge}
}
}
if child.StateAfterMerge != nil {
output.StateAfterMerge = child.StateAfterMerge
}
if child.StateAfterClose != nil {
output.StateAfterClose = child.StateAfterClose
}
if child.AllowedGroups != nil {
output.AllowedGroups = sets.NewString(output.AllowedGroups...).Insert(child.AllowedGroups...).List()
}
// Status fields should not be used anywhere now when they were mirrored to states
output.Statuses = nil
output.DependentBugStatuses = nil
output.StatusAfterMerge = nil
output.StatusAfterValidation = nil
return output
}