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

Better error message for registries not supporting OCI manifest push #1707

Merged
merged 1 commit into from
May 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ public DescriptorDigest handleHttpResponseException(HttpResponseException httpRe
ErrorCodes errorCode = ErrorResponseUtil.getErrorCode(httpResponseException);
if (errorCode == ErrorCodes.MANIFEST_INVALID || errorCode == ErrorCodes.TAG_INVALID) {
throw new RegistryErrorExceptionBuilder(getActionDescription(), httpResponseException)
.addReason("Registry may not support Image Manifest Version 2, Schema 2")
.addReason(
"Registry may not support pushing OCI Manifest or "
+ "Docker Image Manifest Version 2, Schema 2")
.build();
}
// rethrow: unhandled error response code.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ public void testHandleHttpResponseException_dockerRegistry_tagInvalid()
new HttpResponseException.Builder(
HttpStatus.SC_BAD_REQUEST, "Bad Request", new HttpHeaders())
.setContent(
"{\"errors\":[{\"code\":\"TAG_INVALID\",\"message\":\"manifest tag did not match URI\"}]}")
"{\"errors\":[{\"code\":\"TAG_INVALID\","
+ "\"message\":\"manifest tag did not match URI\"}]}")
.build();
try {
testManifestPusher.handleHttpResponseException(exception);
Expand All @@ -173,7 +174,8 @@ public void testHandleHttpResponseException_dockerRegistry_tagInvalid()
Assert.assertThat(
ex.getMessage(),
CoreMatchers.containsString(
"Registry may not support Image Manifest Version 2, Schema 2"));
"Registry may not support pushing OCI Manifest or "
+ "Docker Image Manifest Version 2, Schema 2"));
}
}

Expand All @@ -185,7 +187,8 @@ public void testHandleHttpResponseException_dockerRegistry_manifestInvalid()
new HttpResponseException.Builder(
HttpStatus.SC_BAD_REQUEST, "Bad Request", new HttpHeaders())
.setContent(
"{\"errors\":[{\"code\":\"MANIFEST_INVALID\",\"message\":\"manifest invalid\",\"detail\":{}}]}")
"{\"errors\":[{\"code\":\"MANIFEST_INVALID\","
+ "\"message\":\"manifest invalid\",\"detail\":{}}]}")
.build();
try {
testManifestPusher.handleHttpResponseException(exception);
Expand All @@ -195,7 +198,8 @@ public void testHandleHttpResponseException_dockerRegistry_manifestInvalid()
Assert.assertThat(
ex.getMessage(),
CoreMatchers.containsString(
"Registry may not support Image Manifest Version 2, Schema 2"));
"Registry may not support pushing OCI Manifest or "
+ "Docker Image Manifest Version 2, Schema 2"));
}
}

Expand All @@ -206,8 +210,9 @@ public void testHandleHttpResponseException_quayIo() throws HttpResponseExceptio
new HttpResponseException.Builder(
HttpStatus.SC_UNSUPPORTED_MEDIA_TYPE, "UNSUPPORTED MEDIA TYPE", new HttpHeaders())
.setContent(
"{\"errors\":[{\"code\":\"MANIFEST_INVALID\",\"detail\":"
+ "{\"message\":\"manifest schema version not supported\"},\"message\":\"manifest invalid\"}]}")
"{\"errors\":[{\"code\":\"MANIFEST_INVALID\","
+ "\"detail\":{\"message\":\"manifest schema version not supported\"},"
+ "\"message\":\"manifest invalid\"}]}")
.build();
try {
testManifestPusher.handleHttpResponseException(exception);
Expand All @@ -217,7 +222,8 @@ public void testHandleHttpResponseException_quayIo() throws HttpResponseExceptio
Assert.assertThat(
ex.getMessage(),
CoreMatchers.containsString(
"Registry may not support Image Manifest Version 2, Schema 2"));
"Registry may not support pushing OCI Manifest or "
+ "Docker Image Manifest Version 2, Schema 2"));
}
}

Expand Down