Hendrik
09/29/2025, 3:18 PMprefect deploy
multiple deployments defined in prefect.yaml that share certain tags. Something like prefect deploy --all but with another condition to only apply this for tags of ABCMarvin
09/29/2025, 3:18 PMMarvin
09/29/2025, 3:21 PMprefect deploy
can:
- deploy all deployments in your prefect.yaml
(--deploy-all
), and
- deploy a subset by name using patterns with --name/-n
.
It does not have a flag to filter which deployments to deploy by tags. The --tags
option sets/overrides tags on the deployments being created; it does not filter selection.
What you can do:
- If your deployment names share a common token, use a name pattern:
prefect deploy --name "my-flow/ABC-*"
or
prefect deploy -n "ABC-*"
The --name
flag supports patterns; examples in the help include things like my-deployment-*
and *-flow-name/deployment-*
.
- If you must filter by tags, use a small one-liner (requires yq) to read prefect.yaml
and deploy only those with tag ABC:
yq -r '.deployments[] | select(.tags[]? == "ABC") | .name' prefect.yaml | xargs -I{} prefect deploy -n {}
Or a quick Python script to parse prefect.yaml
and call prefect deploy -n ...
for matching names.
References:
- prefect.yaml guide
- prefect deploy CLI reference
If you can share how your deployments are named, I can suggest a --name
pattern that matches your “ABC” set.Hendrik
09/29/2025, 3:23 PMkl_
Marvin
09/29/2025, 3:23 PMMarvin
09/29/2025, 3:24 PMprefect deploy
.
If the deployment names in your prefect.yaml start with `kl_`:
prefect deploy --name "kl_*"
If you want to match deployment names that start with kl_
regardless of flow:
prefect deploy --name "*/kl_*"
If instead your flow names start with kl_
and you want all their deployments:
prefect deploy --name "kl_*/*"
Notes:
- Quote the pattern so your shell doesn’t expand it.
- Run from your project root (where prefect.yaml
lives).
Docs:
- prefect.yaml guide
- prefect deploy CLI referenceHendrik
09/29/2025, 3:31 PMMarvin
09/29/2025, 3:31 PMMarvin
09/29/2025, 3:32 PMprefect deployment run
takes a single deployment name (or id) at a time.
Workable CLI approaches:
- Bash/zsh (runs each deployment whose name ends with /kl_*):
prefect deployment ls \
| awk 'NR>2 && $1 ~ /\/kl_/ { print $1 }' \
| xargs -n1 -I{} prefect deployment run {}
- PowerShell:
prefect deployment ls `
| Select-String -Pattern '/kl_' `
| ForEach-Object {
$name = ($_ -split '\s+')[0]
prefect deployment run $name
}
Notes:
- The first column of prefect deployment ls
is the deployment’s full name <FLOW_NAME>/<DEPLOYMENT_NAME>
. We filter rows where the deployment part starts with kl_
.
- Add --watch
, --start-in
, --start-at
, or -p key=value
to each prefect deployment run
if needed, e.g.:
... | xargs -n1 -I{} prefect deployment run {} --watch
Docs:
- Deployment CLI reference
- prefect.yaml guide
If you prefer a more robust approach (avoiding parsing ls
output), I can share a tiny Python snippet that queries deployments via the API and triggers runs for those with names matching */kl_*
.