void writeMetadata(ImageReference imageReference, ImageMetadataTemplate metadata)
      throws IOException {
    verifyImageMetadata(metadata);
    Path imageDirectory = cacheStorageFiles.getImageDirectory(imageReference);
    Files.createDirectories(imageDirectory);

    try (LockFile ignored = LockFile.lock(imageDirectory.resolve("lock"))) {
      writeJsonTemplate(metadata, imageDirectory.resolve("manifests_configs.json"));
    }
  }
Saves image metadata (a manifest list and a list of manifest/container configuration pairs) for
an image reference.

@param imageReference the image reference to store the metadata for
@param metadata the image metadata
jib-core/src/main/java/com/google/cloud/tools/jib/cache/CacheStorageWriter.java