kind-angle-20894
02/01/2023, 12:04 PMtags:
- core-service-bc0b936
- document-service-ccb4811
- measurement-service-f8b293a
I have a number of questions:
• Can pants write to a file like this? I would assume that it can since writing files is kind of what a build system does. However, so far it seems to me that pants plugins should be functional, that is, without side effects. Their rules should take an input and return an output. So I guess a pants plugin can't do something like this? How would you then perform an operation like this? Do I actually want to write a goal rule, not a plugin rule?
• How do I figure out the input types I need? I guess I want to take in some kind of type that could be found in the docker pants plugin, but I don't know how I can figure out what the types mean. Perusing the source code to find the types I want would probably involve a lot of studying and thinking to reverse engineer the entire docker plugin, which feels very heavy.
Any help is greatly appreciated. I hope I don't come across too critical, I'm just kinda confused and feeling a bit hopeless. Pants seems cool and I've learned quite a bit about many of the concepts, but it still feels like I am miles away from doing anything useful. All I have after 10 hours of research is a hello world and a lot of notes to myself that may or may not make sense🥲bitter-ability-32190
02/01/2023, 12:10 PMbitter-ability-32190
02/01/2023, 12:10 PMkind-angle-20894
02/01/2023, 12:15 PMkind-angle-20894
02/01/2023, 12:16 PMkind-angle-20894
02/01/2023, 12:16 PMcurved-television-6568
02/01/2023, 12:49 PMwide-midnight-78598
02/01/2023, 1:35 PMSurely you are allowed to build any file you could dream of if you write a plugin for it?You probably CAN, but SHOULD you? 🙂 I'm wondering (like, genuinely wondering) if maybe you could run your scripts using an
experimental_shell_command? Using the rules that finish the docker builds, and then run a script that will do what you want? That way I think it should still be able to tell when your deps are dirty, and re-run as needed. ... I think.happy-kitchen-89482
02/01/2023, 4:52 PM@goal_rule can side-effect into files in your repo. So typically you'd write a custom goal that requests the metadata of the built Docker images (which will then cause them to be built if necessary) and writes that out into the yaml file. If the goal rule needs to call other rules, they can pass file contents back to it in the form of a Digest.happy-kitchen-89482
02/01/2023, 4:54 PMhappy-kitchen-89482
02/01/2023, 4:55 PMexperimental_shell_command (don't worry, this target type will soon be renamed to something less janky) that does what you need.happy-kitchen-89482
02/01/2023, 4:56 PMhappy-kitchen-89482
02/01/2023, 4:57 PMkind-angle-20894
02/02/2023, 9:33 AMOh, but one important question: In step 2, are the names of the services and the image tags of the docker images available outside of Pants, e.g., by inspecting the image in Docker directly? Or is this information only known to Pants as a byproduct of creating the images?I don't know where the tags are available. The idea is to use
--changed-since to only build changed code. After that I have no clue how to see which images were built.curved-television-6568
02/02/2023, 12:54 PMdist/
See: https://github.com/pantsbuild/pants/commit/23cc363a23ba5f0b1f934c2a6e2f498cf30ab0b6