Has anyone here done any work with using Pants to ...
# plugins
l
Has anyone here done any work with using Pants to manage infrastructure related projects? In particular I'm working on a repository that's got a bunch of PyInfra (pyinfra.com) code, and I want to be able to use Pants to manage it. This includes using Packer as the build tool to launch a host, configure it with the associated pyinfra package, and then execute a suite of testinfra tests against it. I'm also thinking of looking at collecting the test results from the build/test runs for managing longitudinal reporting.
w
there is a bit of information on this topic in this recent thread: https://pantsbuild.slack.com/archives/C01CQHVDMMW/p1611765054008300
the gist is that
@rule
code should be side-effect free (or at least idempotent), so making actual changes to infra should likely happen in a
@goal_rule
using
InteractiveProcess
(which runs in the foreground, and won’t be retried by pants)
f
i've moved recently to a fedora-heavy shop doing a lot of infra software, so i'm very eager to get the ball rolling on doing this too, but yeah the nature of
@rule
vs
@goal_rule
is going to make this all pretty interesting, since with infra stuff, much of your most important tests are very much side-effective
w
yea. a fair number of dockery things should be idempotent (image creation), so those can be pushed deeper as `@rule`s. it’s just the deployment that might not
the advantage to writing something as a
@goal_rule
rather than building a binary and then running it in a wrapper script will (in the medium term) be that you can use https://github.com/pantsbuild/pants/issues/9462#issuecomment-716821870 to run it in a
--watch
/
--loop
mode
there is some stuff in the way of that right now, but we’re planning to tackle it before the summer