Skip to content
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

Check presence of errors in server response to image push #3286

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

frazar
Copy link

@frazar frazar commented Sep 14, 2024

When pushing an image, the server response might have status code 200 (OK) even though the operation has failed.

To detect the occurrence of an error, inspect each JSON chunk in the server response and verify that no "error" field is present.

The PR also:

  • adds some unit tests with streaming responses,
  • simplifies some code that is more generic than needed.

Fixes: #3277

Signed-off-by: Francesco Zardi <frazar0@hotmail.it>
The previous implementation was generic over the kind of decoder
and separator. However, the only use was with JSON decoder and
newline-based splitting.

Signed-off-by: Francesco Zardi <frazar0@hotmail.it>
When pushing an image, the server response might have status code
200 (OK) even though the operation has failed.

To detect the occurrence of an error, inspect each JSON chunk in
the server response and verify that no "error" field is present.

Fixes: docker#3277

Signed-off-by: Francesco Zardi <frazar0@hotmail.it>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

docker.images.push does not throw an exception on authentication failures
1 participant