From 0e5deba69102d45d33bc43328dfa2410e6d9f9d9 Mon Sep 17 00:00:00 2001 From: Michal Nasiadka Date: Thu, 18 Jun 2026 17:16:26 +0200 Subject: kolla-build: normalize mtime in archive creation The reset_userinfo tar filter used when creating plugins and additions archives normalized uid/gid but left mtime untouched. Since archives are created after set_time() has already run, and the default working directory is a fresh temp dir per invocation, the embedded directory mtime was always the current time. Docker computes a content checksum for ADD instructions, so a different mtime in the tar produced a different checksum on every run. Fix by setting tarinfo.mtime = 0 in both reset_userinfo filters and calling os.utime(arc_path, (0, 0)) on the archive file after creation, making the archives binary-identical across runs for the same content. Change-Id: I205dab2c4a74fb9e3cb15c421d5c025849f5632a Signed-off-by: Michal Nasiadka --- kolla/image/tasks.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kolla/image/tasks.py b/kolla/image/tasks.py index 93ba91835..f8d07e221 100644 --- a/kolla/image/tasks.py +++ b/kolla/image/tasks.py @@ -201,6 +201,7 @@ class BuildTask(EngineTask): def reset_userinfo(tarinfo): tarinfo.uid = tarinfo.gid = 0 tarinfo.uname = tarinfo.gname = "root" + tarinfo.mtime = 0 return tarinfo if source.get('type') == 'url': @@ -355,10 +356,12 @@ class BuildTask(EngineTask): def reset_userinfo(tarinfo): tarinfo.uid = tarinfo.gid = 0 tarinfo.uname = tarinfo.gname = "root" + tarinfo.mtime = 0 return tarinfo with tarfile.open(arc_path, 'w') as tar: tar.add(items_path, arcname=arcname, filter=reset_userinfo) + os.utime(arc_path, (0, 0)) return len(os.listdir(items_path)) self.logger.debug('Processing') -- cgit v1.2.3