use of com.google.cloud.tools.jib.image.json.BuildableManifestTemplate in project jib by google.
the class PushImageStep method afterPushBaseImageLayerFuturesFuture.
/**
* Depends on {@code pushAuthorizationFuture}, {@code pushBaseImageLayerFuturesFuture.get()},
* {@code pushApplicationLayerFutures}, and (@code
* containerConfigurationBlobDescriptorFutureFuture.get()}.
*/
private Void afterPushBaseImageLayerFuturesFuture() throws IOException, RegistryException, ExecutionException, InterruptedException, LayerPropertyNotFoundException {
try (Timer ignored = new Timer(buildConfiguration.getBuildLogger(), DESCRIPTION)) {
RegistryClient registryClient = new RegistryClient(NonBlockingFutures.get(pushAuthorizationFuture), buildConfiguration.getTargetRegistry(), buildConfiguration.getTargetRepository());
// TODO: Consolidate with BuildAndPushContainerConfigurationStep.
// Constructs the image.
Image image = new Image();
for (Future<CachedLayer> cachedLayerFuture : NonBlockingFutures.get(pullBaseImageLayerFuturesFuture)) {
image.addLayer(NonBlockingFutures.get(cachedLayerFuture));
}
for (Future<CachedLayer> cachedLayerFuture : buildApplicationLayerFutures) {
image.addLayer(NonBlockingFutures.get(cachedLayerFuture));
}
ImageToJsonTranslator imageToJsonTranslator = new ImageToJsonTranslator(image);
// Pushes the image manifest.
BuildableManifestTemplate manifestTemplate = imageToJsonTranslator.getManifestTemplate(buildConfiguration.getTargetFormat(), NonBlockingFutures.get(NonBlockingFutures.get(containerConfigurationBlobDescriptorFutureFuture)));
registryClient.pushManifest(manifestTemplate, buildConfiguration.getTargetTag());
}
return null;
}
Aggregations