jib icon indicating copy to clipboard operation
jib copied to clipboard

Add option to tag child images when publishing multi platform

Open ghost opened this issue 4 years ago • 6 comments

Environment:

  • 3.1.4
  • gradle -Linux

Description of the issue: When one uses the platforms section to upload multi-arch images, you end up with untagged images in ECR(probably others too) Stack overflow version of the same issue with docker buildx here.
When you look in ECR, you see the 2 child images as well as the manifest file. image

Expected behavior: It would be nice if the child images had an option to append a -ARCH to the tag used as the Manifest one. In the above example, it would be awesome if there was an option to tag them with 0.0.130-userAdd -- Manifest 0.0.130-userAdd-amd64 -- AMD version 0.0.130-userAdd-arm64 -- ARM version

The jib section's from block

    from {
        image = baseDockerImage
        platforms {
            platform {
                architecture = 'amd64'
                os = 'linux'
            }
            platform {
                architecture = 'arm64'
                os = 'linux'
            }
        }
    }

ghost avatar Nov 30 '21 20:11 ghost

Would it be possible here: https://github.com/GoogleContainerTools/jib/blob/master/jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/PushImageStep.java#L81-L82

      Set<String> imageQualifiers =
          singlePlatform ? tags : Collections.singleton(manifestDigest.toString());

to optionally change the ternary else from a manifestDigest to

val platforImageTags = if (platformTagingEnabled) {
  tags.map{
     it + "currentPlatformHere"
  }
}else{
  listOf(manifestDigest.toString())
}

where currentPlatformHere is the archname(or os-archname)?

ghost avatar Nov 30 '21 20:11 ghost

A prototype. I hardcoded the feature flag on. https://github.com/GoogleContainerTools/jib/pull/3519

ghost avatar Nov 30 '21 22:11 ghost

Thanks for filing the feature request and the contribution @robert-csdisco! We will take a look at it.

mpeddada1 avatar Dec 01 '21 20:12 mpeddada1

I started wiring up the boolean through buildContext, but it looks like there's quite a few places to add it. Will wait to see if this is something y'all could accept before doing the config part

ghost avatar Dec 01 '21 22:12 ghost