Commit Graph

74 Commits

Author SHA1 Message Date
Gabriel Nützi 323e616a67
fix: Refactor `LayersMap` to correct old strange code behavior (#2066)
* fix: Correct flatten function in layers

- Added a test.
- Cache current image, track deletes in `whiteouts` as well as normal adds in `layers`.
- Fix ugly delete behavior of `layerHashCache`.
  Delete it when crerating a new snapshot.
- Slight cleanup in `snapshot.go`.
- Format ugly `WalkFS` function.

* fix: Add symbolic link changes  to Hasher and CacheHasher

* fix: Better log messages

* fix(ci): Integration tests

* fix(ci): Add `--no-cache` to docker builds

* fix(ci): Pass credentials for error integration test

* np: Missing .gitignore in `hack`

* np: Capitalize every log message

- Correct some linting.

* fix: Key function

- Merge only last layer onto `currentImage`.

* fix: Remove old obsolete `cacheHasher`
2022-05-17 20:30:58 -04:00
Gabriel Nützi 76a54a031d
Fix: Flatten layer function needs to return existing files in the layer correctly (#2057)
* fix: Remove hardcoded whiteout prefix

* fix: Flatten function should return all existing files without whiteouts

* np: Documentation
2022-04-26 16:46:09 -04:00
Tejal Desai 1da17b6e9b
chore: add workflows for pr tests (#1766)
* chore: add workflows for pr tests

* fix unit tests

* fix formatting

* chore: fix gobuild

* change minikube script

* chore: fix lint install script

* chore: ignore and fix tests

* fix lint and run gofmt

* lint fixes

* k8s executor image only

* fix Makefile

* fix travis env variables

* more info on k8s tests

* fix travis run

* fix

* fix

* fix

* fix log

* some more changes

* increase timeout

* delete travis.yml and fix multiple copy tests

* fix registry mirror

* fix lint

* add concurency

* last attemot to fix k8 integrations

* diff id for diff workflows
2021-10-18 23:22:44 -07:00
Rhianna b525d1e27b
Support force-building metadata layers into snapshot (#1731)
* feat: add support for forcing build metadata

* Chore: Added snapshot forceBuildMetadata flag tests.
2021-10-18 11:43:51 -07:00
Tejal Desai 094fe52b37
Revert "save snaphots to tmp dir (#1662)" (#1670)
This reverts commit 754253d375.
2021-06-14 12:09:07 -07:00
Patrick Barker 754253d375
save snaphots to tmp dir (#1662) 2021-06-14 12:08:47 -07:00
Josh Chorlton ece215c181
reject tarball writes with no destinations (#1534)
* reject tarball writes with no destinations

* Update pkg/snapshot/snapshot.go

Co-authored-by: Tejal Desai <tejal29@gmail.com>
2021-01-03 10:13:05 -08:00
Tejal Desai 2427b348ac
Merge pull request #1350 from hlubek/bugfix-reproducible-whiteout
Bugfix: Reproducible layers with whiteout
2020-07-28 14:57:28 -07:00
Joe Kutner 29a02b08ff
Move snapshotPathPrefix into a method
This allows the value to be determined on the fly, which supports consumers that use Kaniko snaphot as a library and may need to change the value of config.KanikoDir
2020-07-26 21:46:33 -05:00
Christopher Hlubek 699a4bee32 Bugfix: Reproducible layers with whiteout
When deleting files of previous layers, the whiteout files
were not added to the tar file in a consistent order.

This change adds a stable sorting to the whiteout files and
adds unit tests to check for stable sorting.
2020-07-16 10:56:59 +02:00
Tejal Desai 4ac51ef515 merge 2020-06-06 20:17:17 -07:00
Tejal Desai c85d64c8ae better shdTakeSnapshot 2020-06-06 19:49:34 -07:00
Tejal Desai b9d25dd5db better whiteout logic 2020-06-06 10:50:24 -07:00
Tejal Desai cbf4452fe9 fix snapshot 2020-06-06 10:03:37 -07:00
Tejal Desai ede69f8507 check file changed in loop 2020-06-06 01:24:46 -07:00
Tejal Desai 0f5387960e minimal changes 2020-06-06 00:16:14 -07:00
Tejal Desai 58276274e8 better improvements 2020-06-05 23:44:17 -07:00
Tejal Desai 43338d4b2f add a new run command along with a new flag 2020-06-05 19:53:16 -07:00
Tejal Desai 9c68c9a36c Merge branch 'master' into fix_looping 2020-06-04 13:18:30 -07:00
Tejal Desai cbf3073fda rename whitelist to ignorelist 2020-06-02 15:56:27 -07:00
Tejal Desai 41bc04dc12 add timings for resolving pahts 2020-05-23 14:29:46 -07:00
Tejal Desai 503aad17b7 Fix looping through files twice 2020-05-23 14:24:07 -07:00
Gilbert Gilb's fd8a2d6dd8 Merge branch 'master' into snapshot-directories 2020-03-31 14:25:04 +02:00
Gilbert Gilb's e5585fded8 Always add parent directories of files to snapshots.
During a snapshot, when a file changed and not its parent directories,
the parent directories weren't added to the layer. This is inconsistent
with Docker's behavior which always add parent directories to the layer.
In some edge-cases, it could lead to problems with docker considering
that parent directories where owned by root in forthcoming layers
although they shouldn't (see #1163).

Also, Docker seems to be POSIX compliant regarding the name of
directories in the archive, which always have a slash appended. This
commit also fixes this.

Fixes #1163
2020-03-29 18:25:37 +02:00
Tejal Desai ffc372a63b refactor to add unit tests 2020-03-23 17:48:49 -07:00
Tejal Desai 6c14d202a3 better error wrapping and add more tests for copy 2020-03-06 17:18:36 -08:00
cvgw 965b606720 remove cruft and unneeded loop 2020-02-23 13:38:08 -08:00
cvgw a675ad998a Resolve filepaths before scanning for changes 2020-02-20 09:45:44 -08:00
tinkerborg cc2c9a0663 sort filesToAdd in TakeSnapshot
filesToAdd is sorted in TakeSnapshotFS, but not here. This makes ordering unpredictable within the layer's tarball,
causing the SHA to differ even if layer contents haven't changed
2020-02-06 13:36:21 -05:00
Thomas Bonfort 6b6742fd9d Changle loglevel for whiteouts to debug 2020-01-31 12:02:32 +01:00
Tejal Desai 3e5d0a6334 add unit tests 2020-01-23 11:12:54 -08:00
Tejal Desai bb129e9c88 code review comments 2020-01-22 16:27:06 -08:00
Tejal Desai 478205e5ca fix adding symlinks to FS which do not exists 2020-01-22 15:27:01 -08:00
Tejal Desai f1f7297478 fix tests 2020-01-22 11:47:10 -08:00
Tejal Desai da7e9928e4 Fix Symlinks not being copies across stages 2020-01-22 11:47:10 -08:00
Prashant Arya 85f1a5db00 Merge branch 'master' of https://github.com/GoogleContainerTools/kaniko into log 2019-12-19 03:20:56 +00:00
Cole Wippern 697037cbcf Add unit tests for compositecache and stagebuilder
* add mock types for testing
* enhance error messaging
* add tests
2019-11-27 21:47:00 -08:00
Prashant Arya 857715012f changing log level 2019-11-26 17:52:11 +00:00
priyawadhwa 7adf2fcb50
Merge pull request #714 from MJDSys/reproducible_add
Make container layers captured using FS snapshots reproducible
2019-08-19 14:39:18 -07:00
Taylor Barrella 3422d5572a Misc. small changes/refactoring (#712) 2019-07-23 15:10:22 -07:00
Matthew Dawson 619fc5e59b Make container layers captured using FS snapshots reproducible
When a Dockerfile command requires using the TakeSnapshotFS function,
the resulting layer has a random ordering of files.  This causes the
layer to have a non-deterministic hash defeating the reproducible flag.
Issue #710 appears to document this issue as well.

To fix, always sort the list of files to be added in scanFullFilesystem.
This avoids trying to sort the file list during execution, and takes
almost no time to complete.
2019-07-11 21:58:42 -04:00
Dirk Gustke dd9d081447 this is quite spammy in my multistage build (#640)
.. and as i am surely not the only one, move it down to debug.
2019-04-15 13:22:46 -07:00
Daisuke Taniwaki 1bf4421047 Fix parent directory permissions (#619)
* Add parent directories of adding files

* Add integration Dockerfile to test parent directory permissions

* Remove unnecessary helper method

* Use a file on the internet for integration Dockerfile
2019-03-19 12:40:15 -05:00
Jason Hall faadb2af86 Log "Skipping paths under..." to debug (#571)
This reduces noise in the log output, since it isn't terribly useful to most end users.
2019-02-19 13:54:26 -06:00
dlorenc 8d78db4842
Refactor snapshotting (#561) 2019-02-14 12:14:28 -06:00
dlorenc 877abd30ed
Refactor whitelist handling. (#559)
Also speed up stage deletion.
2019-02-13 11:17:56 -06:00
dlorenc 170e0a2d94
Add a lot more timing data. (#518) 2019-01-10 13:27:55 -07:00
dlorenc 9ab66560db
Simplify snapshotting. (#517) 2019-01-09 15:31:02 -07:00
dlorenc a044e2b6e4
Even faster snapshotting with godirwalk. (#504)
This switches from filepath.Walk to godirwalk.Walk for even faster snapshotting.
A quick test shows a 40% improvement on the dockerfile_mv_add build.
2019-01-03 13:10:18 -06:00
Priya Wadhwa 2a359f547c Only return filepath.SkipDir for directories
From the docs on filepath.SkipDir:

> If the function returns SkipDir when invoked on a non-directory file, Walk skips the remaining files in the containing directory

This was causing the bug in #457. Since the file `/etc/hosts` was in the whitelist, when filepath.SkipDir was called the entire etc directory was skipped.

This change only returns filepath.SkipDir on directories.
2018-11-19 15:56:11 -05:00