Hello!
Is there a way to get the release version that is running in a device? I see I can get the commit hash using the supervisor, but I’d love to get the actual release version like “2.0.1+rev2”, would that be possible?
thanks in advance!
Hello!
Is there a way to get the release version that is running in a device? I see I can get the commit hash using the supervisor, but I’d love to get the actual release version like “2.0.1+rev2”, would that be possible?
thanks in advance!
Hey there,
Assuming you are doing this from within a container running on the device (hence the mention of the supervisor), I think the easiest way will be to use the supervisor to retrieve the releaseID, then use the releaseID to request the data from the balena API.
To retrive the releaseID: Interacting with the balena Supervisor - Balena Documentation
Release resource documentation: Resources - Balena Documentation
You’ll see that the semver
field combined with the revision
field hold the information you need.
Example request:
curl -X GET \
"https://api.balena-cloud.com/v6/release(<ID>)" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <AUTH_TOKEN>"
Note to get a token (API key) supplied to your container, you can use the io.balena.features.balena-api
label, but I’m guessing you are already aware of this mechanism if you’ve been using the supervisor API. Read more here: docker-compose.yml fields - Balena Documentation
All that being said, if you feel that this should be easier (I would tend to agree with you if so), please submit a feature request here: https://feature-requests.balena.io/ - be sure to share your use case so we get a sense of how this information helps you. Cheers!
Hey @chrisys
Yeah, that works but as you said it’s quite cumbersome, one needs to enable two lables, and perform two different calls in order to fetch this field.
Since we are already baking some release info in the image (commit) I’m opening a feature request to add this version number too, let’s see what do others think.
thank you very much,
Pablo