Files
computer-playbook/utils/docker/image/custom.py
T
kevinveenbirkenbachandClaude Opus 5.5 96fe8bd7e6 feat(playbooks/update): pull the images of the deploy before the upgrade window
pull.yml pulls, on the target host, every pinned image of the applications the host deploys, the same closure the update check judges, and lists the images a role builds itself instead. It never touches a container, retries each pull a bounded number of times and fails loudly with the image and the registry error. The update_check filter moves next to the new update_pull filter into plugins/filter/update/, and both read the code pins from one helper.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 21:30:18 +02:00

26 lines
840 B
Python

from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from collections.abc import Callable
def custom_image_name(custom, entity_name: Callable[[], str]) -> str:
"""Name of the image a service declaring ``custom`` builds locally.
Args:
custom: the service's truthy ``custom`` value. A non-empty string names
the image, any other value names it after the role's entity.
entity_name: returns the entity name of the role that builds the image,
called only when ``custom`` names no image itself.
Returns:
``<base>_custom``, or ``""`` when the base is empty.
"""
if isinstance(custom, str) and custom.strip():
base = custom.strip()
else:
base = str(entity_name()).strip()
return f"{base}_custom" if base else ""