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

jib-gradle-plugin fails when the platform/architecture is not amd64. #2781

Closed
jtgasper3 opened this issue Sep 23, 2020 · 3 comments · Fixed by #2783
Closed

jib-gradle-plugin fails when the platform/architecture is not amd64. #2781

jtgasper3 opened this issue Sep 23, 2020 · 3 comments · Fixed by #2783

Comments

@jtgasper3
Copy link

jtgasper3 commented Sep 23, 2020

Environment:

  • *Jib version: 2.5.0
  • *Build tool: Gradle
  • *OS: OS X

Description of the issue: The jib-gradle-plugin is not replacing the given platform config but adding to an existing collection[1]. Jib-core requires exactly one in the collection[2].

Side note: I realize multi-platform builds are not supported yet. I'm just trying to do a single non-amd64 build.

BTW, Thanks for the great tool!

[1] https://github.com/GoogleContainerTools/jib/blob/master/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/PlatformParametersSpec.java#L45
[2] https://github.com/GoogleContainerTools/jib/blob/master/jib-core/src/main/java/com/google/cloud/tools/jib/api/JibContainerBuilder.java#L597

Expected behavior:
Jib should download the arm64-based base image and build.

Steps to reproduce:

  1. Setup the jib config provided below.
  2. ./gradlew bootJar jibDockerBuild
  3. Fail

jib-gradle-plugin Configuration:

jib {
    from {
        image = "amazoncorretto:11"
        platforms {
            platform {
                architecture = 'arm64'
                os = 'linux'
            }
        }
    }
}

Log output:

> multi-platform image building is not yet supported

Additional Information:
The platforms collection has 2 items even though I'm only specifying 1 in the config. I'm not a gradle internals dev, but I'm assuming this gets invoked regardless of if I try to override it in the config or not: https://github.com/GoogleContainerTools/jib/blob/master/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BaseImageParameters.java#L48

@chanseokoh chanseokoh self-assigned this Sep 23, 2020
@chanseokoh
Copy link
Member

Working on fixing this. The current workaround is to use the digest of the arm64/linux image. In your case, based on the amazoncorretto:11 manifest list,

$ docker manifest inspect amazoncorretto:11
{
   "schemaVersion": 2,
   "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
   "manifests": [
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 742,
         "digest": "sha256:f7a7126645e48c54535e36bcae9a7fbeba6fd5fc7dbb0071ce4534cad101616a",
         "platform": {
            "architecture": "amd64",
            "os": "linux"
         }
      },
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 742,
         "digest": "sha256:e8214c624c083bd6e62079474645c3d6228cacee4583f070f14b8919fa076125",
         "platform": {
            "architecture": "arm64",
            "os": "linux",
            "variant": "v8"
         }
      }
   ]
}

it will be

from.image = 'amazoncorretto:11@sha256:e8214c624c083bd6e62079474645c3d6228cacee4583f070f14b8919fa076125'

@jtgasper3
Copy link
Author

Thanks for the suggestion, @chanseokoh. That's what I did before I reached out on Gitter to ensure I was not completely crazy.

I noticed you already have a fix in the works. I appreciate the effort!

@chanseokoh chanseokoh added this to the v2.6.0 milestone Sep 29, 2020
@loosebazooka
Copy link
Member

Hi @jtgasper3 this should be fixed in the latest jib gradle bugfix release (2.5.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants