@@ -471,7 +471,7 @@ def run_command(self, command_query, command_retries, command_retry_delay, dry_r
471471 else :
472472 self .logger .info ("command query not configured, skipping command..." )
473473
474- def process_stack_exports (self , dry_run , output_file = None ):
474+ def process_stack_exports (self , dry_run , output_file = None , elapsed_time = None ):
475475 """
476476 Process root-level exports from manifest and write to JSON file
477477 """
@@ -483,18 +483,18 @@ def process_stack_exports(self, dry_run, output_file=None):
483483 manifest_exports = self .manifest .get ('exports' , [])
484484
485485 if dry_run :
486- total_vars = len (manifest_exports ) + 2 # +2 for stack_name and stack_env
486+ total_vars = len (manifest_exports ) + 3 # +3 for stack_name, stack_env, and elapsed_time
487487 self .logger .info (
488488 f"📁 dry run: would export { total_vars } variables to { output_file } "
489- f"(including automatic stack_name and stack_env )"
489+ f"(including automatic stack_name, stack_env, and elapsed_time )"
490490 )
491491 return
492492
493- # Collect data from global context
493+ # Collect data in specific order: stack metadata first, user exports, then timing
494494 export_data = {}
495495 missing_vars = []
496496
497- # Always include stack_name and stack_env automatically
497+ # Always include stack_name and stack_env automatically as first exports
498498 export_data ['stack_name' ] = self .stack_name
499499 export_data ['stack_env' ] = self .stack_env
500500
@@ -522,6 +522,10 @@ def process_stack_exports(self, dry_run, output_file=None):
522522 self .logger
523523 )
524524
525+ # Add elapsed_time as the final automatic export
526+ if elapsed_time is not None :
527+ export_data ['elapsed_time' ] = str (elapsed_time )
528+
525529 # Ensure destination directory exists
526530 dest_dir = os .path .dirname (output_file )
527531 if dest_dir and not os .path .exists (dest_dir ):
0 commit comments