singularityhub / sregistry

server for storage and management of singularity images
https://singularityhub.github.io/sregistry
Mozilla Public License 2.0
103 stars 42 forks source link

Missing labels / container build recipes are not populated #439

Open YStrauchP4 opened 1 year ago

YStrauchP4 commented 1 year ago

Describe the bug When uploading container images, the recipe is not populated and the interface states "Container does not have recipe locally." As a consequence, labels / env vars are not populated either. Apologies if there's a dedicated step I need to do in order to upload the build recipes but I did not find documentation on this.

To Reproduce

container.def

BootStrap: docker
From: python:3.10-slim

%environment
   export python="3.10.0"

%labels
   Author Test Author

Then apptainer build container.sif container.def followed by a sregistry push --name container container.sif

Expected behavior When inspecting the container using sregistry inspect or in the browser, I'd expect the python label and/or author to show up. Similar, I'd expect the "labels" tab (/labels) to show the python version and/or author.

Versions: Sregistry 2.1.0 Apptainer 1.1.8 Docker version 23.0.0, build e92dd87

vsoch commented 1 year ago

The sregistry command is no longer the primary means to interact with singularity registry - you typically use the library:// endpoint.

YStrauchP4 commented 1 year ago

Okay so new workflow, same result.

To Reproduce container.def

BootStrap: docker
From: python:3.10-slim

%environment
   export python="3.10.0"

%labels
   Author Test Author

Then apptainer build container.sif container.def followed by a apptainer push -U container.sif library://ystrauchp4/new/container:latest

Expected behavior In the browser, I expected /labels and /tags to show new info after uploading the container, as defined in the environment and/or labels of the recipe. The page for the container itself states "Container does not have recipe locally."

How do I attach the build recipe?

vsoch commented 1 year ago

Normally the recipe is part of the metadata of the image, and I think labels used to come from either the sregistry push, or when you connected a GitHub repository.

This project is fairly old, and I think what I'd recommend is to push these to an OCI registry, and make a separate artifact that can hold (and expose) the container metadata (unless apptainer has removed it, should be there with apptainer inspect). We could add views here to receive the same metadata, but imho it's not the best approach to have to maintain your own registry.

vsoch commented 1 year ago

Do you want to tell me your use case and I can help think about a solution using ORAS?

YStrauchP4 commented 1 year ago

I want to build a private container repository that holds sif files and matching metadata (especially software versions) that clients can query and filter (i.e. give me all sif files containing python 3.8 and software X in version Y).

I hoped to generate this version metadata by using environment variables or labels in the recipe; it looked like the REST interface could search over the metadata and provide an easy point to query versions. Shame this project seems to not be under active development anymore.

vsoch commented 1 year ago

I’m happy to receive contributions via PR! I maintain hundreds of projects plus my day job, and if a solution comes around that is better (in my opinion) than something I’ve maintained in the past, it doesn’t make sense to keep maintaining it. I’m just one person.