This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PushLayersStep | |
implements AsyncStep<ImmutableList<AsyncStep<PushBlobStep>>>, | |
Callable<ImmutableList<AsyncStep<PushBlobStep>>> { | |
/*(...)*/ | |
public ImmutableList<AsyncStep<PushBlobStep>> call() throws ExecutionException { | |
/*(...)*/ | |
ImmutableList<? extends AsyncStep<? extends CachedLayer>> cachedLayerSteps = | |
NonBlockingSteps.get(cachedLayerStepsStep); | |
// Constructs a PushBlobStep for each layer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RegistryClient { | |
/*(...)*/ | |
public Void pullBlob(DescriptorDigest blobDigest, OutputStream destinationOutputStream) | |
throws RegistryException, IOException { | |
BlobPuller blobPuller = | |
new BlobPuller(registryEndpointRequestProperties, blobDigest, destinationOutputStream); | |
return callRegistryEndpoint(blobPuller); | |
} | |
/*(...)*/ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PullAndCacheBaseImageLayerStep implements AsyncStep<CachedLayer>, Callable<CachedLayer> { | |
/*(...)*/ | |
public CachedLayer call() throws IOException, RegistryException { | |
/*(...)*/ | |
RegistryClient registryClient = /*(...)*/; | |
// Checks if the layer already exists in the cache. | |
CachedLayer cachedLayer = new CacheReader(cache).getLayer(layerDigest); | |
if (cachedLayer != null) { | |
return cachedLayer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public ImmutableList<PullAndCacheBaseImageLayerStep> call()/*(...)*/ { | |
BaseImageWithAuthorization pullBaseImageStepResult = NonBlockingSteps.get(pullBaseImageStep); | |
/*(...)*/ | |
ImmutableList.Builder<PullAndCacheBaseImageLayerStep> pullAndCacheBaseImageLayerStepsBuilder = | |
ImmutableList.builderWithExpectedSize(baseImageLayers.size()); | |
for (Layer layer : baseImageLayers) { | |
pullAndCacheBaseImageLayerStepsBuilder.add( | |
new PullAndCacheBaseImageLayerStep( | |
listeningExecutorService, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public ImmutableList<PullAndCacheBaseImageLayerStep> call() /*(...)*/ { | |
/*(...)*/ | |
ImmutableList<Layer> baseImageLayers = pullBaseImageStepResult.getBaseImage().getLayers(); | |
/*(...)*/ | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Image<Layer> toImage(/*(...)*/) /*(...)*/ { | |
/*(...)*/ | |
if (containerConfigurationTemplate.getContainerEntrypoint() != null) { | |
imageBuilder.setEntrypoint(containerConfigurationTemplate.getContainerEntrypoint()); | |
} | |
if (containerConfigurationTemplate.getContainerCmd() != null) { | |
imageBuilder.setJavaArguments(containerConfigurationTemplate.getContainerCmd()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Image<Layer> toImage(/*(...)*/) /*(...)*/ { | |
/*(...)*/ | |
List<DescriptorDigest> diffIds = containerConfigurationTemplate.getDiffIds(); | |
if (layers.size() != diffIds.size()) { | |
throw new LayerCountMismatchException( | |
"Mismatch between image manifest and container configuration"); | |
} | |
Image.Builder<Layer> imageBuilder = Image.builder(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Image<Layer> toImage( | |
BuildableManifestTemplate manifestTemplate, | |
ContainerConfigurationTemplate containerConfigurationTemplate) /*(...)*/ { | |
List<ReferenceNoDiffIdLayer> layers = new ArrayList<>(); | |
for (BuildableManifestTemplate.ContentDescriptorTemplate layerObjectTemplate : | |
manifestTemplate.getLayers()) { | |
/*(...)*/ | |
layers.add( | |
new ReferenceNoDiffIdLayer( | |
new BlobDescriptor(layerObjectTemplate.getSize(), layerObjectTemplate.getDigest()))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"schemaVersion": 2, | |
"mediaType": "application/vnd.docker.distribution.manifest.list.v2+json", | |
"manifests": [ | |
{ | |
"mediaType": "application/vnd.docker.image.manifest.v2+json", | |
"size": 7143, | |
"digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f", | |
"platform": { | |
"architecture": "ppc64le", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Image<Layer> pullBaseImage(@Nullable Authorization registryCredentials)/*(...)*/ { | |
/*(...)*/ | |
// TODO: Make schema version be enum. | |
switch (manifestTemplate.getSchemaVersion()) { | |
/*(...)*/ | |
case 2: | |
V22ManifestTemplate v22ManifestTemplate = (V22ManifestTemplate) manifestTemplate; | |
/*(...)*/ | |
ByteArrayOutputStream containerConfigurationOutputStream = new ByteArrayOutputStream(); |