quaint-telephone-89068
11/15/2022, 12:22 PM./pants package some/path:some_docker_image (and/or published via ./pants publish ...). This is unfortunate when the image repositories and/or tags are dynamic, or if one wants to use the image ID. In particular, machine use of this info (e.g. using it in terraform/cloudformation/... templates) seems to require parsing the human-focused output of the pants commands.
There's currently no record of a docker image being packaged in dist/, since the image itself is managed/stored by docker itself.
This was discussed in slack at https://pantsbuild.slack.com/archives/C046T6T9U/p1663916571660779.
Describe the solution you'd like
There was a suggestion of writing out a JSON file like dist/some.path/some_docker_image.docker_info.json that contains metadata about the image, effectively acting as a "link" to the compiled artefact.
For example:
{
"repositories": ["example.repo"]
"image_tags": ["pants-hash-123456789", "latest"]
"image_id": "1234567890"
}
Questions:
• should this be versioned somehow?
• anything else to include?
• is there a different format that may work better? (e.g. I imagine it may be common to want to use a shell script to interpret this output)
Describe alternatives you've considered
None, yet.
Additional context
#14657 may be tangentially related, since I could imagine it may result in layers being written out to dist/ (maybe?).
pantsbuild/pantsuser
11/15/2022, 12:22 PM