From 694c07af09eec1fdd21b3c53b99946f24311ea68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20J=C3=BCttner?= Date: Thu, 12 Mar 2026 11:00:29 +0100 Subject: [PATCH] sort files in cloudformation package when creating zip for consistent ordering across different os/filesystems --- awscli/customizations/cloudformation/artifact_exporter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/awscli/customizations/cloudformation/artifact_exporter.py b/awscli/customizations/cloudformation/artifact_exporter.py index 7fba8dddbba3..e5640424d488 100644 --- a/awscli/customizations/cloudformation/artifact_exporter.py +++ b/awscli/customizations/cloudformation/artifact_exporter.py @@ -186,7 +186,8 @@ def make_zip(filename, source_root): zip_file = zipfile.ZipFile(f, 'w', zipfile.ZIP_DEFLATED) with contextlib.closing(zip_file) as zf: for root, dirs, files in os.walk(source_root, followlinks=True): - for filename in files: + dirs.sort() + for filename in sorted(files): full_path = os.path.join(root, filename) relative_path = os.path.relpath( full_path, source_root)