https://pantsbuild.org/ logo
#general
Title
# general
c

curved-furniture-94140

06/30/2021, 7:20 AM
Hi there! We’re looking to move from multi-repo into a monorepo with pants, however I’m struggling to match pants with our current dev cycle which is very Docker heavy. We have a command that spins up a container with its source code, as well as any supporting containers (i.e. db), and then it runs all tests in there. As far as I understood, pants doesn’t have any current integrations with Docker so I’m wondering how I could achieve this workflow with minimal effort. I’m thinking something like
Copy code
src/project1
src/project2
src/lib/lib1
src/lib/lib2
...
where
project{n}
contain independently deployable applications, and
lib
contains shared libraries (projects can’t import each other’s code). Each
project{n}
has its own
Dockerfile
and
docker-compose.yml
. Now I probably also need a “global”
docker-compose.yml
that is extended by the one in each project. The difficulty now is how to follow Pant’s philosophy in this setup. For example, in pants I can change any file, and it will figure out what things need to be run. But in the setup I just explained, this won’t work, since pants doesn’t know which databases a particular project or library might require.
👀 1
s

shy-match-55049

06/30/2021, 3:08 PM
Very similar to what I'm trying to figure out - had some discussion with the devs in a thread above. Would like to see if you have any more ideas too
h

happy-kitchen-89482

06/30/2021, 5:53 PM
When you run tests in the container, what is the entry point? pytest for example?
1
What I'm getting at is distinguishing between "pants creates Docker images that run your tests without pants" vs "pants runs in a Docker image"...
Trying to understand the more useful mode
c

curved-furniture-94140

07/01/2021, 7:41 AM
When you run tests in the container, what is the entry point? pytest for example?
in our current way, it runs pytest as entrypoint. Tho another useful mode we use is where the container just returns a shell which allows the dev to run/debug things
What I’m getting at is distinguishing between “pants creates Docker images that run your tests without pants” vs “pants runs in a Docker image”...
indeed. Both seem to have pros/cons. To make things worse, the spinning up of auxiliary services by docker-compose depends on the test set. So I imagine there would be a need to declare the docker-compose services in
BUILD
.
h

happy-kitchen-89482

07/04/2021, 3:20 AM
Right, makes sense.
Thinking on this some more
6 Views