fix(cicd): preserve AIO tag in recovery snapshot
ci / Compose (pull_request) Successful in 15s
ci / Workflows (pull_request) Successful in 6s
ci / Shell (pull_request) Successful in 19s
ci / Formatting (pull_request) Successful in 30s
ci / Python and tests (pull_request) Successful in 8s
ci / YAML (pull_request) Successful in 10s
ci / Dockerfiles (pull_request) Successful in 4s
ci / Kubernetes (pull_request) Successful in 6s
ci / image-plan (pull_request) Skipped
ci / Image (${{ matrix.name }}) (pull_request) Skipped
ci / build (pull_request) Skipped

This commit is contained in:
forust committed 2026-10-07 16:53:14 +02:00
1 parent b08a0a927d
commit 64962d1a63
1 file changed
+7 -1
+7 -1
View File
@@ -45,6 +45,7 @@ def prepare(source_file):
before = json.loads(json.dumps(config)) before = json.loads(json.dumps(config))
for service, settings in config['services'].items(): for service, settings in config['services'].items():
reference = settings.get('image') reference = settings.get('image')
nextcloud_aio_master = project == 'nextcloud' and service == 'nextcloud-aio-mastercontainer'
if not reference or settings.get('build'): if not reference or settings.get('build'):
raise ValueError(f'{project}/{service}: Compose deploy requires a published image') raise ValueError(f'{project}/{service}: Compose deploy requires a published image')
image_repo = reference.split('@')[0].rsplit('/', 1) image_repo = reference.split('@')[0].rsplit('/', 1)
@@ -52,7 +53,7 @@ def prepare(source_file):
image_repo = '/'.join(image_repo) image_repo = '/'.join(image_repo)
# Nextcloud AIO validates the mastercontainer image reference and rejects # Nextcloud AIO validates the mastercontainer image reference and rejects
# a digest. Keep its configured tag so AIO can start and manage its stack. # a digest. Keep its configured tag so AIO can start and manage its stack.
if project == 'nextcloud' and service == 'nextcloud-aio-mastercontainer': if nextcloud_aio_master:
pinned = reference pinned = reference
elif image_repo in release['images']: elif image_repo in release['images']:
pinned = image_repo + '@' + release['images'][image_repo] pinned = image_repo + '@' + release['images'][image_repo]
@@ -79,6 +80,11 @@ def prepare(source_file):
actual.add(next((d for d in digests or [] if d.split('@')[0] == image_repo), image_id)) actual.add(next((d for d in digests or [] if d.split('@')[0] == image_repo), image_id))
if len(actual) > 1: if len(actual) > 1:
raise ValueError(f'{project}/{service}: mixed running images, cannot capture one recovery config') raise ValueError(f'{project}/{service}: mixed running images, cannot capture one recovery config')
# AIO also rejects a digest in its recovery config. Preserve its tag in
# both deploy and recovery files.
if nextcloud_aio_master:
before['services'][service]['image'] = reference
else:
before['services'][service]['image'] = next(iter(actual)) if actual else reference before['services'][service]['image'] = next(iter(actual)) if actual else reference
for name, data in (('compose', config), ('compose-before', before)): for name, data in (('compose', config), ('compose-before', before)):
folder = directory / name folder = directory / name