Jon Young
06/25/2026, 2:56 PMMarvin
06/25/2026, 2:56 PMMarvin
06/25/2026, 2:59 PMprefect deploy does not have a --dry-run option. I verified the CLI help, and there’s no dry-run/plan mode there.
What you can do in CI/CD is validate the deployment inputs before actually creating the deployment:
Recommended validation steps
1. Validate prefect.yaml parses and matches Prefect’s schema
2. Validate each flow entrypoint can be imported
3. Optionally validate against a staging/test Prefect workspace
4. Only then run prefect deploy
A practical pattern is:
bash
python validate_before_deploy.py
prefect deploy --prefect-file prefect.yaml --name my-deployment
A useful validation script is:
python
from pathlib import Path
import sys
import yaml
from prefect.flows import load_flow_from_entrypoint
from prefect.cli.deploy._config import _load_deploy_configs_and_actions
from rich.console import Console
console = Console()
def main():
prefect_file = Path("prefect.yaml")
if not prefect_file.exists():
console.print("prefect.yaml not found", style="red")
sys.exit(1)
try:
with open(prefect_file) as f:
config = yaml.safe_load(f)
console.print("YAML syntax OK", style="green")
except Exception as e:
console.print(f"YAML parse failed: {e}", style="red")
sys.exit(1)
try:
deploy_configs, _ = _load_deploy_configs_and_actions(
prefect_file=prefect_file,
console=console,
)
console.print(f"Deployment config OK: {len(deploy_configs)} deployment(s)", style="green")
except Exception as e:
console.print(f"Deployment config invalid: {e}", style="red")
sys.exit(1)
for dep in config.get("deployments", []):
entrypoint = dep.get("entrypoint")
if entrypoint:
try:
flow = load_flow_from_entrypoint(entrypoint)
console.print(f"Entrypoint OK: {entrypoint} -> {flow.name}", style="green")
except Exception as e:
console.print(f"Entrypoint failed: {entrypoint}: {e}", style="red")
sys.exit(1)
if __name__ == "__main__":
main()
A few notes:
- This catches most config/import problems early.
- It does not fully simulate the server-side creation of the deployment.
- If you want higher confidence, the best “real” dry run is deploying to a staging workspace first.
I also verified the CLI command exists here:
- prefect deploy --help
Relevant docs:
- Prefect 3 deployment docs
- prefect.yaml guide
If you want, I can give you a GitHub Actions or GitLab CI example for this validation flow.