Associate deployment versions with flow runs
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
Today, Deployment.version and FlowRun.flow_version are intended to be entirely user-managed fields that Prefect intentionally does not modify. Prefect also does not carry deployment versions onto the flow runs created by that deployment. Thus it can be a challenge to understand which version of a deployment created a specific flow run without correlating their update times, etc.
Describe the proposed behavior
There are a few ways we can approach this, I'll just propose one: Add an optional FlowRun.deployment_version and populate it with the value of Deployment.version for any flow run created from a deployment (via quick run, schedules, etc). The field would be read-only at the API, signaling that it is set by the system and not by users.
Example Use
No response
Additional context
This stemmed from a conversation with a community member in our Slack: https://prefect-community.slack.com/archives/CM28LL405/p1707837916522559
Example Use:
Answer the question "what version of my flow code ran for this flow run?"
This would be very usefull! We have the git commit tag as the deployment version so this would give super tracebility!