Getting the release version from inside an Fly app

I don’t currently see a way to get the release version that flyctl deploy prints from inside the app itself. This would be useful for observability purposes.

For reasons that you shouldn’t have to worry about, this is a lot harder than it should be. Those version numbers can change without actually restarting the app instances.

You can set an environment variable at deploy time, however. Doing something like this might get you what you need:

flyctl deploy -e APP_REVISION=$(git rev-parse --short HEAD)

That will set the $APP_REVISION env variable to the short git revision number.

Thank you, that’s exactly what I ended up doing.

1 Like