Commit Graph

146 Commits

Author SHA1 Message Date
Hingbong Lo 9f57952214
fix: use refrence should after err handles (#2128)
* fix: use refrence should after err handles

* Update pkg/executor/build.go

Co-authored-by: Jason Hall <jason@chainguard.dev>
2022-06-09 11:00:30 -04:00
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 28432d3c84
fix(ci): Docker build for issue 1837 (#2095)
* fix: Docker build for issue 1837

* fix: Linting
2022-05-17 14:21:57 -04:00
Jason D'Amour 872758b8b0
feat: add flag to disable pushing cache (#2038) 2022-05-16 12:21:26 -07:00
Jack d4cf49077a
feat: kaniko dir config option (#1997)
* remove configurables from constants

* add configurables to config init

* add kaniko dir flag

* cleanup pkg constants

* replace buildcontext constants pkg occurrences with config

* add KanikoDir to KanikoOptions

* replace executor constants pkg occurrences with config

* remove redundant KanikoDir assignment

* replace constants to config for IntermediateStagesDir

* fix imports

* add default kaniko directory into constants

* add check for kanikoDir on use

* update init to use default path constant

* update executor kanikoDir check

Co-authored-by: Jason Hall <jasonhall@redhat.com>

* alter checkKanikoDir parameter

* add TestKanikoDir func

* update error handling style

Co-authored-by: Jason Hall <jasonhall@redhat.com>

* remove shorthand flag usage from test

Co-authored-by: Jason Hall <jasonhall@redhat.com>

* add docstring to integration test

Co-authored-by: Jason Hall <jasonhall@redhat.com>

* remove shorthand flag from kaniko-dir

Co-authored-by: Jason Hall <jasonhall@redhat.com>
2022-03-31 15:10:23 -04:00
Gabriel Nützi 2d94d56af7
Fix resolving arguments over multi-stage build (#1928)
* Fix resolving argument over mulit-stage build

- Building multi-stage Dockerfiles did not correctly resolve
  ARG commands over different stages. Now, each stage depends on the
  build arguments set by the stage before.

Closes: #1911

* Fix resolving empty arg commands
2022-02-10 09:22:21 -08:00
Florian Apolloner ef97636546
Restore build args after optimize. Fixes #1910, #1912. (#1915)
* Restore build args after optimize. Fixes #1910, #1912.

* Apply review suggestions.
2022-02-09 11:50:40 -05:00
Jason Hall 76624697df
Bump github.com/docker/docker to latest release (#1866)
* Bump github.com/docker/docker to latest release

* Pin deps to docker/docker's requirements

fix build breakages
fix unit test
Trying to see whether am-i-in-a-container checks are broken for integration tests...
2022-01-14 15:58:32 -05:00
Dawei Ma ee2249b3d5
fix: ARG/ENV used in script does not invalidate build cache (#1688) (#1693) 2021-12-30 12:51:00 -05:00
Janosch Maier 46e01340c2
Remove tarball.WithCompressedCaching flag to resolve OOM Killed error (#1722)
* Remove tarball.WithCompressedCaching flag to resolve OOM Killed error

Large images cannot be build as the kaniko container will be killed due to an OOM error. Removing the tarball compression drastically reduces the memory required to push large image layers. Fixes #1680

This change may increase the build time for smaller images. Therefore a command line option to trigger the compression or a more intelligent behaviour may be useful.

* Add new command line flag to toggle compressed caching

* Add unittest for build with --compressed-caching command line flag set to false
2021-10-19 00:14:06 -07:00
Gilbert Gilb's a42adb9bb4
Fix composite cache key for multi-stage copy command (#1735)
* 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

* Fix composite cache key for multi-stage copy command (#1706)

PR #1518 reintroduced COPY layers caching using the `--cache-copy-layers`
flag. Unfortunately, this PR also introduced a bug by not including the
stage digest into the caching key of the COPY command when the
`--cache-copy-layers` flag was not set. As a result, kaniko would use
any previous (possibly stalled) layer from the cache because the digest
of the "COPY --from" command would never change.

PR author probably expected Go to fallthrough in the switch just like C
does. However, this is not the case. Go does not fallthrough in
switch-statements by default and requires the fallthrough keyword to be
used. Note that this keyword is not available in type-switches though,
because it wouldn't work properly with typings.

* refactor: add an abstract copy command interface to avoid code duplication

* fix typo in error message

Co-authored-by: Tejal Desai <tejal29@gmail.com>
2021-10-18 23:31:01 -07: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
Jose Donizetti 5b3fb84a22
Retry extracting filesystem from image (#1685)
* Retry extracting filesystem from image

* Add flag image-fs-extract-retry

* Add --image-fs-extract-retry documentation
2021-07-08 12:00:22 -07:00
Kamal Nasser f21639daac
Fix snapshotter ignore list; do not attempt to delete whiteouts of ignored paths (#1652)
* avoid deleting whiteouts if they are in ignore list

* fix snapshotter ignore list

* include filesystem mounts in ignorelist of snapshotter
* clean up ignore list logic

* add unit and integration tests for #1652

* fix tests and ignore list updates
2021-06-04 10:07:24 -07:00
Matt Moore 1ad4295462
Update ggcr to pick up estargz and caching option (#1527) 2020-12-21 10:09:21 -08:00
Tejal Desai b04399eeac
add caching copy layers back (#1518)
* add caching copy layers back

* fix test

* lint

* fix test - 2

* Add integration test

* fix lint
2020-12-11 00:25:03 -08:00
Vincent Behar dde98a8e73
feat(warmer): Warmer now supports all registry-related flags (#1499)
which means we can now:
- set up one or more mirrors
- set up registries certificates
- skip TLS verify
- use plain HTTP
using the same set of flags that are defined for the executor
2020-12-10 22:55:43 -08:00
Lars c982956c15
Fix typo in error message (#1494) 2020-12-08 16:18:11 -08:00
mickkael 275cc9a7e7
Add option customPlatform (#1500)
* Add option customPlatform

* fix formatting

* fix No newline at end of file
2020-12-08 16:11:18 -08:00
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 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 b7462742c1 add deletion logic 2020-06-06 02:05:45 -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 ec3ca84ad9 add another redo snapshotter 2020-06-04 22:02:13 -07:00
Tejal Desai cbf3073fda rename whitelist to ignorelist 2020-06-02 15:56:27 -07:00
Ben Einaudi 2f6090dcd7 Remove use of DefaultTransport
Using DefaultTransport and manipulating its tls configuration may lead to unexpected behaviour
2020-05-20 11:43:13 +02:00
Tejal Desai 3f3c19a545
Merge pull request #1234 from tejal29/fix_copy_from
Apply dockefile exclude only for first stage
2020-05-19 15:40:51 -07:00
Tejal Desai c71deae38c remove dedupes 2020-05-07 16:37:17 -07:00
Tejal Desai 5e275d9824 Apply dockefile exclude only for first stage 2020-05-05 21:45:36 -07:00
Jordan Goasdoue a9c7839491 fix: stages are now resolved correctly if skip-unused 2020-05-04 18:38:18 +02: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 5090baafda fix single snapshot 2020-05-03 20:23:07 -07:00
Tejal Desai db7687dbce wip 2020-05-03 18:37:45 -07:00
Tejal Desai 75864d5c85 flip the flag 2020-05-01 23:41:06 -07:00
Tejal Desai 7d32139a13 fix a bug where file check nil is insufficient 2020-05-01 22:38:14 -07:00
Tejal Desai 32e3336d4c add a new method to indicate if the command provides files to snapshot 2020-05-01 15:50:46 -07:00
Tejal Desai 6c627645ad
Merge pull request #1194 from tp-tc/greedy-cache-substitution
Don't generate cache key, if not caching builds.
2020-05-01 10:21:44 -07:00
Tejal Desai 2e1ca5f19d
remove log added for debugging 2020-05-01 09:40:39 -07:00
Ben Einaudi d763b7e961 fix previous name checking in 'executor.build.fetchExtraStages' 2020-05-01 16:45:01 +02:00
Tejal Desai 8fb17f60d9 Defer initial snapshot. Remove ReadSuccess() 2020-04-30 13:25:22 -07:00
Tom Prince c520218cec Don't generate cache key, if not caching builds.
The cache key generation does environment subsitution in places that running
the commands doesn't. This causes issues if a command uses complex shell
substitutions. The cache key is generated even if caching isn't enabled.

This disables the cache key generation if caching is not enabled. This doesn't
fix the underlying issue, but limits it to when the cache is being used.
2020-04-13 16:50:13 -06: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 961e634366 calculate dependency for onbuild 2020-04-10 18:49:34 +03:00