flat-zoo-31952
09/30/2020, 12:01 PMaloof-angle-91616
09/30/2020, 1:28 PMflat-zoo-31952
09/30/2020, 1:42 PMaloof-angle-91616
09/30/2020, 1:46 PMhundreds-father-404
09/30/2020, 5:14 PMflat-zoo-31952
10/02/2020, 2:55 PMhundreds-father-404
10/02/2020, 2:59 PMflat-zoo-31952
10/02/2020, 2:59 PMhundreds-father-404
10/02/2020, 3:03 PMpants.contrib
section of our repo, which meant that we maintained them and released them as distinct wheels. A downside of that approach imo was it being too much friction for people to upstream their plugins. And, honestly, it increased our maintenance burden a lot.
Now, I think the goal is to be more like Flake8, Pylint, MyPy, etc, where plugins live in dedicated repos. It’s possible/likely that Pants would still want to adopt certain high usage plugins, such as a Docker plugin, but that would likely be in a dedicated repoflat-zoo-31952
10/02/2020, 3:06 PMfiles
target that depends on the outer binary target for docker images, that seems like a pretty sane way to repeatably create a docker build context with Dockerfile, without too much fuss with pluginshundreds-father-404
10/02/2020, 3:09 PMi saw the idea of using a files targetIt’s pretty easy and cheap to create a new target type now, with the Target API. Much easier than v1 plugins and cleaner code. https://www.pantsbuild.org/docs/target-api-new-targets Actually only three lines of code:
class DockerTarget(Target):
alias = "docker"
core_fields = (Dependencies, Sources, MyCustomField)
and then about 3-4 lines of code per custom field that you want to defineflat-zoo-31952
10/02/2020, 3:09 PMhundreds-father-404
10/02/2020, 3:11 PM./pants package path/to/foo/Dockerfile
, that’s pretty easy to do. There’s a plugin hook that you use to work with the binary
goal (soon to be renamed to be package
). This guide has an example of running zip
, and instead you’d run docker
. https://www.pantsbuild.org/docs/plugins-binary-goal
We’d be happy to help with it. The implementation isn’t very difficult anymore, unlike v1. The hard part is scoping out the requirements / designing what support meansThe hard part is scoping out the requirements / designing what support meansThis is much easier for an internal plugin because you only need to solve your org’s problem. It doesn’t need to generalize as much
flat-zoo-31952
10/02/2020, 3:12 PMhundreds-father-404
10/02/2020, 3:18 PMBinaryPaths
to discover where docker
is already installed; you certainly won’t want to try to install Docker for the user like we do with other tools. When iterating, you can use a hardcoded path like /usr/bin/docker
.
And then you can move to the guide on using the hook for binary
. The guide includes an example of us adding Bash language support