OK, so for our Dockerfile parsing support, I think...
# development
c
OK, so for our Dockerfile parsing support, I think it’ll be worth while to write a small Go program, leveraging the official moby/buildkit parser to produce a parsed representation of a Dockerfile. • Does this tool fit to live in the pants source tree, or is it better suited some place else? • How far along is the Go support in pants? does it work for small simple apps yet, or is it better to roll something on the side.. There’ll likely be a ton of other question with regard to building and distributing another binary.. but will take one thing at a time.
h
What would the small Go program be doing that buildkit does not do? I'm wondering if we could directly run buildkit, which would make it easier to install the parser if they release pre-built binaries And if the wrapper must be in Go or could be Bash/Python wrapping it?
How far along is the Go support in pants? does it work for small simple apps yet, or is it better to roll something on the side..
It does. Although, we're planning to change it so that Pants (for now) stops installing Go and requires you to have it already installed and discoverable due to performance issues. Meaning, we'd need your custom Go binary to be pre-built and can't rely on Pants building the binary dynamically
c
I’ll have to check if the buildkit supports dumping the AST, but I haven’t seen any commands that expose the AST tree at the level of detail I want. (there’s a test util that dumps some of the information, but not in a really useful way) We’d have write it in Go to make use of the lib code in buildkit (or, I don’t know of any other way to consume it at least.. 🙂 )
👍 1
Regarding Go build support, I was thinking that it would be built along with pants itself, so no need for a Go compiler on the user end.
👍 1
h
We have infrastructure for hosting binaries like this. Of course, we always prefer to not, but if necessary we'll do it
👍 1
c
Hmm… maybe this is the answer https://github.com/asottile/dockerfile/tree/master/pylib As it bridges from Go to Python, with the end result being a whl that is installable from pypi without any other requirements…
Will require a Go compiler when building the whl, but that should be fine, right?
h
oh and Anthony Sottile is a well-known dev. I feel comfortable depending on something maintained by them
Will require a Go compiler when building the whl, but that should be fine, right?
It releases bdists already 🙂 https://pypi.org/project/dockerfile/#files. But ARM users (like M1s) would need to compile it. See this line: https://github.com/asottile/dockerfile/blob/4230890bcf08a0d91134898da7a671529131c6fe/setup.cfg#L25
e
@curved-television-6568 that's the 1st option I researched / listed here https://github.com/pantsbuild/pants/pull/12866#issuecomment-918146524
c
Yep, I realize that. 😉
I’ve soon gone full circle, and come back to that….
Sorry, if I bring you along on a bumpy ride..
e
No, that's totally fine. I have bumpy rides too, but I tend to have them internally. Lots of folks like to have others to bounce off of.
1
👍 1