Commit Graph

31 Commits

Author SHA1 Message Date
Priya Wadhwa b0b36ed85a Re-add support for .dockerignore file
This PR adds support for the dockerignore file. Previously when kaniko
had support for the dockerignore file, kaniko first went through the
build context and deleted files that were meant to be ignored. This
resulted in a really bad bug where files in user mounted volumes would
be deleted (my bad).

This time around, instead of modifying the build context at all, kaniko
will check if a file should be excluded when executing ADD/COPY
commands. If a file should be excluded (based on the .dockerignore) it
won't be copied over from the buildcontext and shouldn't end up in the
final image.

I also added a .dockerignore file and Dockerfile as an integration test,
which should fail if the dockerignore is not being processed correctly or if files aren't being excluded correctly.
Also, I removed all the integration testing from the previous version of the
dockerignore support.
2018-12-10 15:20:25 -08:00
priyawadhwa 0b7fa58ca2
Merge pull request #459 from aduong/symlinks
Overwrite existing dest when copying symlink and preserve link target
2018-11-30 09:28:26 -08:00
Priya Wadhwa 2cf6f52517 Fix hardlink unit test
Now that hardlink destinations take into account the directory that they are being extracted to, the unit test had to be updated to make sure that two hardlinks were extracted to /tmp/hardlink correctly.
2018-11-19 15:03:31 -05:00
Adrian Duong 3367268ef9 Test for fs_util.CopySymlink 2018-11-17 23:05:52 -08:00
dlorenc 063663e17b
Skip unpacking the base FS if there are no run commands (or only cached ones). (#440)
This is the final part of an optimization that I've been refactoring towards for awhile.
If the Dockerfile consists of no RUN commands, or cached RUN commands, followed by metadata-only
operations, we can skip downloading and unpacking the base image.
2018-11-12 12:51:45 -06:00
peter-evans b1e28ddb4f Fix handling of volume directive 2018-09-28 11:16:25 +09:00
priyawadhwa c814466e15
Merge pull request #347 from priyawadhwa/amazon
Whitelist /etc/mtab
2018-09-12 16:08:12 -07:00
Priya Wadhwa 99ab68e7f4 Replace gometalinter with GolangCI-Lint
gometalinter is broken @ HEAD, and I looked into why that was. During
that process, I remembered that we took the linting scripts from
skaffold, and found that in skaffold gometalinter was replaced with
GolangCI-Lint:

https://github.com/GoogleContainerTools/skaffold/pull/619

The change made linting in skaffold faster, so I figured instead of
fixing gometalinter it made more sense to remove it and replace it with
GolangCI-Lint for kaniko as well.
2018-09-11 13:30:42 -07:00
Priya Wadhwa c13f6e84ed Fixed unit test 2018-09-10 18:20:00 -07:00
Priya Wadhwa 85393a60c2 Fixed unit tests 2018-08-29 16:11:03 -07:00
Priya Wadhwa 5bdb87e0e7 Extract filesystem in order rather than in reverse
Extracting the layers of the filesystem in order will make it easier to
extract cached layers and deal with hardlinks.

This PR implements extracting in order and adds an integration tests to
make sure hardlinks are extracted properly.

It also fixes two bugs I found when extracting symlinks:

1. We'd get a "file exists" error when trying to symlink to an existing
file with a whiteout later in the layer tarball
2. We'd get a "file exists" error when trying to create a symlink from a
file that was created in a prior layer (perhaps as a regular file or as
a symlink pointing to someting else)

To fix both of these, we resolve all symlinks in a layer at the end. I
also added logic to delete any existing paths before creating the
symlink.
2018-08-29 15:44:38 -07:00
Priya Wadhwa d8ae5618af Get absolute path of file before checking whitelist
Issue 291 pointed out that symlink "../proc/self/mounts" in the fedora image wasn't being extracted properly and kaniko was erroring out.
This is because the file path wasn't absolute so kaniko wasn't recognizing it as a whitelisted path.
With this change, we first resolve a path to it's absolute path before checking the whitelist.
2018-08-17 18:29:11 -04:00
priyawadhwa 31b7cd3732
Fix bug in copy command by refactoring whitelist checks (#231)
* Fixed bug

* WIP

* fix unit tests
2018-07-10 08:23:35 -07:00
xanonid d411bd6daf Track file ownership and use file ownership from base images (#209)
* Track file ownership and use file ownership from base images

* Fix fs_util_test - use current uid/gid.
2018-06-22 15:11:02 -07:00
Priya Wadhwa 54282e3e8c
Fix bug in snapshotting 2018-06-21 14:07:59 -07:00
Sharif Elgamal f8aa88b119
Integration test refactoring (#126)
* integration test refactoring

* config file cleanup

* more test refactoring

* remove debug file

* moving around more files

* fixing up integration tests

* integration tests work

* some housekeeping

* fixing tests

* addressing comments

* debugging

* debugging

* actual debugging

* skip integration tests for travis

* install container-diff before integration tests

* syntax

* make test failures less noisy

* fixing tests

* hopefully fixing CI?

* fixes

* more fixes

* let's actually fix CI

* more testing

* testing

* proper auth

* typos

* adding support for args in integration tests

* formatting

* formatting

* adding support for testing bucket context

* adding bucket test dockerfile

* addressing comments

* syntax
2018-05-15 13:42:35 -07:00
Priya Wadhwa 347ce66a9b
Merged master, fixed merge conflict 2018-05-09 13:50:33 -07:00
Priya Wadhwa 7fbc21ec73
Merged master, fixed merge conflict 2018-05-07 09:14:17 -07:00
Priya Wadhwa 904575d0cb
support multi stage builds 2018-04-26 15:40:41 -07:00
dlorenc cd5b744904
Switch from containers/image to go-containerregistry (#140)
* Vendor changes for go-containerregistry switch.

* Manual changes for go-containerregistry switch.

The biggest change is refactoring the tarball unpacking.

* Pull more of container-diff out.

* More vendor removals.

* More unit tests.
2018-04-25 19:21:05 -07:00
Priya Wadhwa 946b11b894
fix parent directory 2018-04-25 12:59:18 -07:00
Priya Wadhwa a211c1ec71
Make sure to snapshot parent directories of specific files for add/copy 2018-04-24 16:22:37 -07:00
Matt Rickard cff201dee6 org rename from GoogleCloudPlatform to GoogleContainerTools 2018-04-17 11:45:39 -07:00
Priya Wadhwa ec510a161b
change imports from k8s-container-builder to kaniko 2018-04-12 15:35:54 -07:00
Priya Wadhwa fad0d25aec
Add README and update name to kaniko 2018-04-02 14:00:15 -07:00
Priya Wadhwa 5ebf156d94
Fixed relative filepath and unit test 2018-03-15 13:47:40 -07:00
Priya Wadhwa 21a9207428
Copy command and unit tests 2018-03-14 17:06:46 -07:00
Priya Wadhwa 98826ef951
Changed /work-dir to /kbuild 2018-03-07 15:38:22 -08:00
Priya Wadhwa 3195b84c25
Fixed integration tests, changed directory to /work-dir 2018-03-06 15:25:04 -08:00
Priya Wadhwa f68fa5fa97
Changed /work-dir and /dockerfile to /workspace 2018-02-28 09:44:22 -08:00
Priya Wadhwa 093dfd04df
Unpack filesystem and whitelist from /proc/self/mountinfo 2018-02-21 11:02:30 -08:00