What is the correct simplestreams structure for image registry?

I’m using Incus 6.0.5.

I set up an http server with the following structure:

images/
test-app/
0.0.1/
incus.tar.xz
rootfs.squashfs
streams/
v1/
images.json
index.json

images.json:

{
  "format": "products:1.0",
  "products": {
    "test-app": {
      "arch": "amd64",
      "release": "0.0.1",
      "versions": {
        "0.0.1": {
          "items": {
            "incus.tar.xz": {
              "ftype": "incus.tar.xz",
              "sha256": "879d93fabd5a21a5a4d83745e1ad8dbd13e4c10581ed3245b8a105e0f8ec6ba3",
              "path": "images/test-app/0.0.1/incus.tar.xz",
              "size": 440
            },
            "rootfs": {
              "ftype": "squashfs",
              "sha256": "592f776a067f338029755c930608b3be43fd463abd849e521c50bc0e5dedb8fe",
              "path": "images/test-app/0.0.1/rootfs.squashfs",
              "size": 137244672
            }
          }
        }
      }
    }
  }
}

index.json:

{
    "format": "index:1.0",
    "index": {
        "images": {
            "datatype": "image-downloads",
            "format": "products:1.0",
            "path": "streams/v1/images.json",
            "products": ["test-app"]
        }
    }
}

I added this as a remote and confirmed that incus can read it. However, I’m always getting:

Error: Failed instance creation: Failed getting remote image info: Failed getting image: The requested image couldn’t be found

Also no image shows up with `incus image list private-images:`

I’m pulling my hair because I tried many things, different structures, and I cannot make it work.

BTW. There seems to be a really awful bug: incus caches images.json and index.json for an hour, I think, and there is no cli-way of clearing this cache. I lost hours debugging the incus-image server interaction because of that.

But the actual question is: what should be the correct json structure for Incus to pick up this image?

I think the issue is the lack of the combined hash.

You may want to try incus-simplestreams as a way to generate your simplestreams tree.

Thank you; I was unaware of this tool. However, there still is a problem, unfortunately. It seems like incus-simplestreams makes it impossible to properly version releases?

I would like to be able to version my images. As far as I can see, if I want to have my own image based on an existing one, like Ubuntu, when using distrobuilder, the only customizable metadata seems to be the variant one. The distribution and release are used to define the base image when using debootstrap. So the variant would be my image’s name, right? But then, there seems to be literally no metadata available that would allow me to semantically version my images.

It doesn’t look like distrobuilder + incus-simplestreams are general-purpose tools. More like they were built to specifically help with maintaning images.linuxcontainers.org and its structure, and that’s all.

Are we supposed to build images with distrobuilder and then edit+repack metadata before publishing it in simplestreams (at least if we want to avoid having to connect to an Incus instance and do all of this in Incus with the publish workflow)? I guess that would work, but… ugh.

Added:

Or maybe a more sane approach would be to just combine the image name with the version in the variant field. At least for now.

Added #2:

I made an issue for that: Decouple metadata from the source information · Issue #970 · lxc/distrobuilder · GitHub