From 70431473e3f50ad70c2cde0876b675fc1a7b7527 Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Fri, 18 Sep 2026 12:52:48 +0200 Subject: [PATCH 1/2] contest: faker: no need to combine infos Faker was used as a convenient place to do that, but at the end, this is not needed. Indeed, the UI can load separated JSON files -- safer in a way not to depend on multiple services to get the final file -- and two pw_contest services are now being used, using each info individually. So let's drop that. Signed-off-by: Matthieu Baerts --- contest/results-faker.py | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/contest/results-faker.py b/contest/results-faker.py index 753d51b..ae82e4e 100755 --- a/contest/results-faker.py +++ b/contest/results-faker.py @@ -16,37 +16,15 @@ [input] branches=/path/to/branches.json,/path/to/branches2.json -infos=/path/to/infos.json,/path/to/infos2.json [output] dir=/path/to/output url_pfx=relative/within/server -info=/path/to/info.json """ -def combine_infos(config): - paths = config.get("input", "infos", fallback="").split(',') - if not paths or not paths[0]: - return - - infos = {} - for path in paths: - with open(path, "r") as fp: - infos.update(json.load(fp)) - - # atomic write needed - path = config.get("output", "info") - tmp = path + '.new' - with open(tmp, 'w') as fp: - json.dump(infos, fp) - os.rename(tmp, path) - - def main() -> None: config = configparser.ConfigParser() config.read(['faker.config']) - combine_infos(config) - branches = [] paths = config.get("input", "branches") for path in paths.split(','): From dbc17cb31ef233cc567cbc24c6d52138ced8a80a Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Fri, 23 Oct 2026 11:12:07 +0200 Subject: [PATCH 2/2] contest: faker: only handle one branches file Now that we have two 'faker' services, each of them loads a single branches.json file, no need to handle more than one. By doing that, we can fallback to the right 'branches.json' file in the URL (even if it shouldn't be use as github.com is currently always used). Signed-off-by: Matthieu Baerts --- contest/results-faker.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/contest/results-faker.py b/contest/results-faker.py index ae82e4e..608b10c 100755 --- a/contest/results-faker.py +++ b/contest/results-faker.py @@ -15,7 +15,7 @@ Config: [input] -branches=/path/to/branches.json,/path/to/branches2.json +branches=/path/to/branches.json [output] dir=/path/to/output url_pfx=relative/within/server @@ -25,11 +25,9 @@ def main() -> None: config = configparser.ConfigParser() config.read(['faker.config']) - branches = [] - paths = config.get("input", "branches") - for path in paths.split(','): - with open(path, "r") as fp: - branches += json.load(fp) + path = config.get("input", "branches") + with open(path, "r") as fp: + branches = json.load(fp) branches = sorted(branches, key=lambda x: x["date"]) @@ -63,7 +61,7 @@ def main() -> None: if br["url"].startswith('https://github.com') and tail > 0: br_url = br["url"][:tail] + "/commits/" + br["url"][tail + 5:] else: - br_url = "https://netdev.bots.linux.dev/contest/branches.json" + br_url = "https://netdev.bots.linux.dev/contest/" + os.path.basename(path) run["results"] = [ {"test": "branch-created", "group": "---", "result": "pass", "link": br_url}