GoogleContainerTools / jib

🏗 Build container images for your Java applications.
Apache License 2.0
13.58k stars 1.43k forks source link

Unrecognized field "artifactType" in ManifestDescriptorTemplate #4287

Closed aewhite closed 2 months ago

aewhite commented 2 months ago

Environment:

Description of the issue:

While attempting to use the base image public.ecr.aws/docker/library/amazoncorretto:11-alpine, the following error was thrown:

[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:3.2.0:build (default) on project batch: Unrecognized field "artifactType" (class com.google.cloud.tools.jib.image.json.V22ManifestListTemplate$ManifestDescriptorTemplate), not marked as ignorable (4 known properties: "size", "platform", "digest", "mediaType"])
--
3913 | [ERROR]  at [Source: (String)"{
3914 | [ERROR]    "schemaVersion": 2,
3915 | [ERROR]    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
3916 | [ERROR]    "manifests": [
3917 | [ERROR]       {
3918 | [ERROR]          "mediaType": "application/vnd.oci.image.manifest.v1+json",
3919 | [ERROR]          "artifactType": null,
3920 | [ERROR]          "size": 1366,
3921 | [ERROR]          "digest": "sha256:a2fb965dcf13a084bd6447ae42386a8c01804ceb054ef8880c1791168997a4a3",
3922 | [ERROR]          "platform": {
3923 | [ERROR]             "architecture": "amd64",
3924 | [ERROR]             "os": "linux"
3925 | [ERROR]          },
3926 | [ERROR]          "annotations": {
3927 | [ERROR]             "com.docker.official"[truncated 3092 chars]; line: 7, column: 30] (through reference chain: com.google.cloud.tools.jib.image.json.V22ManifestListTemplate["manifests"]->java.util.ArrayList[0]->com.google.cloud.tools.jib.image.json.V22ManifestListTemplate$ManifestDescriptorTemplate["artifactType"])

This appears to be due to lack of @JsonIgnoreProperties(ignoreUnknown = true) at https://github.com/GoogleContainerTools/jib/blame/ff15988e5eb36c686e7db47abb31bdc15c88f44a/jib-core/src/main/java/com/google/cloud/tools/jib/image/json/V22ManifestListTemplate.java#L117

The base image tag is shared with the following other tags: 11-alpine3.18, 11.0.21-alpine3.18, 11-alpine3.18-full, 11-alpine3.18-jdk, 11-alpine, 11.0.21-alpine, 11-alpine-full, 11-alpine-jdk

The best info I could find on artifact types was this commit on opencontainers: https://github.com/opencontainers/image-spec/commit/23c46478b79822ed9049e717e1f464ba8b2c2d2d

aewhite commented 2 months ago

This appears to be resolved in 3.4.3. It's not clear where things got fixed, but it is. Sorry for the noise. Maybe others can find this ticket in google if they run into this issue like I did.