From f03cec8af903f7553a4118865693f80d1f9c760a Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Tue, 25 Feb 2025 07:27:56 -0800 Subject: [PATCH] fix(script_mode): Use UTC timestamp for tar file attributes (#3154) Signed-off-by: Kevin Su --- flytekit/tools/script_mode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flytekit/tools/script_mode.py b/flytekit/tools/script_mode.py index 6580fa6462..3ed19982a1 100644 --- a/flytekit/tools/script_mode.py +++ b/flytekit/tools/script_mode.py @@ -10,7 +10,7 @@ import tarfile import tempfile import typing -from datetime import datetime +from datetime import datetime, timezone from pathlib import Path from types import ModuleType from typing import List, Optional, Tuple, Union @@ -73,7 +73,7 @@ def compress_scripts(source_path: str, destination: str, modules: List[ModuleTyp def tar_strip_file_attributes(tar_info: tarfile.TarInfo) -> tarfile.TarInfo: # set time to epoch timestamp 0, aka 00:00:00 UTC on 1 January 1980 # note that when extracting this tarfile, this time will be shown as the modified date - tar_info.mtime = datetime(1980, 1, 1).timestamp() + tar_info.mtime = datetime(1980, 1, 1, tzinfo=timezone.utc).timestamp() # user/group info tar_info.uid = 0