Supply build version via env variable

When deploying new versions of my app I can get the Fly.io instance ID via the FLY_ALLOC_ID but there is no way for me to know what version of the app is deploying easily when using continuous deployments via things like GitHub actions.

The fly CLI tool gives me a nice version/release that gets created each time (ie messages like v81 deployed successfully). It would be fantastic if this was supplied to the deployments as well so it can easily be printed via logs or something.

Thanks for fly though! Its absolutely fantastic and a real joy to deploy apps to!

1 Like

This is tricky for reasons you shouldn’t have to worry about!

Are you just trying to get a sense of what code is running? I know several people set an env variable from a git revision at deploy time. If that’s helpful, you can run something like:

fly deploy -e GIT_REVISION=$(git rev-parse --short HEAD)

We could almost just do this by default, I guess! It would make some sense to have that happen magically.

This works - but with this approach you wouldn’t know if a release were generated by a secret being changed.

1 Like

The git commit is a good idea! As @joshua mentions this doesn’t cover all situations but is a good middle ground for now.

Right! There can actually be releases that don’t restart VMs, so it’ll frequently change in a way that would put the environment variable out of sync.

We might be able to expose current version from an API, though, or even a DNS txt query. We can keep that updated at least!

2 Likes