add more validation to rules.yaml

We need to better catch problems like the one we fixed in:
7b6a3d6a33

Essentially a copy-paste error where had a branch pointing to staging/src/k8s.io/code-generator instead of staging/src/k8s.io/apimachinery

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
This commit is contained in:
Davanum Srinivas 2022-11-29 15:07:28 -05:00
parent 7061704297
commit ffef2d1f1a
No known key found for this signature in database
GPG Key ID: 80D83A796103BF59

View File

@ -81,6 +81,10 @@ def main():
# And skip validation of publishing rules for it
continue
for item in rule["branches"]:
if not item["source"]["dir"].endswith(rule["destination"]):
raise Exception("copy/paste error `%s` refers to `%s`" % (rule["destination"],item["source"]["dir"]))
if branch["name"] != "master":
raise Exception("cannot find master branch for destination %s" % rule["destination"])
if branch["source"]["branch"] != "master":