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 <felix.moessbauer@siemens.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
		
				
					committed by
					
						 Jan Kiszka
						Jan Kiszka
					
				
			
			
				
	
			
			
			
						parent
						
							33250866ec
						
					
				
				
					commit
					20a69016da
				
			| @@ -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') | ||||
|   | ||||
		Reference in New Issue
	
	Block a user