github.com/zppinho/prow@v0.0.0-20240510014325-1738badeb017/pkg/plugins/ownersconfig/config.go (about) 1 /* 2 Copyright 2021 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package ownersconfig 18 19 // Filenames configures which file names should be used for the OWNERS and OWNERS_ALIASES 20 // concepts for a repo, if it's not the default set. 21 type Filenames struct { 22 Owners string `json:"owners,omitempty"` 23 OwnersAliases string `json:"owners_aliases,omitempty"` 24 } 25 26 const ( 27 DefaultOwnersFile = "OWNERS" 28 DefaultOwnersAliasesFile = "OWNERS_ALIASES" 29 ) 30 31 type Resolver func(org, repo string) Filenames 32 33 // FakeResolver fills in for tests that use a resolver but aren't testing it. 34 // This should not be used in production code. 35 func FakeResolver(_, _ string) Filenames { 36 return FakeFilenames 37 } 38 39 // FakeFilenames fills in for tests that need a Filenames but aren't testing them. 40 // While this *is* the default Filenames, production code should not use this var 41 // and instead expect to get the default set of filenames when using a resolver. 42 var FakeFilenames = Filenames{ 43 Owners: DefaultOwnersFile, 44 OwnersAliases: DefaultOwnersAliasesFile, 45 }