@@ -470,7 +470,7 @@
"step2" : {
"removevars" : ["SANITY_TESTED_DISTROS"],
"shortname" : "Compare AB workers and SANITY_TESTED_DISTROS",
- "EXTRACMDS" : ["${SCRIPTSDIR}/yocto-supported-distros --config-from-web --release-from-env --compare"]
+ "EXTRACMDS" : ["${SCRIPTSDIR}/yocto-supported-distros --config-from-web --release-from-env --compare --check-worker-statuses"]
}
},
"trigger-build-posttrigger" : {
@@ -39,6 +39,7 @@
# from a custom branch.
import argparse
+import json
import os
import re
import urllib.request
@@ -52,6 +53,7 @@ from urllib.error import HTTPError
CONFIG_REMOTE_URL = "https://git.yoctoproject.org/yocto-autobuilder2/plain/config.py"
+AUTOBUILDER_WORKERS_ENDPOINT = "https://autobuilder.yoctoproject.org/valkyrie/api/v2/workers"
def parse_arguments() -> argparse.Namespace:
@@ -80,6 +82,11 @@ def parse_arguments() -> argparse.Namespace:
action="store_true",
help="Get config.py from yoctoproject's git web interface")
+ parser.add_argument("--check-worker-statuses",
+ action="store_true",
+ default=False,
+ help="Also check the worker statuses using the Autobuilder API")
+
return parser.parse_args()
@@ -242,6 +249,40 @@ def _compare(ab_workers: set, poky_workers: set, stable_release: bool):
return ok
+def _filter_workers(possible_workers: Dict) -> Dict:
+ """
+ From the current dictionary of workers, remove the workers that are inactive
+ (disconnected) by checking the Autobuilder REST API.
+ """
+
+ _possible_workers = {}
+ workers_ab = None
+
+ try:
+ with urllib.request.urlopen(AUTOBUILDER_WORKERS_ENDPOINT) as r:
+ workers_ab = json.load(r).get("workers")
+ except (HTTPError, AttributeError) as e:
+ print(f"WARNING: Error when trying to fetch the worker statuses from {AUTOBUILDER_WORKERS_ENDPOINT}:")
+ print(e)
+ print("Safely exiting...")
+ exit(0)
+
+ if not workers_ab:
+ return possible_workers
+
+ def is_connected(worker):
+ for w_info in workers_ab:
+ if w_info.get("name") == worker and w_info.get("connected_to"):
+ return True
+
+ return False
+
+ for release in possible_workers:
+ _possible_workers[release] = [w for w in possible_workers[release] if is_connected(w)]
+
+ return _possible_workers
+
+
def main():
args = parse_arguments()
@@ -305,6 +346,9 @@ def main():
{release: _possible_workers(config.workers_prev_releases[release],
config.all_workers)})
+ if args.check_worker_statuses:
+ possible_workers = _filter_workers(possible_workers)
+
if args.compare:
assert len(releases) == 1, "Only one release should be passed for this mode"
release = releases[0]
Add a --check-worker-statuses flag to also check the workers statuses on the Autobuilder, and filter out any worker that is currently disconnected. This should help maintaining the config.py file in the Autobuilder. This is relevant for the master branch here as we do not need to maintain poky.conf as strictly on stable branches. This should warn the following on master, at the time of writing: WARNING: Missing on the autobuilder but listed in poky.conf: ubuntu-20.04 Meaning ubuntu-20.04 should be removed from poky.conf on meta-poky's master. Signed-off-by: Antonin Godard <antonin.godard@bootlin.com> --- config.json | 2 +- scripts/yocto-supported-distros | 44 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) --- base-commit: baa4a9a06acf544e91f4816fd0cca484a6f7dab7 change-id: 20250805-check-worker-statuses-b618c2078f9d Best regards, -- Antonin Godard <antonin.godard@bootlin.com>