Greetings @Mowlwurf,
Let me try and explain what I can.
What happens to the OSTree repo when the build environment is reset?
How is an installation and rollback possible on the device if the repo of the new package is completely reinitialized and has only one commit?
Do I have to save the repo before resetting the build environment? If yes: how do I import an existing OSTree repo when the build environment is freshly set up?
Or is the OSTree repo restored from the layer revision information (Custom meta layers, recipes and images in Yocto Project (hello-world examples) | Toradex Developer Center)?
When you do a build with OSTree enabled there should be an ostree repo in your deploy directory, named ostree_repo
by default. When you do a build from scratch it will initialize this repo for the first time and create a ref/branch and commit into this repo relating to the Yocto build you just did. If you delete the deploy directory then this will be remade from scratch. If you do another build without deleting it then it will re-use this repo as much as possible. This means subsequent branches and commits will be created in this repo. If your 2nd build uses the same branch name as the 1st build then some contents may get overwritten depending on the case.
All that said, you shouldn’t consider this ostree repo as “stable” if you want content to be retained long-term. What is proper is to instead transfer the content of the ostree repo from your build into a “master” ostree repo of sorts. This is actually what we do ourselves with our own CI/CD. When a build is first done we run some tests on the produced ostree content from that build to make sure it passes some basic sanity checks. If all is well, then we promote the ostree content from that build to a “master” ostree repo that contains all the ostree information accumulated from all our builds. We actually publish this master ostree repo here: Index of /ostree
For a more sturctured approach to ostree repo management in your buildsystem I would recommend this article from the ostree documentation: Writing a buildsystem and managing repositories | ostreedev/ostree
The best practices in this article is what we and many other distributions who use ostree follow.
After uploading a new package to the Torizon Cloud, a new lockbox with this new update package must be defined manually for offline updates (How to Use Secure Offline Updates with Torizon OS | Toradex Developer Center).
Is it possible to use TorizonCore-Builder to define the lockbox instead, so that a Yocto build and an offline update image can be created fully automatically using a script?
TorizonCore Builder can only download an already defined Lockbox. Defining Lockboxes happen server-side either via the Web UI or via using our API. If you want scriptable behavior then I would suggest taking a look at our API for our cloud services: Torizon Cloud API (Beta) | Toradex Developer Center
This will give you more flexibility in your CI/CD scripting/pipeline. A decent number of our other customers actually do just this in their own CI/CD pipelines, using the API to create/update lockboxes based on their builds.
It is possible that during the Yocto build the new package is automatically loaded into the Torizon cloud (Build Torizon OS from Source With Yocto Project/OpenEmbedded | Toradex Developer Center).
Is it also possible to set the name and version number of the package, as is supported by the TorizonCore builder (Signing and Pushing Torizon OS Packages to Torizon Cloud | Toradex Developer Center)?
Yes it is actually. The functionality for pushing the ostree from a Yocto build doesn’t actually come from us, it comes from this bbclass in meta-updater
: meta-updater/classes/image_types_ostree.bbclass at kirkstone · uptane/meta-updater · GitHub
Notice in the specific function I linked in that bbclass there’s 2 variables to control package name and version that will be used during the package upload. Namely GARAGE_TARGET_VERSION
and GARAGE_TARGET_NAME
, for package version and package name respectively.
By default GARAGE_TARGET_VERSION
will be set to the commit hash of the ostree commit that was generated in that build. GARAGE_TARGET_NAME
will be set to the ostree ref/branch name that was used during that build. These variables can be overridden by the user to other values of course. One word of caution though with GARAGE_TARGET_VERSION
specifically. You want to be careful with this variable as it can overwrite packages on the server side. For example say you do one build with package name “foo” and package version “bar”. If you do another build with the same name and same version, then the previous foo-bar package you uploaded will be overwritten by this new upload. If you didn’t save the previous build this can be problematic as you can imagine. Of course this is the same behavior with pushing packages with TorizonCore Builder. Just wanted to mention it for caution’s sake.
I know I just typed out quite a long response, but I hope it was helpful for your understanding of all this.
Best Regards,
Jeremias