aboutsummaryrefslogtreecommitdiff
path: root/kolla
diff options
context:
space:
mode:
authorMichal Nasiadka <mnasiadka@gmail.com>2026-06-18 17:16:26 +0200
committerMichal Nasiadka <mnasiadka@gmail.com>2026-06-24 13:00:46 +0000
commit0e5deba69102d45d33bc43328dfa2410e6d9f9d9 (patch)
tree4de1d75055c581905261fb0975610d350d284e5b /kolla
parenta1a3fdc1b54baf62f234ddc9dac4906e30eb5d11 (diff)
downloadkolla-0e5deba69102d45d33bc43328dfa2410e6d9f9d9.tar.gz
kolla-0e5deba69102d45d33bc43328dfa2410e6d9f9d9.zip
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 <mnasiadka@gmail.com>
Diffstat (limited to 'kolla')
-rw-r--r--kolla/image/tasks.py3
1 files changed, 3 insertions, 0 deletions
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')