Function tvix_build::oci::spec::make_spec

source ·
pub(crate) fn make_spec(
    request: &BuildRequest,
    rootless: bool,
    sandbox_shell: &str,
) -> Result<Spec, OciSpecError>
Expand description

For a given BuildRequest, return an OCI runtime spec.

While there’s no IO occuring in this function, the generated spec contains path references relative to the “bundle location”. Due to overlayfs requiring its layers to be absolute paths, we also need a [bundle_dir] parameter, pointing to the location of the bundle dir itself.

The paths used in the spec are the following (relative to a “bundle root”):

  • inputs, a directory where the castore nodes specified the build request inputs are supposed to be populated.
  • outputs, a directory where all writes to the store_dir during the build are directed to.
  • root, a minimal skeleton of files that’ll be present at /.
  • scratch, a directory containing other directories which will be bind-mounted read-write into the container and used as scratch space during the build. No assumptions should be made about what’s inside this directory.

Generating these paths, and populating contents, like a skeleton root is up to another function, this function doesn’t do filesystem IO.