From b97ac3679bf7d32afff2f67ae9c373841582a7db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Po=C5=82awski?= Date: Tue, 10 Sep 2024 10:22:10 +0200 Subject: [PATCH] fedora-bot: Continue after failure Fedora Bot can handle more than one component to be processed. The components are processed one by one in the loop. When processing of component fails it breaks the loop. This commit fixes this adding exception for such case and continuing with the next component. --- fedora_bot.py | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/fedora_bot.py b/fedora_bot.py index 69765b8..3de8b95 100755 --- a/fedora_bot.py +++ b/fedora_bot.py @@ -317,24 +317,28 @@ def main(): parser.error(f"Invalid component format, must be PACKAGE:NUM_TESTS : {component_numtests}") print(f"\n--- {component} ---\n") - if args.apikey: - msg_info(f"Checking for open pull requests of {component}...") - merge_open_pull_requests(args, component, num_tests) - else: - msg_info("No Fedora account API key supplied - skipping merging of pull requests.") - - if args.user and args.password: # Only check Bodhi if credentials were supplied - msg_info(f"Checking for missing updates of '{component}'...") - missing_updates = get_missing_updates(component, fedoras) - - if missing_updates: - msg_info(f"Found missing updates in Bodhi: {missing_updates}") - publish_updates(args, component, missing_updates) - msg_ok(f"Tried to update {missing_updates}.") + try: + if args.apikey: + msg_info(f"Checking for open pull requests of {component}...") + merge_open_pull_requests(args, component, num_tests) else: - msg_ok("No releases found with missing updates.") - else: - msg_info("No Fedora credentials supplied - skipping Bodhi updates.") + msg_info("No Fedora account API key supplied - skipping merging of pull requests.") + + if args.user and args.password: # Only check Bodhi if credentials were supplied + msg_info(f"Checking for missing updates of '{component}'...") + missing_updates = get_missing_updates(component, fedoras) + + if missing_updates: + msg_info(f"Found missing updates in Bodhi: {missing_updates}") + publish_updates(args, component, missing_updates) + msg_ok(f"Tried to update {missing_updates}.") + else: + msg_ok("No releases found with missing updates.") + else: + msg_info("No Fedora credentials supplied - skipping Bodhi updates.") + except Exception as error: + print(f"Failure in processing component [{component}] - skipping") + print(f"Exception: {error=}, {type(error)=}") if __name__ == "__main__":