Tim Andersson has proposed merging ~andersson123/autopkgtest-cloud:testinfo-json-dump into autopkgtest-cloud:master.
Requested reviews: Canonical's Ubuntu QA (canonical-ubuntu-qa) For more details, see: https://code.launchpad.net/~andersson123/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/484294 Add more information to testinfo.json; hopefully autopkgtest-cloud admins and developers find this useful! -- Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud:testinfo-json-dump into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker index 0b2739b..09469a5 100755 --- a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker +++ b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker @@ -330,13 +330,36 @@ def request_matches_per_package(package, arch, release, s): ) +def testinfo_information_injection( + testinfo: dict, + additional_params: dict, + cfg: configparser.ConfigParser, + big_package: bool, + release: str, + architecture: str, + test_uuid: str, +): + d["uuid"] = test_uuid + for key in KEYS_FOR_ADDITIONAL_PARAMS: + d[key] = additional_params.get(key) + d["worker-unit"] = os.environ.get("HOSTNAME") + d["datacenter"] = os.environ.get('SECGROUP').split("@")[1].split(".")[0].split("-")[0] + d["openstack-flavor"] = cfg.get("package_size_big" if big_package else "package_size_default") + d["openstack-image"] = f"adt/ubuntu-{release}-{host_arch(release, architecture)}-server" + return d + + def process_output_dir( dir, pkgname, code, triggers, test_uuid, - additional_params: dict = None, + additional_params: dict, + cfg: configparser.ConfigParser, + big_package: bool, + release: str, + architecture: str, ): """Post-process output directory""" @@ -380,9 +403,15 @@ def process_output_dir( json_err, ) d = {} - d["uuid"] = test_uuid - for key in KEYS_FOR_ADDITIONAL_PARAMS: - d[key] = additional_params.get(key) + d = testinfo_information_injection( + d, + additional_params, + cfg, + big_package, + release, + architecture, + test_uuid, + ) with open(os.path.join(dir, "testinfo.json"), "w") as testinfo: json.dump(d, testinfo, indent=True) @@ -1411,6 +1440,10 @@ def request(msg): params.get("triggers", []), test_uuid, additional_parameters, # embed additional parameters in testinfo.json + cfg, + big_pkg, + release, + architecture, ) # If two tests for the same package with different triggers finish at the
-- Mailing list: https://launchpad.net/~canonical-ubuntu-qa Post to : canonical-ubuntu-qa@lists.launchpad.net Unsubscribe : https://launchpad.net/~canonical-ubuntu-qa More help : https://help.launchpad.net/ListHelp