[API] Get container package size? #14794

Open
opened 2025-11-02 11:23:10 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @dot-mike on GitHub (Jul 22, 2025).

Description

Hi,

there does not seem to be a way with the current API spec for getting container image size.
For example the screenshot attached is available in the web interface. But via the API can't see the same information.

If I query https://gitea.url.tld/api/v1/packages/gitea/container/runner-images/ubuntu-22.04-slim I don't see any digests and size.
if I query https://gitea.url.tld/api/v1/packages/gitea/container/runner-images I can find all containers including ubuntu-22.04-slim and each SHA256 digest, but there is no correlation between them. So I can't get a size for the image...

Screenshots

Image

Gitea Version

1.24.3

Can you reproduce the bug on the Gitea demo site?

Yes

Operating System

No response

Browser Version

Firefox

Originally created by @dot-mike on GitHub (Jul 22, 2025). ### Description Hi, there does not seem to be a way with the current API spec for getting container image size. For example the screenshot attached is available in the web interface. But via the API can't see the same information. If I query `https://gitea.url.tld/api/v1/packages/gitea/container/runner-images/ubuntu-22.04-slim` I don't see any digests and size. if I query `https://gitea.url.tld/api/v1/packages/gitea/container/runner-images` I can find all containers including `ubuntu-22.04-slim` and each SHA256 digest, but there is no correlation between them. So I can't get a size for the image... ### Screenshots <img width="2761" height="1337" alt="Image" src="https://github.com/user-attachments/assets/5e007f62-e940-429b-ba17-5912f152c0ec" /> ### Gitea Version 1.24.3 ### Can you reproduce the bug on the Gitea demo site? Yes ### Operating System _No response_ ### Browser Version Firefox
GiteaMirror added the topic/apitype/proposal labels 2025-11-02 11:23:10 -06:00
Author
Owner

@dot-mike commented on GitHub (Jul 24, 2025):

Thinking about this one. Is it accepted to include the SHA256 digests in the original json for the tag-aliases? So they can be looked up.

API get request to https://gitea.url.tld/api/v1/packages/gitea/container/runner-images/ubuntu-22.04-slim would include the SHA256 digests images as part of the response. Let me know your thoughts @lunny

For example

{
  "id": 47,
  "owner": {
  },
  "repository": null,
  "creator": {
  },
  "digests": {
   {
      "arch": "linux/amd64",
       "hash": "sha256:....",
       "size": "bytes go here"
   }
  },
  "type": "container",
  "name": "runner-images",
  "version": "ubuntu-22.04-slim-v25.07.22",
  "html_url": "https://gitea.url.tld/gitea/-/packages/container/runner-images/ubuntu-22.04-slim-v25.07.22",
  "created_at": "2025-07-22T21:58:18+02:00"
}

Latest API would include the SHA256 digest as well https://gitea.url.tld/api/v1/packages/gitea/container/runner-image/-/latest

And for all packages, it would do the same: https://gitea.url.tld/api/v1/packages/gitea/container/runner-images

@dot-mike commented on GitHub (Jul 24, 2025): Thinking about this one. Is it accepted to include the SHA256 digests in the original json for the tag-aliases? So they can be looked up. API get request to `https://gitea.url.tld/api/v1/packages/gitea/container/runner-images/ubuntu-22.04-slim` would include the SHA256 digests images as part of the response. Let me know your thoughts @lunny For example ```json { "id": 47, "owner": { }, "repository": null, "creator": { }, "digests": { { "arch": "linux/amd64", "hash": "sha256:....", "size": "bytes go here" } }, "type": "container", "name": "runner-images", "version": "ubuntu-22.04-slim-v25.07.22", "html_url": "https://gitea.url.tld/gitea/-/packages/container/runner-images/ubuntu-22.04-slim-v25.07.22", "created_at": "2025-07-22T21:58:18+02:00" } ``` Latest API would include the SHA256 digest as well `https://gitea.url.tld/api/v1/packages/gitea/container/runner-image/-/latest` And for all packages, it would do the same: `https://gitea.url.tld/api/v1/packages/gitea/container/runner-images`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14794