Skip to content

Commit 94aa32a

Browse files
committed
Ensure existence of KEP metadata file
1 parent 6d84a64 commit 94aa32a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/repo/validate.go

+10
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package repo
1818

1919
import (
20+
"fmt"
2021
"os"
2122
"path/filepath"
2223

@@ -63,6 +64,7 @@ func (r *Repo) Validate() (
6364

6465
metadataFilename := ProposalMetadataFilename
6566
metadataFilepath := filepath.Join(dir, metadataFilename)
67+
6668
if _, err := os.Stat(metadataFilepath); err == nil {
6769
// There is KEP metadata file in this directory, only that one should be processed.
6870
if info.Name() == metadataFilename {
@@ -71,6 +73,14 @@ func (r *Repo) Validate() (
7173
}
7274
}
7375

76+
if info.Name() == ProposalFilename && dir != kepDir {
77+
// There is a proposal, we require metadata file for it.
78+
if _, err := os.Stat(metadataFilepath); os.IsNotExist(err) {
79+
kepErr := fmt.Errorf("metadata file missing for KEP: %s", metadataFilepath)
80+
valErrMap[metadataFilepath] = append(valErrMap[metadataFilepath], kepErr)
81+
}
82+
}
83+
7484
return nil
7585
},
7686
)

0 commit comments

Comments
 (0)