forked from GoogleContainerTools/kaniko
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync filesystem before snapshotting so mtime can be relied on
The default hashing algorithm used by kaniko to determine if two files are the same uses the files' mtime (the inode's modification time). It turns out that this time is not always up to date, meaning that a file could be modified but when you stat the file, the modification time may not yet have been updated. The copy integration tests were adding the same directory twice, the second instance being to test copying a directory with a wilcard '*'. Since the mtime is sometimes not updated, this caused kaniko to sometimes think the files were the same, and sometimes think they were different, varying the number of layers it created. Now we will update those tests to use a completely different set of files instead of copying the same files again, and we add a new test (`Dockerfile_test_copy_same_file`) which intentionally copies the same file multiple times, which would reliably reproduce the issue. We fix the issue by calling `sync` before we start comparing mtimes. This will slow down layer snapshotting - on my personal machine it costs ~30 ms to call, and added ~4 seconds to running all of the `Dockerfile_test_copy*` tests. I'm assuming that adding 30ms per layer is okay, but it's a potential place to speed things up later if we need to. Fixes GoogleContainerTools#251 _Interesting note, if you build this same Dockerfile with devicemapper, you end up with only 2 layers! `¯\_(ツ)_/¯` _
- Loading branch information
1 parent
954b612
commit 76a8ab7
Showing
8 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
qup |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
que |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
quz |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
FROM alpine@sha256:5ce5f501c457015c4b91f91a15ac69157d9b06f1a75cf9107bf2b62e0843983a | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo | ||
COPY context/foo /foo |
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