Build and publish on a build host
This page shows how to build Templates and Platforms with kibo-build on a separate build host, then hand the output to an Operator to publish to the catalog. Both image builders and Operators take part in this flow.
- To build your first Template and go from an OCI image all the way to creating a Workspace, see Build your own Template.
- For approval and default revision settings after publishing, see Catalog.
Overview
Building and publishing are split across two machines and two accounts:
- The build host runs
kibo-buildas root and produces Template results and Platform archives. It needs no Operator, ctrl, or store credentials. - The Operator takes the output and uploads it to the catalog from their own workstation with
kibo template publishandkibo platform publish.
Build tools and Debian packages
At startup, kibo-build checks for the host tools it needs. The tools each kind of build needs, and their Debian/Ubuntu packages:
| Build type | Required commands | Installed from |
|---|---|---|
| Platform builds from the source tree | git, find, sha256sum, stat | git, findutils, coreutils |
| The guest and bootstrap | go | Install the exact Go version from mise.toml. The distribution's Go cannot be used |
| Template content, Firecracker Platform | bash, docker, jq, Docker Buildx | bash, docker.io, docker-buildx, jq |
| KiboVM standalone kernel | docker, git, tar, Docker Buildx | docker.io, docker-buildx, git, tar |
| OCI image to rootfs | skopeo, umoci, mke2fs, mount, umount, tune2fs, e2fsck, normalize-ext4 | Install the kibo-build Debian package, which declares these dependencies and ships its own normalize-ext4 |
Notes:
- Generating a rootfs requires root. Importing from an image registry does not need Docker. Generating content from a Containerfile and building Platform containers need Docker and Buildx.
kibo-buildworks with OCI images through Skopeo and umoci on the host. It contains no libraries of its own for image transport or unpacking.- If a tool is missing, the build fails immediately.
kibo-builddoes not download or install tools automatically, and it does not escalate privileges. - Building the KiboVM standalone kernel also needs source, OCI images, Debian package sources, and Go modules prepared according to the lock file. See Build inputs and cache.
- Buildx must be found under an isolated HOME. A plugin installed only in a personal HOME does not qualify.
- BuildKit garbage collection keeps at least 20 GB of reusable cache, uses at most 80% of the storage, and tries to leave 20 GB free. Size the build host for this.
Standalone build tools package
kibo-build_VERSION_amd64.deb contains kibo-build and normalize-ext4. Install it on a Linux amd64 build host, and apt also installs Skopeo, umoci, the ext4 tools, and their runtime libraries. The build host needs no Go, Git, C compiler, or source code.
sudo apt-get install ./kibo-build_0.0.0-rc.1_amd64.debNotes:
- The minimum tool versions are e2fsprogs 1.47.0, util-linux 2.39, umoci 0.4.7, and Skopeo 1.9.0. Newer versions work, and the tool versions actually used are recorded in the cache and the results. Different versions may produce different ext4 bytes.
- For building a Template with this package, from an image registry or from a local OCI image, see Build your own Template and Importing a local OCI image.
- The publishing account must be able to read the build output. If you use a custom output path, its parent directories must let that account enter.
Building Templates and Platforms
When source code is needed
| Build | Source code needed |
|---|---|
| Generate a rootfs from an OCI image and assemble a Template | No. Install the build tools package and prepare the image |
| Generate Template content from a Containerfile | The Template definition file and its build context are needed |
| Platform | Yes. Prepare the VM runtime according to its lock file |
Steps
Run the following commands as root on the build host:
build_root=/var/lib/kibotos/build
install -d -m 0755 "$build_root"
printf 'root = "%s"\n' "$build_root" > "$build_root/config.toml"
export KIBOTOS_BUILD_CONFIG="$build_root/config.toml"
source_root=/srv/kibotos
rootfs_result=$(kibo-build template "$source_root/templates/minimal/template.json")
firecracker_archive=$(kibo-build firecracker --source-root "$source_root")
kibovm_archive=$(kibo-build kibovm --source-root "$source_root" \
--runtime-lock "$source_root/build/kibovm/runtime-artifact.json" \
--runtime-cache "$source_root/.cache/kibovm-runtime")- The example builds the smallest verification Template in the repository. Use a different definition file to build a different Template. Capacity and sources are declared in the definition file.
- When a non-root account runs the build, the administrator creates the build directory first and grants that account access.
- You can also skip building a Platform yourself and use
kibotos-platform-<backend>_<tag>_amd64.tar.zst(for examplekibotos-platform-kibovm_v0.2.0_amd64.tar.zst) from the release set. It has the same format as a locally built archive.
Handoff and publishing
The handoff
| Handoff item | Must include | Description |
|---|---|---|
| Template result | The result directory and the stage data it references | If you copy only the metadata in the result directory, publishing fails. When copying across machines, keep the original directory layout and give the publishing account read-only access |
| Platform archive | One .tar.zst file | Can be copied on its own. Needs no source code, build tools, or cache |
| Uncompressed ext4 | FILE and FILE.json from kibo-build rootfs --output FILE | Another build account can assemble them with kibo-build template --rootfs and publish the result |
Publishing
Run this on the Operator workstation. It does not need the build host's configuration file. Pass --build-cache-root the stage cache root itself, which is cache/stages under the kibo-build build root:
- It directly contains the cache marker file and another
stages/directory inside. - It is not its parent,
<build root>/cache. If you pass the parent, the command fails before connecting to the network and shows the exact path to pass. - On the build host,
kibo-build cache rootprints this path.
In the example below, the build root /srv/build-root has been copied as is to /srv/build-handoff on the Operator workstation:
kibo template publish /srv/build-handoff/results/rootfs-result \
--build-cache-root /srv/build-handoff/cache/stages --json
kibo platform publish /srv/build-handoff/platform.tar.zst --jsonNext steps
Publishing only puts the revision into the catalog. Templates and Platforms are approved separately, and neither affects the other:
- Run
kibo platform approveandkibo platform set-defaultwith the revision returned bykibo platform publish. - Run
kibo template approveandkibo template set-defaultwith the Template ID and revision returned bykibo template publish.
For command details, see Catalog. To pin a Template revision when creating a Workspace, see Template and resources. To prepare a Template on a node before its first use, see kibo template prepare.
Cleaning the build cache
Run this on the build host:
sudo kibo-build cache clean| Location | What happens |
|---|---|
cache/stages/ | Stage results, locks, temporary directories, and quarantine are removed. The root directory and marker file stay |
cache/inputs/, BuildKit layer cache, Go and Cargo caches | Kept. BuildKit collects its own layers |
results/ | Kept. A Template result whose stages were removed must be assembled again before publishing |
The ext4 and FILE.json from kibo-build rootfs --output FILE | Kept. They are not part of the cache and can still be assembled |
- Cleaning does not affect object storage, node caches, or published Templates, Platforms, and Launches.
- After updating the build or publishing tools, clean the old cache, discard unpublished old results, and build or assemble again.