<@ULVA73B9P> is there a way for me to make prefect...
# ask-marvin
t
@Marvin is there a way for me to make prefect deploy fail if there are two deployments with the same name?
m
It seems that Prefect does not have a built-in mechanism to explicitly fail a deployment when there are two deployments with the same name. The command
prefect deploy
allows for deploying multiple deployments, even with the same name, by prefixing the deployment name with its flow name to differentiate them, as mentioned in the Prefect documentation. If you need to ensure unique deployment names, you might have to manually check existing deployment names before running the
prefect deploy
command, or create a custom script or CI/CD pipeline step that verifies uniqueness before allowing the deployment to proceed.
Copy code
plaintext
prefect deploy --name my_flow/deployment-1 --name my_other_flow/deployment-1
This suggests that you can have deployments with identical names as long as they belong to different flows. However, for deployments within the same flow, you should ensure that each deployment has a unique name.
n
hmm i might write a
pre-commit
hook for this. you could use
yaml
lib to load and inspect the deployment names and prevent commits that introduce deployments with the same name
t
@Nate I was planning to make this a cicd script but you're right about a prefect commit hook would be way better.