pantsbuild / pants

The Pants Build System
https://www.pantsbuild.org
Apache License 2.0
3.19k stars 613 forks source link

Docker registry aliases not available inside `cache_from`/`cache_to` inside macro #21082

Open sureshjoshi opened 2 weeks ago

sureshjoshi commented 2 weeks ago
[docker.registries.ghcr]
address = "ghcr.io/robotpajamas"
def docker_image_ghcr(name: str, **kwargs) -> None:
    REPO_NAME = "Dockerfiles"

    cache_from = kwargs.pop(
        "cache_from",
        {
            "type": "registry",
            "ref": f"@ghcr/{REPO_NAME}/{name}/build-cache:main",
        },
    )
    cache_to = kwargs.pop(
        "cache_to",
        {
            "type": "registry",
            "mode": "max",
            "ref": f"@ghcr/{REPO_NAME}/{name}/build-cache:main",
        },
    )

    docker_image(  # noqa: F821
        name=f"{name}-ghcr",
        cache_from=cache_from,
        cache_to=cache_to,
        **kwargs,
    )

Leads to an error:

ERROR: failed to solve: failed to configure registry cache exporter: invalid reference format