feat(jobs): authenticate registry image pulls

This commit is contained in:
2026-07-16 22:22:11 +02:00
parent a76789f34b
commit 93481bf9c5
2 changed files with 18 additions and 1 deletions
@@ -75,9 +75,21 @@ def resolve_environment(definition: JobDefinition) -> dict[str, str]:
return {**base, **(definition.env or {})}
def registry_auth() -> Optional[dict[str, str]]:
if (
settings.background_jobs_registry_username
and settings.background_jobs_registry_password
):
return {
"username": settings.background_jobs_registry_username,
"password": settings.background_jobs_registry_password,
}
return None
def pull_image(image: str) -> None:
try:
get_docker_client().images.pull(image)
get_docker_client().images.pull(image, auth_config=registry_auth())
logger.info("Pulled image '%s' from the registry.", image)
except Exception:
logger.warning(
+5
View File
@@ -55,6 +55,11 @@ class Settings(BaseSettings):
# (e.g. :latest) is picked up. Disable for local image development, where
# a locally built image would otherwise be overwritten by the registry.
background_jobs_pull_before_run: bool = True
# Credentials for pulling the job image from a private registry (e.g. the
# Nexus at docker.nes.uni-due.de). Needed because the runner pulls via the
# Docker SDK inside the service container, which has no `docker login` creds.
background_jobs_registry_username: Optional[str] = None
background_jobs_registry_password: Optional[str] = None
# Sentence Transformers config
sentence_transformers_model_name: str = "intfloat/multilingual-e5-base"