static ImmutableList<PushImageStep> makeListForManifestList(
      BuildContext buildContext,
      ProgressEventDispatcher.Factory progressEventDispatcherFactory,
      RegistryClient registryClient,
      ManifestTemplate manifestList,
      boolean manifestListAlreadyExists)
      throws IOException {
    Set<String> tags = buildContext.getAllTargetImageTags();

    EventHandlers eventHandlers = buildContext.getEventHandlers();
    try (TimerEventDispatcher ignored =
            new TimerEventDispatcher(eventHandlers, "Preparing manifest list pushers");
        ProgressEventDispatcher progressEventDispatcher =
            progressEventDispatcherFactory.create("launching manifest list pushers", tags.size())) {
      boolean singlePlatform = buildContext.getContainerConfiguration().getPlatforms().size() == 1;
      if (singlePlatform) {
        return ImmutableList.of(); // single image; no need to push a manifest list
      }

      if (JibSystemProperties.skipExistingImages() && manifestListAlreadyExists) {
        eventHandlers.dispatch(LogEvent.info("Skipping pushing manifest list; already exists."));
        return ImmutableList.of();
      }
      DescriptorDigest manifestListDigest = Digests.computeJsonDigest(manifestList);
      return tags.stream()
          .map(
              tag ->
                  new PushImageStep(
                      buildContext,
                      progressEventDispatcher.newChildProducer(),
                      registryClient,
                      manifestList,
                      tag,
                      manifestListDigest,
                      // TODO: a manifest list digest isn't an "image id". Figure out the right
                      // return value and type.
                      manifestListDigest))
          .collect(ImmutableList.toImmutableList());
    }
  }
@Test
  public void testMakeListForManifestList_singlePlatform() throws IOException {
    when(containerConfig.getPlatforms())
        .thenReturn(ImmutableSet.of(new Platform("amd64", "linux")));

    List<PushImageStep> pushImageStepList =
        PushImageStep.makeListForManifestList(
            buildContext, progressDispatcherFactory, registryClient, manifestList, false);
    assertThat(pushImageStepList).isEmpty();
  }