diff --git a/jib-core/src/main/java/com/google/cloud/tools/jib/registry/ManifestPusher.java b/jib-core/src/main/java/com/google/cloud/tools/jib/registry/ManifestPusher.java index eb5c9dc15f..be9ecab458 100644 --- a/jib-core/src/main/java/com/google/cloud/tools/jib/registry/ManifestPusher.java +++ b/jib-core/src/main/java/com/google/cloud/tools/jib/registry/ManifestPusher.java @@ -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. diff --git a/jib-core/src/test/java/com/google/cloud/tools/jib/registry/ManifestPusherTest.java b/jib-core/src/test/java/com/google/cloud/tools/jib/registry/ManifestPusherTest.java index da0bae510f..6259ffbb7d 100644 --- a/jib-core/src/test/java/com/google/cloud/tools/jib/registry/ManifestPusherTest.java +++ b/jib-core/src/test/java/com/google/cloud/tools/jib/registry/ManifestPusherTest.java @@ -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); @@ -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")); } } @@ -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); @@ -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")); } } @@ -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); @@ -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")); } }