Hello,
I've been deploying using YAML files via the CLI to Prefect Cloud. I noticed that when I remove a deployment from the YAML and redeploy, the deployment still exists in Prefect Cloud.
Does anyone know if there's a way to automatically delete deployments that are no longer in the YAML file during re-deployment?
Thanks!
j
James Sopkin
09/13/2023, 5:51 PM
I don’t believe that feature exists. You can implement a solution with ci/cd that could accomplish this though
James Sopkin
09/13/2023, 5:53 PM
I could imagine this being problematic as a default behavior if for example two developers were working on the same flow using different branches
b
Brian Newman
09/13/2023, 5:58 PM
Thanks for the quick reply.
I'm actually deploying via a CI/CD pipeline already, and the goal is to have deployments only when they come directly from that pipeline.
I agree that making this a default behavior could be problematic. However, having a flag for this functionality would be useful for use-cases like mine.
Are you thinking of in the CI/CD running the
Copy code
prefect deployment delete
command manually for each?
j
James Sopkin
09/13/2023, 6:03 PM
Yes, I'm sure you can script out some logic that runs that runs
prefect deployment ls
to grab existing deployments and then deletes the deployments not found in your prefect yaml
James Sopkin
09/13/2023, 6:03 PM
I don't have a working example of it, I wonder if someone already implemented this before
🙌 1
b
Brian Newman
09/14/2023, 2:26 PM
Howdy! Were you able to find an example of someone else doing this?
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.