Pin CMS build to accepted Node ancestor and verify image config before recreate

This commit is contained in:
DCCONSTRUCTIONS
2026-11-04 23:49:06 +03:00
parent 0998d76428
commit bf3c2444ae
7 changed files with 379 additions and 21 deletions
-15
View File
@@ -55,21 +55,6 @@ class CmsRunnerTests(unittest.TestCase):
self.assertIn('--dc-cms-autodeploy-tick',r.cms_autodeploy_units()[r.CMS_AUTODEPLOY_SERVICE])
self.assertEqual(r.CMS_AUTODEPLOY_DESCRIPTOR['publishedPorts'],[])
def test_build_context_excludes_projects_and_credentials(self):
with tempfile.TemporaryDirectory() as tmp:
root=Path(tmp);entries,_=fixture(root)
for name in ('Dockerfile','package.json','package-lock.json'):(root/name).write_text('fixture')
(root/'projects/sites').mkdir(parents=True);(root/'projects/secret.json').write_text('never copy')
(root/'server/@eaDir').mkdir();(root/'server/@eaDir/admin-server.mjs@SynoEAStream').write_text('never copy metadata')
before={'entries':entries,'runtime':{'imageRef':'dc-cms-cms-app'}}
def build(cmd,**kwargs):
context=Path(cmd[-1]);self.assertEqual(list((context/'projects').iterdir()),[])
self.assertEqual(set(p.relative_to(context).as_posix() for p in context.rglob('*') if p.is_file()),set(entries)|{'Dockerfile','package.json','package-lock.json'})
self.assertEqual(cmd[:2],[str(r.DOCKER),'build'])
with patch.object(r,'CMS_ROOT',root),patch.object(r,'TMP_DIR',root),patch.object(r.subprocess,'run',side_effect=build),patch.object(r,'docker_json',return_value=[{'Id':'sha256:built'}]):
r.build_cms_release(before)
self.assertEqual(before['builtImageId'],'sha256:built')
def test_no_dependency_recreation_or_rollback_rebuild(self):
with patch.object(r.subprocess,'run') as run:
r.run_cms_release_compose()