Skip to content

Commit f4d6757

Browse files
committed
Revert "GoogleContainerTools#3158 - [Jib core] Tar archives with same contents are not reproducible"
This reverts commit 562e2b8
1 parent 46d56e8 commit f4d6757

File tree

2 files changed

+0
-24
lines changed

2 files changed

+0
-24
lines changed

jib-core/src/main/java/com/google/cloud/tools/jib/tar/TarStreamBuilder.java

-3
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@
2121
import java.io.IOException;
2222
import java.io.OutputStream;
2323
import java.nio.charset.StandardCharsets;
24-
import java.time.Instant;
2524
import java.util.LinkedHashMap;
2625
import java.util.Map;
2726
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
2827
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
2928

3029
/** Builds a tarball archive. */
3130
public class TarStreamBuilder {
32-
public static final Instant DEFAULT_MODIFICATION_TIME = Instant.ofEpochSecond(1);
3331

3432
/**
3533
* Maps from {@link TarArchiveEntry} to a {@link Blob}. The order of the entries is the order they
@@ -91,7 +89,6 @@ public void addByteEntry(byte[] contents, String name) {
9189
public void addBlobEntry(Blob blob, long size, String name) {
9290
TarArchiveEntry entry = new TarArchiveEntry(name);
9391
entry.setSize(size);
94-
entry.setModTime(DEFAULT_MODIFICATION_TIME.getEpochSecond());
9592
archiveMap.put(entry, blob);
9693
}
9794
}

jib-core/src/test/java/com/google/cloud/tools/jib/tar/TarStreamBuilderTest.java

-21
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import java.nio.file.Files;
3030
import java.nio.file.Path;
3131
import java.nio.file.Paths;
32-
import java.util.Arrays;
3332
import java.util.zip.GZIPInputStream;
3433
import java.util.zip.GZIPOutputStream;
3534
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
@@ -132,26 +131,6 @@ public void testToBlob_multiByte() throws IOException {
132131
Assert.assertNull(tarArchiveInputStream.getNextTarEntry());
133132
}
134133

135-
@Test
136-
public void testTarStreamAreReproducible() throws IOException, InterruptedException {
137-
testTarStreamBuilder.addBlobEntry(
138-
Blobs.from("jib"), "jib".getBytes(StandardCharsets.UTF_8).length, "jib");
139-
ByteArrayOutputStream firstTarByteOutputStream = new ByteArrayOutputStream();
140-
testTarStreamBuilder.writeAsTarArchiveTo(firstTarByteOutputStream);
141-
142-
Thread.sleep(2000);
143-
144-
TarStreamBuilder anotherTestTarStreamBuilder = new TarStreamBuilder();
145-
anotherTestTarStreamBuilder.addBlobEntry(
146-
Blobs.from("jib"), "jib".getBytes(StandardCharsets.UTF_8).length, "jib");
147-
ByteArrayOutputStream secondTarByteOutputStream = new ByteArrayOutputStream();
148-
anotherTestTarStreamBuilder.writeAsTarArchiveTo(secondTarByteOutputStream);
149-
150-
Assert.assertTrue(
151-
Arrays.equals(
152-
firstTarByteOutputStream.toByteArray(), secondTarByteOutputStream.toByteArray()));
153-
}
154-
155134
/** Creates a TarStreamBuilder using TarArchiveEntries. */
156135
private void setUpWithTarEntries() {
157136
// Prepares a test TarStreamBuilder.

0 commit comments

Comments
 (0)