Skip to content

Commit

Permalink
Reverse manifest V21 layers when adding (#1633)
Browse files Browse the repository at this point in the history
  • Loading branch information
chanseokoh authored Apr 16, 2019
1 parent ee6cbc2 commit f36e905
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 4 deletions.
4 changes: 4 additions & 0 deletions jib-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ All notable changes to this project will be documented in this file.

### Fixed

- Fixed an issue where the library creates wrong images by adding base image layers in reverse order when registry uses the old V2 image manifest, schema version 1 (such as Quay) ([#1627](https://github.com/GoogleContainerTools/jib/issues/1627))

## 0.9.0

### Added
Expand All @@ -22,10 +24,12 @@ All notable changes to this project will be documented in this file.
- Methods in `JavaContainerBuilder` for setting the destination directories for classes, resources, directories, and additional classpath files

### Changed

- Allow skipping `JavaContainerBuilder#setMainClass()` to skip setting the entrypoint
- `os` and `architecture` are taken from base image ([#1564](https://github.com/GoogleContainerTools/jib/pull/1564))

### Fixed

- `ImageReference` assumes `registry-1.docker.io` as the registry if the host part of an image reference is `docker.io` ([#1549](https://github.com/GoogleContainerTools/jib/issues/1549))

## 0.1.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.google.cloud.tools.jib.image.ReferenceNoDiffIdLayer;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import java.time.Duration;
import java.time.Instant;
import java.time.format.DateTimeParseException;
Expand Down Expand Up @@ -72,7 +73,8 @@ public static Image<Layer> toImage(V21ManifestTemplate manifestTemplate)
throws LayerPropertyNotFoundException {
Image.Builder<Layer> imageBuilder = Image.builder(V21ManifestTemplate.class);

for (DescriptorDigest digest : manifestTemplate.getLayerDigests()) {
// V21 layers are in reverse order of V22. (The first layer is the latest one.)
for (DescriptorDigest digest : Lists.reverse(manifestTemplate.getLayerDigests())) {
imageBuilder.addLayer(new DigestOnlyLayer(digest));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,15 @@ public void testToImage_v21()
Image<Layer> image = JsonToImageTranslator.toImage(manifestTemplate);

List<Layer> layers = image.getLayers();
Assert.assertEquals(1, layers.size());
Assert.assertEquals(2, layers.size());
Assert.assertEquals(
DescriptorDigest.fromDigest(
"sha256:8c662931926fa990b41da3c9f42663a537ccd498130030f9149173a0493832ad"),
"sha256:5bd451067f9ab05e97cda8476c82f86d9b69c2dffb60a8ad2fe3723942544ab3"),
layers.get(0).getBlobDescriptor().getDigest());
Assert.assertEquals(
DescriptorDigest.fromDigest(
"sha256:8c662931926fa990b41da3c9f42663a537ccd498130030f9149173a0493832ad"),
layers.get(1).getBlobDescriptor().getDigest());
}

@Test
Expand Down
12 changes: 11 additions & 1 deletion jib-core/src/test/resources/core/json/v21manifest.json
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
{"schemaVersion":1,"fsLayers":[{"blobSum":"sha256:8c662931926fa990b41da3c9f42663a537ccd498130030f9149173a0493832ad"}],"history":[{"v1Compatibility":"some v1-compatible object"}]}
{
"schemaVersion":1,
"fsLayers": [
{"blobSum":"sha256:8c662931926fa990b41da3c9f42663a537ccd498130030f9149173a0493832ad"},
{"blobSum":"sha256:5bd451067f9ab05e97cda8476c82f86d9b69c2dffb60a8ad2fe3723942544ab3"}
],
"history": [
{"v1Compatibility":"some v1-compatible object"},
{"v1Compatibility":"another v1-compatible object"}
]
}
4 changes: 4 additions & 0 deletions jib-gradle-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ All notable changes to this project will be documented in this file.

### Fixed

- Fixed an issue where the plugin creates wrong images by adding base image layers in reverse order when registry uses the old V2 image manifest, schema version 1 (such as Quay) ([#1627](https://github.com/GoogleContainerTools/jib/issues/1627))

## 1.1.0

### Changed

- `os` and `architecture` are taken from base image ([#1564](https://github.com/GoogleContainerTools/jib/pull/1564))

### Fixed

- Fixed an issue where pushing to Docker Hub fails when the host part of an image reference is `docker.io` ([#1549](https://github.com/GoogleContainerTools/jib/issues/1549))

## 1.0.2
Expand Down
5 changes: 5 additions & 0 deletions jib-maven-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@ All notable changes to this project will be documented in this file.

### Fixed

- Fixed an issue where the plugin creates wrong images by adding base image layers in reverse order when registry uses the old V2 image manifest, schema version 1 (such as Quay) ([#1627](https://github.com/GoogleContainerTools/jib/issues/1627))

## 1.1.0

### Added

- Can now decrypt proxy configurations in `settings.xml`. ([#1369](https://github.com/GoogleContainerTools/jib/issues/1369))

### Changed

- `os` and `architecture` are taken from base image ([#1564](https://github.com/GoogleContainerTools/jib/pull/1564))

### Fixed

- Fixed an issue where pushing to Docker Hub fails when the host part of an image reference is `docker.io` ([#1549](https://github.com/GoogleContainerTools/jib/issues/1549))

## 1.0.2
Expand Down

0 comments on commit f36e905

Please sign in to comment.