mirror of https://github.com/k3s-io/k3s
Show all missing deps when publishing-bot has no listed dependencies
Before this, it only showed one dependency in the error message. Also, replace godeps.json with go.mod in the error message.k3s-v1.15.3
parent
e9ca60bf0d
commit
d474631e38
|
@ -23,7 +23,7 @@ import json
|
|||
import yaml
|
||||
|
||||
|
||||
def get_godeps_dependencies(rootdir, components):
|
||||
def get_gomod_dependencies(rootdir, components):
|
||||
all_dependencies = {}
|
||||
for component in components:
|
||||
with open(os.path.join(rootdir, component, "go.mod")) as f:
|
||||
|
@ -58,8 +58,9 @@ def main():
|
|||
components.append(component)
|
||||
components.sort()
|
||||
|
||||
godep_dependencies = get_godeps_dependencies(rootdir + '/staging/src/k8s.io/', components)
|
||||
rules_dependencies = get_rules_dependencies(rootdir + "/staging/publishing/rules.yaml")
|
||||
rules_file = "/staging/publishing/rules.yaml"
|
||||
gomod_dependencies = get_gomod_dependencies(rootdir + '/staging/src/k8s.io/', components)
|
||||
rules_dependencies = get_rules_dependencies(rootdir + rules_file)
|
||||
|
||||
processed_repos = []
|
||||
for rule in rules_dependencies["rules"]:
|
||||
|
@ -70,10 +71,10 @@ def main():
|
|||
raise Exception("cannot find master source branch for destination %s" % rule["destination"])
|
||||
|
||||
print("processing : %s" % rule["destination"])
|
||||
if rule["destination"] not in godep_dependencies:
|
||||
raise Exception("missing Godeps.json for %s" % rule["destination"])
|
||||
if rule["destination"] not in gomod_dependencies:
|
||||
raise Exception("missing go.mod for %s" % rule["destination"])
|
||||
processed_repos.append(rule["destination"])
|
||||
for dep in set(godep_dependencies[rule["destination"]]):
|
||||
for dep in set(gomod_dependencies[rule["destination"]]):
|
||||
found = False
|
||||
if "dependencies" in branch:
|
||||
for dep2 in branch["dependencies"]:
|
||||
|
@ -84,12 +85,12 @@ def main():
|
|||
found = True
|
||||
else:
|
||||
raise Exception(
|
||||
"destination %s does not have any dependencies (looking for %s)" % (rule["destination"], dep))
|
||||
"Please add %s as dependencies under destination %s in %s" % (gomod_dependencies[rule["destination"]], rule["destination"], rules_file))
|
||||
if not found:
|
||||
raise Exception("destination %s does not have dependency %s" % (rule["destination"], dep))
|
||||
raise Exception("Please add %s as a dependency under destination %s in %s" % (dep, rule["destination"], rules_file))
|
||||
else:
|
||||
print(" found dependency %s" % dep)
|
||||
items = set(godep_dependencies.keys()) - set(processed_repos)
|
||||
items = set(gomod_dependencies.keys()) - set(processed_repos)
|
||||
if len(items) > 0:
|
||||
raise Exception("missing rules for %s" % ','.join(str(s) for s in items))
|
||||
print("Done.")
|
||||
|
|
Loading…
Reference in New Issue