Skip to content

c8d/inspect: Ignore manifest with missing config#46238

Merged
thaJeztah merged 1 commit intomoby:masterfrom
vvoland:c8d-inspect-handle-missing-config
Aug 18, 2023
Merged

c8d/inspect: Ignore manifest with missing config#46238
thaJeztah merged 1 commit intomoby:masterfrom
vvoland:c8d-inspect-handle-missing-config

Conversation

@vvoland
Copy link
Contributor

@vvoland vvoland commented Aug 16, 2023

- What I did
Fixed failure to inspect image if any of its present manifest references an image config which isn't present locally.

- How I did it
Ignore c8d NotFound error when reading config in walkImageManifests.

- How to verify it

$ docker pull busybox:1.36.1
$ docker pull --platform linux/amd64 busybox:1.36.1
$ ctr content rm sha256:a416a98b71e224a31ee99cff8e16063554498227d2b696152a9c3e0aa65e5824 # Delete amd64 config

Before

$ docker image inspect busybox:1.36.1
[]
Error response from daemon: failed to read config content: content digest sha256:a416a98b71e224a31ee99cff8e16063554498227d2b696152a9c3e0aa65e5824: not found

After

$ docker image inspect busybox:1.36.1
[
    {
        "Id": "sha256:3fbc632167424a6d997e74f52b878d7cc478225cffac6bc977eedfe51c7f4e79",
        "RepoTags": [
            "busybox:latest"
        ],
        "RepoDigests": [
            "busybox@sha256:3fbc632167424a6d997e74f52b878d7cc478225cffac6bc977eedfe51c7f4e79"
        ],
        (...)
        "Architecture": "arm64",
        "Variant": "v8",
        "Os": "linux",
        "Size": 1920927,
        "VirtualSize": 1920927,
        (...)
    }
]

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@vvoland vvoland added area/images Image Distribution kind/bugfix PR's that fix bugs containerd-integration Issues and PRs related to containerd integration process/cherry-pick/24.0 labels Aug 16, 2023
@vvoland vvoland added this to the 25.0.0 milestone Aug 16, 2023
@vvoland vvoland force-pushed the c8d-inspect-handle-missing-config branch from bff127f to 5767330 Compare August 16, 2023 12:56
conf, err := img.Config(ctx)
if err != nil {
return err
return fmt.Errorf("failed to get config descriptor: %w", err)
Copy link
Member

Choose a reason for hiding this comment

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

Should these new errors have a specific type? e.g., should this be a NotFound error?

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I guess the reverse (as we handle NotFound different?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, there's a very small chance this could fail with NotFound because this is only reading the config descriptor from the manifest content. The only way this could fail with NotFound is if the manifest is missing or malformed, but then it wouldn't be considered by the walkImageManifests.
In theory this could happen if the content was deleted between walkImageManifests picked it up and the handler func was called.

So I guess it doesn't hurt to handle NotFound here, but return System in other cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Fix a failure to inspect image if any of its present manifest references
an image config which isn't present locally.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
@vvoland vvoland force-pushed the c8d-inspect-handle-missing-config branch from 5767330 to a64adda Compare August 17, 2023 07:49
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/images Image Distribution containerd-integration Issues and PRs related to containerd integration kind/bugfix PR's that fix bugs process/cherry-picked

Projects

Development

Successfully merging this pull request may close these issues.

2 participants