Skip to content

api: implement compat distribution inspect endpoint#28358

Open
aaron-ang wants to merge 1 commit intocontainers:mainfrom
aaron-ang:issue-17726-distribution-api
Open

api: implement compat distribution inspect endpoint#28358
aaron-ang wants to merge 1 commit intocontainers:mainfrom
aaron-ang:issue-17726-distribution-api

Conversation

@aaron-ang
Copy link
Copy Markdown
Contributor

@aaron-ang aaron-ang commented Mar 25, 2026

Fixes #17726.

Checklist

Ensure you have completed the following checklist for your pull request to be reviewed:

  • Certify you wrote the patch or otherwise have the right to pass it on as an open-source patch by signing all
    commits. (git commit -s). (If needed, use git commit -s --amend). The author email must match
    the sign-off email address. See CONTRIBUTING.md
    for more information.
  • Referenced issues using Fixes: #00000 in commit message (if applicable)
  • Tests have been added/updated (or no tests are needed)
  • Documentation has been updated (or no documentation changes are needed)
  • All commits pass make validatepr (format/lint checks)
  • Release note entered in the section below (or None if no user-facing changes)

Does this PR introduce a user-facing change?

Added Docker-compatible support for the `/distribution/{name}/json` API endpoint.

@github-actions github-actions bot added the kind/api-change Change to remote API; merits scrutiny label Mar 25, 2026
@aaron-ang aaron-ang force-pushed the issue-17726-distribution-api branch 3 times, most recently from df2ff09 to 12e4664 Compare March 30, 2026 01:52
@aaron-ang aaron-ang marked this pull request as ready for review March 30, 2026 01:52
@aaron-ang aaron-ang force-pushed the issue-17726-distribution-api branch from 12e4664 to 8dd8fed Compare March 30, 2026 03:03
func DistributionInspect(w http.ResponseWriter, r *http.Request) {
runtime := r.Context().Value(api.RuntimeKey).(*libpod.Runtime)
imageName := utils.GetName(r)
if _, err := reference.ParseNormalizedNamed(imageName); err != nil {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this check is redundant with the check on row 42.

}

var latestErr error
appendErr := func(e error) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use multierror

// responses:
// 200:
// $ref: "#/responses/distributionInspectResponse"
// 401:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docker's spec describes the 401 response as "Failed authentication or no image found.".

t GET "/distribution/quay.io/idonotexist/idonotexist:dummy/json" 401

# Exercise the single-manifest path using a digest from the multi-arch test image.
single_manifest_digest=sha256:6953980e46925f8ac2c09fc7ecf9f353c2cac49f87e7e60ed78287d55a14c296
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about hardcoding the manifest digest.

utils.InternalServerError(w, latestErr)
}

func distributionInspectFromManifest(ctx context.Context, src types.ImageSource, named reference.Named, manifestBytes []byte, manifestType string) (dockerRegistry.DistributionInspect, error) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this function can be simplified with things from container-libs. Please check that repository; there are definitely things that can help simplify it.

@aaron-ang
Copy link
Copy Markdown
Contributor Author

thanks for the comments @Honny1, will review and implement the changes.

@aaron-ang aaron-ang force-pushed the issue-17726-distribution-api branch 2 times, most recently from da4dd25 to d2d374f Compare April 6, 2026 05:40
@packit-as-a-service
Copy link
Copy Markdown

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

3 similar comments
@packit-as-a-service
Copy link
Copy Markdown

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

@packit-as-a-service
Copy link
Copy Markdown

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

@packit-as-a-service
Copy link
Copy Markdown

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

@baude
Copy link
Copy Markdown
Member

baude commented Apr 6, 2026

@mtrmac mind adding this to your list of things to review at your convience ?

@aaron-ang aaron-ang force-pushed the issue-17726-distribution-api branch from d2d374f to 56bd7e5 Compare April 7, 2026 01:29
Signed-off-by: Aaron Ang <aaron.angyd@gmail.com>
@aaron-ang aaron-ang force-pushed the issue-17726-distribution-api branch from 56bd7e5 to 9454b2a Compare April 7, 2026 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/api-change Change to remote API; merits scrutiny

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Distribution API seems missing

3 participants