Hi! I'm trying to use `parametrize` together with ...
# general
f
Hi! I'm trying to use
parametrize
together with
cache_from
, but I get an odd error. I'm using pants
2.24.0
. If I don't parametrize, the following works fine:
Copy code
docker_image(
    name="img",
    instructions = [
        "FROM python:3.11.8-slim-bookworm",
    ],
    cache_from=[
        {
            "type": "local",
            "src": "/tmp/cache-a",
        },
        {
            "type": "local",
            "src": "/tmp/cache-b",
        }
    ],
    registries = [
        "testbuild"
    ]
)
But if I try to build the following:
Copy code
docker_image(
    name="img",
    instructions = [
        "FROM python:3.11.8-slim-bookworm",
    ],
    **parametrize(
        "local",
        cache_from=[
            {
                "type": "local",
                "src": "/tmp/cache-a",
            },
            {
                "type": "local",
                "src": "/tmp/cache-b",
            }
        ]
    ),
    registries = [
        "testbuild"
    ]
)
I get the following error:
Copy code
InvalidTargetException: BUILD:8: The 'cache_from' field in target //:img@parametrize=local must be a list of dictionaries (or a single dictionary) of string -> string, but was `(FrozenDict({'type': 'local', 'src': '/tmp/cache-a'}), FrozenDict({'type': 'local', 'src': '/tmp/cache-b'}))` with type `tuple`.
It seems to me that even if I do provide what it expects (a list of dictionaries of string -> string), it sees that as a tuple, not a list, and that's why it fails. Does anyone have an idea what could be going on here?