prefect
prefect copied to clipboard
Ability to not overwrite CLI deployments
First check
- [X] I added a descriptive title to this issue.
- [X] I used the GitHub search to find a similar request and didn't find it.
- [X] I searched the Prefect documentation for this feature.
Prefect Version
2.x
Describe the current behavior
Currently if a deployment gets executed multiple times it overwrites settings done in the UI. This cause empty or maybe wrong schedules because the schedule was set initial by UI or it was changed. Also tags can be deleted and so on.
Describe the proposed behavior
There should be a --overwrite=False
flag which then just skips the deployment if it already exists.
Example Use
We like to deploy our flows via CI but won't make a deployment everytime we need to adjust the schedule. This adds additonal overhead (because of our deployment process and guidelines) and may cause in wrong configuration if someone needs to change the schedule by UI and forgot to change it in the deployment specs.
Additional context
No response
Hi @sti0! The ability to load an existing deployment was recently added to the Deployment
class, would exposing that flag via the CLI with a --load-existing
option handle your use case?
@bunchesofdonald note that new flag actually allows you to disable loading the existing deployment — our default behavior is to load it.
Oh great point @madkinsz.
@bunchesofdonald I don't think so. The idea behind my request is to not overwrite/execute the deployment again if it already exists. If I understand correctly the current behavior is:
- Create a new deployment eg. with tags
- Create the deployment again without tags
This results in still having the tags present in the deployment. But I don't think this is handy in CI context because we always execute the same pattern for CI deployments, right? So if a Tag gets added in the UI it will be overriden by the re-deployment. Same for schedule and so on.
@billpalombi this pairs well with previous discussion of "locking" deployments such that they cannot be edited in the UI. A --no-overwrite
flag seems reasonable to include on prefect deployment apply
.
@madkinsz To be clear, the --no-overwrite
flag would prevent the deployment from being updated by the command if a deployment of the same flow with the same name already exists? If so, I support that.