broad-processor-9240009/28/2022, 1:44 AM
rule and feeding it through https://github.com/pantsbuild/pants/blob/c5e902e6a630495c17e234012c001ed4f97b4173/src/python/pants/backend/docker/goals/package_image.py#L335 to set
... but I'm not sure of the right way to do this. 3. Once there's a schema and I know how to create a file, what's best way to actually create the JSON output? In our app, I'd define pydantic models and let pydantic handle the serialisation, rather than build dicts manually; is there something similar available in pants?
happy-kitchen-8948209/28/2022, 5:59 PM
at the top level and no need to think about it until we need to change it…
needs to happen on every run (the thing that is written out can be cached) as it is a requested side effect
curved-television-656809/28/2022, 6:23 PM
on an instance of that.
goal, then perhaps make it in the manner as for
, so that each implementation can add their specific data to it. It also ensures that it gets written every time without invalidating the cache of the package/publish rule. https://github.com/pantsbuild/pants/blob/cdf21fc69954aec999ed57ed988bf67a31148bf9/src/python/pants/backend/docker/goals/publish.py#L42 https://github.com/pantsbuild/pants/blob/cdf21fc69954aec999ed57ed988bf67a31148bf9/src/python/pants/core/goals/publish.py#L138-L145 https://github.com/pantsbuild/pants/blob/cdf21fc69954aec999ed57ed988bf67a31148bf9/src/python/pants/core/goals/publish.py#L279-L284
broad-processor-9240009/28/2022, 11:35 PM
directly sounds good. In terms of implementation, my impression is that
works well for something orchestrating pants (e.g. a CI script or interactively), but I think this output would be useful within pants, such as a test target wanting to use a docker image in
, or feeding into a deploy template synthesised within pants. I think this means it'd be useful as part of
output, and also that it can't just be
. Do I misunderstand?
./pants package --output whatever.json
curved-television-656809/29/2022, 1:25 PM
(or whatever the method should be called), so it’s accessible to rules/plugins as well without extra effort.
broad-processor-9240009/29/2022, 10:24 PM
curved-television-656809/29/2022, 10:44 PM
broad-processor-9240009/29/2022, 11:02 PM
to be able to access the docker image (to run it, and/or run some sort of introspection on it) 2. local development commands like starting a set of images via docker-compose (could be orchestrated via
) 3. infrastructure-as-code able to access this to generate a CloudFormation template or similar (could be a
, for instance) When an executable is packaged as a pex, it seems to be easy enough to depend on it via existing pants mechanisms. and it's be more than a bit annoying for executables that happen to be packaged via docker to require a custom plugin/rule. The original discussion talked about putting this info into
./pants run path/to/template_generator.py
like any other packaged artefact (which is a mechanism we're already using for other things, like pex executables and lambda zip packages), whereas this new mechanism I don't understand yet, hence asking questions to try to double check it satisfies what I hope it might 😄
curved-television-656809/29/2022, 11:56 PM
so that may be used as a file/resource input digest for dependees of that target.
broad-processor-9240010/20/2022, 9:37 PM