-
Notifications
You must be signed in to change notification settings - Fork 18.9k
[24.0 backport] plugins: Fix panic when fetching by digest #47324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[24.0 backport] plugins: Fix panic when fetching by digest #47324
Conversation
|
Ah, hm.. looks like 24.0 and older need some additional changes; |
| }) | ||
|
|
||
| t.Run("with digest", func(t *testing.T) { | ||
| ctx := setupTest(t) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this to;
| 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 <laurabrehm@hey.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
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 <laurabrehm@hey.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
eb2a269 to
f406728
Compare
|
Oooh. I'll TAL. |
|
Jenkins failure is unrelated (CI sometimes attempts to run device-mapper tests in a container, which fails); I restarted it; |
laurazard
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
- 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)