aboutsummaryrefslogtreecommitdiff
path: root/kolla
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2026-06-29 14:52:12 +0000
committerGerrit Code Review <review@openstack.org>2026-06-29 14:52:12 +0000
commit00d2e9671d38a147f77b639e8fcf1cb8903aea25 (patch)
tree8b849fdac9661a7d09a8d63637ddc7048ab464f9 /kolla
parent108660d64406067b5d066c612f5de882d45b0e24 (diff)
parenta1a3fdc1b54baf62f234ddc9dac4906e30eb5d11 (diff)
downloadkolla-00d2e9671d38a147f77b639e8fcf1cb8903aea25.tar.gz
kolla-00d2e9671d38a147f77b639e8fcf1cb8903aea25.zip
Merge "kolla-build: fix build-date LABEL invalidating Docker layer cache"
Diffstat (limited to 'kolla')
-rw-r--r--kolla/image/kolla_worker.py4
-rw-r--r--kolla/image/tasks.py1
-rw-r--r--kolla/tests/test_build.py2
3 files changed, 3 insertions, 4 deletions
diff --git a/kolla/image/kolla_worker.py b/kolla/image/kolla_worker.py
index b60f0558f..1c704d1cf 100644
--- a/kolla/image/kolla_worker.py
+++ b/kolla/image/kolla_worker.py
@@ -362,9 +362,6 @@ class KollaWorker(object):
for path in self.docker_build_paths:
template_name = "Dockerfile.j2"
image_name = path.split("/")[-1]
- ts = time.time()
- build_date = datetime.datetime.fromtimestamp(ts).strftime(
- '%Y%m%d')
values = {'base_distro': self.base,
'base_image': self.conf.base_image,
'base_distro_tag': self.base_tag,
@@ -390,7 +387,6 @@ class KollaWorker(object):
'users': self.get_users(),
'distro_package_manager': self.distro_package_manager,
'rpm_setup': self.rpm_setup,
- 'build_date': build_date,
'clean_package_cache': self.clean_package_cache,
'patches_path': self.patches_path}
env = jinja2.sandbox.SandboxedEnvironment(
diff --git a/kolla/image/tasks.py b/kolla/image/tasks.py
index 757197ef4..93ba91835 100644
--- a/kolla/image/tasks.py
+++ b/kolla/image/tasks.py
@@ -379,6 +379,7 @@ class BuildTask(EngineTask):
image.status = Status.BUILDING
image.start = datetime.datetime.now()
+ image.labels['build-date'] = image.start.strftime('%Y%m%d')
self.logger.info('Building started at %s' % image.start)
if image.source and 'source' in image.source:
diff --git a/kolla/tests/test_build.py b/kolla/tests/test_build.py
index e072860ab..e4e4d2839 100644
--- a/kolla/tests/test_build.py
+++ b/kolla/tests/test_build.py
@@ -82,6 +82,8 @@ class TasksTest(base.TestCase):
# Existing tests exercise the docker-py SDK path; disable BuildKit so
# they are not routed through _build_buildkit.
self.conf.set_override('buildkit', False)
+ # Mock build-date
+ self.build_kwargs['labels'] = {'build-date': mock.ANY}
@mock.patch.dict(os.environ, clear=True)
@mock.patch(engine_client)