From 20a69016da0c21c542485b222daff47d5ae1e9db Mon Sep 17 00:00:00 2001 From: Felix Moessbauer Date: Sun, 11 Dec 2022 08:30:33 +0100 Subject: [PATCH] dump plugin: add option to capture current env This patch adds the option --resolve-env to the dump plugin. When enabled, all variables in the 'env' section of the kas config file are set to the captured value (at time of executing the dump plugin). This helps to debug build issues on CI runners by precisely capturing the relevant environment. Signed-off-by: Felix Moessbauer Signed-off-by: Jan Kiszka --- kas/plugins/dump.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kas/plugins/dump.py b/kas/plugins/dump.py index 61ca3c1..3773484 100644 --- a/kas/plugins/dump.py +++ b/kas/plugins/dump.py @@ -105,6 +105,9 @@ class Dump(Checkout): parser.add_argument('--resolve-refs', action='store_true', help='Replace floating refs with exact SHAs') + parser.add_argument('--resolve-env', + action='store_true', + help='Set env defaults to captured env value') def run(self, args): args.skip += [ @@ -128,6 +131,9 @@ class Dump(Checkout): if r.refspec: config_expanded['repos'][r.name]['refspec'] = r.revision + if args.resolve_env and 'env' in config_expanded: + config_expanded['env'] = ctx.config.get_environment() + if args.format == 'json': json.dump(config_expanded, sys.stdout, indent=args.indent) sys.stdout.write('\n')