Optional<ImageMetadataTemplate> retrieveMetadata(ImageReference imageReference)
      throws IOException, CacheCorruptedException {
    Path imageDirectory = cacheStorageFiles.getImageDirectory(imageReference);
    Path metadataPath = imageDirectory.resolve("manifests_configs.json");
    if (!Files.exists(metadataPath)) {
      return Optional.empty();
    }

    ImageMetadataTemplate metadata;
    try (LockFile ignored = LockFile.lock(imageDirectory.resolve("lock"))) {
      metadata = JsonTemplateMapper.readJsonFromFile(metadataPath, ImageMetadataTemplate.class);
    }
    verifyImageMetadata(metadata, imageDirectory);
    return Optional.of(metadata);
  }
Retrieves the cached image metadata (a manifest list and a list of manifest/container
configuration pairs) for an image reference.

@param imageReference the image reference
@return the image metadata for the image reference, if found
@throws IOException if an I/O exception occurs
@throws CacheCorruptedException if the cache is corrupted
jib-core/src/main/java/com/google/cloud/tools/jib/cache/CacheStorageReader.java