From 9732ec16f23fb2b8e9537f5d6f495b2ac8470225 Mon Sep 17 00:00:00 2001 From: Jasper Orschulko Date: Tue, 24 Aug 2021 20:55:24 +0200 Subject: [PATCH] for_all_repos: Exit on command failure KAS should exit with the appropriate exit code, if the command parsed to the for_all_repos plugin fails to apply on one of the repositories. Example use-case: This allows for CI pipelines or wrapper scripts to take appropriate action (e.g. fail), if an issue occured within the KAS for_all_repos command. Signed-off-by: Jasper Orschulko Signed-off-by: Jan Kiszka --- kas/plugins/for_all_repos.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kas/plugins/for_all_repos.py b/kas/plugins/for_all_repos.py index d9374bc..7ec977c 100644 --- a/kas/plugins/for_all_repos.py +++ b/kas/plugins/for_all_repos.py @@ -55,6 +55,7 @@ import logging import subprocess +import sys from kas.context import create_global_context from kas.config import Config from kas.libcmds import Macro, Command @@ -105,6 +106,7 @@ class ForAllReposCommand(Command): env=env) if retcode != 0: logging.error('Command failed with return code %d', retcode) + sys.exit(retcode) __KAS_PLUGINS__ = [ForAllRepos]