Commit Graph

47 Commits

Author SHA1 Message Date
Tinjo Schöni 5f4e2f1366
Fix .dockerignore for build context copies in later stages (#1447)
* Extend .dockerignore integration test with copies in later stages

.dockerignore should continue to apply when copying from the build context in later stages, but it currently doesn't

* Replace excluded global with passed along FileContext struct

This new FileContext struct allows much cleaner handling of context specific file exclusions.
The global excluded file state is no longer needed.

Additionally this also fixes the issue where excluded files aren't being applied for build context copies in later build stages.
2020-10-08 12:47:14 -07:00
Ian Kerins 1240333657
Stop caching COPY layers (#1408)
Cached COPY layers are expensive in that they both need to be retrieved
over the network and occupy space in the layer cache.

They are unnecessary in that we already have all resources needed to
execute the COPY locally, and doing so is a trivial file-system
operation.  This is in contrast to RUN layers, which can do
arbitrary and unbounded work.

The end result is that cached COPY commands were more expensive when
cached, not less.  Remove them.

Resolves #1357
2020-09-30 17:18:50 -07:00
Tejal Desai 98a2ee2e34 intoduce delay 2020-06-06 20:52:58 -07:00
Tejal Desai 07cdfcf091 fix tests 2020-06-06 20:28:04 -07:00
Tejal Desai c85d64c8ae better shdTakeSnapshot 2020-06-06 19:49:34 -07:00
Tejal Desai b7462742c1 add deletion logic 2020-06-06 02:05:45 -07:00
Tejal Desai 43338d4b2f add a new run command along with a new flag 2020-06-05 19:53:16 -07:00
Jordan Goasdoue a9c7839491 fix: stages are now resolved correctly if skip-unused 2020-05-04 18:38:18 +02:00
Tejal Desai ee097f9b70 fix unit tests 2020-05-03 22:01:50 -07:00
Tejal Desai d37896b94f
Merge branch 'master' into experiment 2020-05-03 21:02:41 -07:00
Tejal Desai a2af3272cf
Merge pull request #1192 from tp-tc/snapshot-maintainers
Handle `MAINTAINERS` when passing `--single-snapshot`.
2020-05-03 20:45:48 -07:00
Tejal Desai 7d32139a13 fix a bug where file check nil is insufficient 2020-05-01 22:38:14 -07:00
Tom Prince 484d03550c Handle `MAINTAINERS` when passing `--single-snapshot`. 2020-04-13 15:54:27 -06:00
Dani Raznikov f720c817c7 add unit tests 2020-04-12 20:17:40 +03:00
Dani Raznikov 3ab6524fe5 optimize: don't parse Dockerfile twice and just reuse stages 2020-04-03 18:53:22 +03:00
Dani Raznikov a3ce1cebf3 optimize: don't parse Dockerfile twice and just reuse stages 2020-04-03 17:39:59 +03:00
Tejal Desai 9567b755dd fix unit tests 2020-03-25 10:09:33 -07:00
Tejal Desai 2ea28fc7f5 revert back to previous file to save logic 2020-03-25 09:43:59 -07:00
Tejal Desai caaf6c8adf fix tests 2020-03-24 10:50:59 -07:00
Tejal Desai ffc372a63b refactor to add unit tests 2020-03-23 17:48:49 -07:00
Tejal Desai 0302e5150c
Merge pull request #1085 from tejal29/rm_buildargs_from_cache_key
remove build args from composite key and replace all build args
2020-03-17 16:02:59 -07:00
Yoan Blanc 53326fa0bf
executor: add --label flag
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2020-03-07 18:17:26 +01:00
Tejal Desai 579ec52a30 add more tests for stageBuilder_build 2020-03-04 17:04:42 -08:00
Tejal Desai b9f4c4bab5 add more tests for stageBuilder_build 2020-03-04 16:57:26 -08:00
Tejal Desai ae5a7bf158 fix tests 2020-02-28 02:53:42 -08:00
Tejal Desai 58c0d47fa6 fix npe 2020-02-28 02:44:43 -08:00
Tejal Desai 2ba7d25090 remove build args from composite key and replace all build args before adding command to the cache 2020-02-28 01:51:31 -08:00
Cole Wippern 782e4916b6 update build and composite cache tests 2020-01-23 15:37:38 -08:00
Cole Wippern 9e9b8a6e71 Fix #899 cached copy results in inconsistent key
* Update cached copy command to return the same result for
files used from context so that cached and uncached copy
commands produce the same cache key
* Update tests for fix
* Add test for cached run command key consistency
2019-12-15 10:23:31 -08:00
Cole Wippern b19214ad1e Use cachekey not digest for COPY --from src
* use the cachekey of the src stage rather than the digest
for COPY --from commands as they are reproducible unlike digests
* track digest to cache keys and stage indexes to digest
* add extra debug logging for troubleshooting cachekey building issues
* convert Sha256 hashes to hex encoded strings rather than plain strings
for easier human reading
2019-12-10 08:45:13 -08:00
Cole Wippern 7b4b768edf Update copy command cache key logic
Include the digest of the stage specified in the --from argument for
COPY commands which use --from
2019-12-09 16:48:20 -08:00
Cole Wippern 7ba65daf7f cleanup executor/build_test.go 2019-11-28 09:36:39 -08:00
Cole Wippern 6d0c8da90e more stagebuilder caching tests 2019-11-28 08:42:13 -08:00
Cole Wippern 33f3191b17 Don't hardcode hashes for stagebuilder tests 2019-11-27 21:47:00 -08: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
Tejal Desai 30f1a7dae9 fix lint 2019-09-13 12:16:40 -07:00
Tejal Desai 9b9fb815a7 fix format 2019-09-13 11:56:57 -07:00
Tejal Desai f0e571839d add unit tests 2019-09-13 11:21:43 -07:00
Tejal Desai a014c4a1e8 added unit tests 2019-09-13 11:00:05 -07:00
dlorenc c8fabdf6e4
Fix arg handling for multi-stage images in COPY instructions. (#621) 2019-03-22 12:24:43 -05:00
dlorenc 246cc92a33
Optimize file copying and stage saving between stages. (#605)
This change calculates the exact files and directories needed between
stages used in the COPY command. Instead of saving the entire
stage as a tarball, we now save only the necessary files.
2019-03-13 07:47:28 -07:00
dlorenc c2514305ef
Fix a bug in snapshotting with multi-stage images. (#546)
We previously had an optimization that would skip snapshotting mutli-stage images
when in an intermediate stage, until the very end.

This conflicted with another optimization to avoid snapshotting when no files had changed.
2019-01-30 13:57:02 -06:00
Andrew Rynhard 01329d5ac1 Fix intermediate layer caching (#474)
* Fix intermediate layer caching

* Move the if statement into the ShouldTakeSnapshot function.

Also add some unit tests.
2018-12-10 11:34:06 -08:00
Sharif Elgamal 224b7e2b41
parse arg commands at the top of dockerfiles (#404)
* parse arg commands at the top of dockerfiles

* fix pointer reference bug and remove debugging

* fixing tests

* account for meta args with no value

* don't take fs snapshot if / is the only changed path

* move metaArgs inside KanikoStage

* removing unused property

* check for any directory instead of just /

* remove unnecessary check
2018-11-06 15:27:09 -08:00
Priya Wadhwa cd1b957e43 Address code review comments; review unnecessary error check 2018-09-17 11:11:51 +01:00
Priya Wadhwa d923d5ef02 Fix integration test 2018-09-11 10:07:54 -07:00
Priya Wadhwa 5d2d2829d0 Review config for cmd/entrypoint after building a stage
As mentioned in #346, if only ENTRYPOINT is set in a stage then any
CMD inherited from a parent should be cleared.

If both entrypoint and cmd are set then nothing should change.

I added a function and unit test to review the config file after building a stage
which clears out config.Cmd if ENTRYPOINT was declared but CMD wasn't.

I also added an integration test to make sure this works, which should
be tested by the preexisting container-diff --metadata test.
2018-09-10 18:15:51 -07:00