I was able to dig into the Rules API this weekend ...
# general
I was able to dig into the Rules API this weekend and start making a docker image plugin 🎉, but i've run into a few issues that I might need to address: 1. Is there a way to make a
goal that doesn't require returning
? I don't want to have to do
docker save
or write the docker digest URLs to an arbitrary text file just to get this to work. 2. I'd like to have a meaningful interaction between pants cachine and docker caching, but i'm really not sure how to do that. I feel like i would want pants to create a
folder of some kind and keep re-using that same folder to let the docker cache do its work but I'm not sure how to accomplish that
(1) what output are you looking for? we could consider expanding the interface for the
task (this is very very possible), but we were thinking rather that instead we would move the act of "create a file to put in `dist/`" into a new
goal (see https://github.com/pantsbuild/pants/pull/10881 -- a very recent change). what are the commands you're currently running outside of pants to make this work, and what output is it producing?
(2) pants very recently supports exactly the use case you mention: see the design doc https://docs.google.com/document/d/1n_MVVGjrkTKTPKHqRPlyfFzQyx2QioclMG_Q3DMUgYk/edit#. it looks like we don't mention this in the docs at https://www.pantsbuild.org/docs/rules-api-process#process, yet! however, the python-level
dataclass has the same
option as in the rust code, and the rust code has documentation on how to use that field in the way you want, i think: https://github.com/pantsbuild/pants/blob/7fc06c3808c2daf4e80a24bf6d49e93ff0e96894/src/rust/engine/process_execution/src/lib.rs#L210.
👍 1
i'm not really sure what commands to run yet, still working that out
guess i'm finding it hard to load the rules API into my head, but i'll read that design doc
✍🏻 1
that is great feedback!
i understand interacting with a complex build system in a way that allows arbitrary actions that are also cacheable...that's a hard problem
👖 1
i find i tend to write pants plugins by running some commands in a row on the command line, and then trying to automate that part. that process can help if it's not clear what's being built.
👍 1
i'll try it that way
i am very excited about the rules API for this reason, and i (all of us) am trying to listen to exactly this kind of feedback so we can help users to understand why we think it's such a great foundation! it is still in beta for a reason though! so these kinds of incredibly thorough and specific comments are quite exciting for us to read :D