Device variable for current/target release

Is it possible to get the current deployment and target release as device environment variable? According this list ( and when list all variables (env) the release is not there.

Are there any plans to add this?


I think these indeed aren’t exposed as envvars, you can however user the Supervisor API to get them as described here:

Thanks for replying.
Using the supervisor api might be a solution (workaround) for accessing current application state. But when using the same code outside of balena a API call is not possible but setting envvars.

Probably you can take this as an idea for your roadmap? :smiley:

I will open an internal issue with your suggestion on exposing the current release hash as an env var.
On the other hand doing so for the target release is probably harder to do, since that would require a container restart every time the target release changes.
For now, in order to have a unified handling, you could probably have your container’s startup script to check whether the code is running on a balena device and if so use the supervisor api and set an env var.

Many thanks for your suggestions. By now the current release would be enough as I like to track my generated data to each device and release. So far the target is not really necessary for me.