[24.0 backport] plugins: Fix panic when fetching by digest #47324
Merged
[24.0 backport] plugins: Fix panic when fetching by digest #47324
Conversation
Member
Author
|
Ah, hm.. looks like 24.0 and older need some additional changes; |
thaJeztah
commented
Feb 5, 2024
| }) | ||
|
|
||
| t.Run("with digest", func(t *testing.T) { | ||
| ctx := setupTest(t) |
Member
Author
There was a problem hiding this comment.
Changed this to;
Suggested change
| ctx := setupTest(t) | |
| defer setupTest(t)() |
Adds a test case for installing a plugin from a remote in the form of `plugin-content-trust@sha256:d98f2f8061...`, which is currently causing the daemon to panic, as we found while running the CLI e2e tests: ``` docker plugin install registry:5000/plugin-content-trust@sha256:d98f2f806144bf4ba62d4ecaf78fec2f2fe350df5a001f6e3b491c393326aedb ``` Signed-off-by: Laura Brehm <[email protected]> Signed-off-by: Sebastiaan van Stijn <[email protected]>
Only print the tag when the received reference has a tag, if we can't cast the received tag to a `reference.Tagged` then skip printing the tag as it's likely a digest. Fixes panic when trying to install a plugin from a reference with a digest such as `vieux/sshfs@sha256:1d3c3e42c12138da5ef7873b97f7f32cf99fb6edde75fa4f0bcf9ed277855811` Signed-off-by: Laura Brehm <[email protected]> Signed-off-by: Sebastiaan van Stijn <[email protected]>
eb2a269 to
f406728
Compare
Member
|
Oooh. I'll TAL. |
Member
Author
|
Jenkins failure is unrelated (CI sometimes attempts to run device-mapper tests in a container, which fails); I restarted it; |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
- What I did
Added a test for, and fixed a panic at:
moby/plugin/fetch_linux.go
Lines 202 to 203 in 71fa3ab
when doing something like:
By checking if the cast is safe, and only printing the tag if there is a tag to print.
- How I did it
With tag:
With digest:
- How to verify it
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)