We’ve got an old project on balena-io-playground which I’m going to be testing right now to check whether it’s still up-to-date. You can feel free to give it a try as well!
It relies on running curl against v3 of the API (we’re now on v4 as you can see in the docs but the endpoints are still up and working for v3), which relies on the BALENA_API_KEY variable being present inside the container. This in turn relies on setting the io.balena.features.balena-api label [1]
This looks perfect. That variable is already exposed properly.
Will the endpoint for V3 be up for a good amount of time? And does your internal support system support tagging this form post for an update if at some point in the future they are going to get shut down?
I will test it out if it works for my use-case tomorrow, but it seems like it should work fine and do exactly what I want.
Something else to note: server.js in that repo in fact uses the SDK as a node dependency, but that would require you to run node.
We generally intend to keep previous versions of the API up for quite a while. This is because we build our API on top of a pretty cool engine we wrote [1] which allows migrations to be defined between old data models and new ones. We can keep running the old API endpoints / methods / semantics while under the hood, everything gets converted forward to address the same schema which the latest version is running against.
Noticing how out of date this particular playground repo is, I’m actually going through and bringing it up-to-date right now, and should issue a PR shortly. Certain variables have changed their names, for example RESIN_ env vars are now BALENA_ (we changed our name last fall [2])
I was hoping to use the scripts in the folder as is and just call them from within python with the appropriate args. I shouldn’t need node for that I hope.
Thanks for bringing the repo up to date. I will check back when I see the pull request and test the integration then. I will post any feedback here.
(We do have both RESIN_ and BALENA_ env vars working, but I’ll be updating it nonetheless in that regard. The main thing is to use a modern base image, from the resin/ docker namespace to balenalib/which we use now[1]
Oh yeah, you can use the shell scripts which request tag changes via the API through curl, I just mentioned nodeJS in passing as interesting. I think it’s probably more convenient (and efficient on disk space) in your case to use curl than including the python SDK in your runtime image, especially since you only need this one method.