Hi all. I'm using Pants for CI with Github Actions...
# general
p
Hi all. I'm using Pants for CI with Github Actions and it is working great (do all the formatting, linting, type-checking, testing using Pants). But I'm currently lacking a proper CD pipeline. We have a Python Monorepo, with individual Microservices located in a services folder and common code located inside lib. Right now we deploy code by running a gcloud builds submit command against a cloudbuild.yaml file. Each service has it's own cloudbuild.yaml file and during the time of deployment the developer deploying the code determines which service(s) they need to deploy. My goal is to automate this entire process, so that depending on what has changed in code the correct service(s) are deployed through Cloud Build and Cloud Deploy (we are using GCP). I can probably manage building the Cloud Build and Cloud Deploy workflows but what I'm having an issue with is figuring out how I could use pants (probably the --change-since command) to figure out which services I want to deploy. If anyone has any ideas on how I can do this, general suggestions around how I'm going about things or resources (open-source repos) related to this, that would be extremely helpful. Thank you.
g
I can't share our code verbatim, but I can offer some guidance! We use Python to automate Pants, by letting Pants build the script. By that I mean using Pants to build a .pex that then invokes Pants to run various scripted commands. We do this, and the resulting pex: • Uses a combination of target-filtering and changed-since to find out what containers have changed • Builds and publishes those containers • Captures the metadata and publishes to our CD systems We do publish from inside Pants though, so that likely makes it easier. I imagine you'll want to check if the entrypoint per service has changed "transitively", and then submit the build from that?
💡 2
p
Copy code
I imagine you'll want to check if the entrypoint per service has changed "transitively", and then submit the build from that?
Yup. But I find what you're doing very interesting, although to be honest I don't fully understand how you're doing this. Is there any article / documentation you used to come up with this solution? If there is can you please share those resources?