Commit Graph

974 Commits

Author SHA1 Message Date
Martin Zihlmann 0f483da361
ADD is cacheable now 2025-05-31 08:59:04 +01:00
Martin Zihlmann 742e75b1ea
fix: ADD learned to cache it's output layer 2025-05-30 17:56:45 +01:00
Martin Zihlmann 6a7139eeec
simplify logic for detecting empty layers 2025-05-29 23:45:56 +01:00
Martin Zihlmann 49f24a7395
workdir is cacheable now 2025-05-29 23:23:07 +01:00
Martin Zihlmann 0561cc5664
support empty images in cache to handle WORKDIR w/o implicit folders created 2025-05-29 23:23:06 +01:00
Martin Zihlmann caebb2a538
move ToAbsPath to a function 2025-05-29 21:00:38 +01:00
Martin Zihlmann e39ab33677
fix: WORKDIR learned to cache it's output layer 2025-05-29 21:00:34 +01:00
Martin Zihlmann bded1ff3bb
drop warning again as empty layers are now handled properly 2025-05-27 23:49:55 +01:00
Martin Zihlmann fe3d53b617
dont append layer if known empty 2025-05-27 22:42:36 +01:00
Martin Zihlmann 2d14b6a277
Merge pull request #18 from mzihlmann/warn-about-cache-misses
RUN commands dont specify which files were added
2025-05-27 21:56:57 +01:00
Martin Zihlmann b058214391
RUN commands dont specify which files were added 2025-05-27 21:55:47 +01:00
Martin Zihlmann 8b37861b78
Merge pull request #17 from mzihlmann/ignore-labels
no need for deepcopy
2025-05-27 21:54:44 +01:00
Martin Zihlmann 8e8ad9d19c
no need for deepcopy 2025-05-27 21:20:12 +01:00
mzihlmann 176f8f6e0b
Merge pull request #12 from mzihlmann/warn-about-cache-misses
warn about potential cache-misses explicitly
2025-05-26 14:53:25 +01:00
Martin Zihlmann febeb075a1
warn about potential cache-misses explicitly 2025-05-26 14:41:17 +01:00
mzihlmann 1185dfab2c
Merge pull request #8 from mzihlmann/add-labels-on-last-image
drop whitespace diff
2025-05-25 12:44:21 +01:00
Martin Zihlmann 7a6d0f67db
drop whitespace diff 2025-05-25 11:12:36 +01:00
mzihlmann 6f15090e58
Merge pull request #6 from mzihlmann/add-labels-on-last-image
fix: preserve labels from base images
2025-05-25 10:50:48 +01:00
Martin Zihlmann 8b49940016
fix: preserve labels from base images 2025-05-25 10:48:16 +01:00
mzihlmann b34d005c0e
Merge pull request #4 from mzihlmann/add-labels-on-last-image
fix: intermediate images should not be labelled
2025-05-24 21:05:23 +01:00
mzihlmann 403e688fae
Merge pull request #3 from mzihlmann/fix-broken-links
fix: cache extract fails on invalid symlinks
2025-05-24 21:04:51 +01:00
mzihlmann 4b93823e20
Merge pull request #2 from mzihlmann/ignore-labels
fix: ignore labels on base image for cache
2025-05-24 21:04:09 +01:00
mzihlmann 604a9ed47e
Merge pull request #1 from mzihlmann/ignore-timestamp
fix: sourceImage's CreatedAt timestamp should not be included in cach…
2025-05-24 21:02:49 +01:00
Michael Plump 3e56c7fd0f
chore: upgrade all the dependencies to their latest versions (#3454)
* chore: go get -u ./...

* chore: go mod tidy

* chore: go mod vendor

* chore: fix compilation for buildkit >= 0.15.0

* chore: upgrade to Go 1.24

* chore: upgrade the Debian container used in an integration test
2025-05-21 09:31:10 -04:00
Martin Zihlmann 3cd564a735
fix: cache extract fails on invalid symlinks 2025-03-22 23:07:08 +00:00
Martin Zihlmann 79ce1d458b
fix: intermediate images should not be labelled 2025-02-16 14:08:40 +00:00
Martin Zihlmann e507b78ae6
fix: ignore labels on base image for cache 2024-10-13 04:54:48 +01:00
Martin Zihlmann 8106b5594f
fix: sourceImage's CreatedAt timestamp should not be included in cache key 2024-10-10 12:46:44 +01:00
Mick van Gelderen e1089414cb
fix: prevent panic when image name and stage alias are the same (#3245) 2024-07-10 09:34:45 -07:00
Aaron Prindle 5283199713
deps: bump github.com/moby/buildkit and github.com/docker/docker (#3242) 2024-07-08 13:02:39 -04:00
Leo Palmer Sunmo 6a340c6a1f
Enable pushing cache with --no-push (#3181)
Make sure we check --no-cache-push instead of --no-push when deciding whether to
push cache or not.
2024-06-04 11:21:16 -07:00
Prima Adi Pradana 34905d62e2
fix: warn instead of error when COPY wildcard does not match any files (#3127)
* when using wildcard hitting ResolveEnvAndWildcards ignore error when there is no file match

* adding unit test

* fix unit test wrong check in expected

* fix unit test for make sure there is no file copied

* copy with wildcard warning and success when no match file

* fix Test_IsSrcsValid since its changes the behaviour
2024-05-13 22:38:51 -07:00
Marc Lallaouret 7f365a644a
fix: make --registry-map compatible with namespaced images (#3138)
* For each registry mapping, represent it by a new instance of Repository and
  create a new Reference containing it.
* Improve registry mapping parser
* Add more unit tests to cover more use cases
2024-05-13 18:46:36 -07:00
Samarth08 d65b9b5418
"fix: resolve issue where cache layers would be pushed if --no-push was specified" (#3132) 2024-05-13 17:13:55 -07:00
Matthias Schneider a9062b97f7
feat: Added --chmod for ADD and COPY command. Fixes #2850 (#3119) 2024-04-22 09:28:37 -07:00
Prima Adi Pradana 02f488a694
Fix #3032: Remove query parameters in ADD command when the destinatio… (#3053)
* Fix #3032: Remove query parameters in ADD command when the destination is a directory

* fixing linter URL sorry forget to lint

* add error in extractFilename and realize that ResolveEnvironmentReplacement better execute before getting the filename
2024-03-21 19:32:40 -07:00
Prima Adi Pradana 9095b45d5c
Kaniko/add path regmaps [possible in registry maps and/or mirror] (#3051)
* add /path possible in registry maps and/or mirror

* Fixing Unit test Test_ExtractPathFromRegistryURL

* fix typo library

* fix unit test on ExtractPathFromRegistryURL

* fixing go lint url

* fix typo s/ectract/extract
2024-03-21 19:29:41 -07:00
Alessandro Bitocchi ba433abdb6
Fix COPY fails when multiple files are copied to path specified in ENV (#3034)
* Fixed unsolved ENV variable used as dest of COPY

* added unit test for copy cmd using env var as dest

* remove comment
2024-03-19 00:24:46 -07:00
Jérémie Augustin 8148159c30
Add AWS ECR error message for tag Immutability (#3045) 2024-03-18 23:01:34 -07:00
Matheus Pimenta 8bbd69d8a1
Add --push-ignore-immutable-tag-errors boolean CLI option (#2774) 2024-02-29 10:05:58 -08:00
schwannden 20a6ab560e
feat: add skip tls flag for private git context (#2854)
If git clone context is a private self-signed repository, we allow user
to add --git insecure-skip-tls=true flag in the option. The value is
default to false, this behavior is in accordance with the go-git
package.
2024-02-28 23:18:41 -08:00
Alessandro Bitocchi d5c36a6210
Fix unpack tar.gz archive with ADD instruction, issue #2409 (#2991)
* Fix unpack tar.gz archive with ADD instruction, issue #2409

* Added unit test for ADD instruction
2024-02-28 23:16:42 -08:00
Damien Degois 1bf529e6d9
Add flag to remap registries for any registry mirror (#2935)
* Add flag to remap registries for any registry mirror

The purpose of this PR is to add an option to remap registries, a kind of generalized `--registry-mirror`.
This is helpful for air-gapped environments and/or when local registry mirrors are available (not limited to docker.io).
This allows user to reference any images without having to change their location.
It also permit to separate infra related configuration (the mirrors) from CI/CD pipeline definition by using an environment variable for example (the reason behind the early return if flag provided but empty).
Therefore you can have a pipeline calling kaniko with `--registry-map=$REGISTRY_MAP` and have the `REGISTRY_MAP` populated via the runner's env by another team, and the absence of env wouldn't trigger a failure, it makes the pipeline env independent.

I've also considered the option of environment variables directly but it doesn't seems to be in kaniko's philosophy.

This makes quite some duplicated code :/ One option to keep the mirror flag and behavior would be to use only one codebase and convert `--registry-mirror=VALUE` to `--registry-map=index.docker.io=VALUE` internally. Suggestions welcome!

* Configure logging config sooner to be able to use it in flag parsing

* Replace registry mirrors by maps logic and use env var

* Add env vars to README.md

* Fix test
2024-02-14 15:23:41 -08:00
Kraev Sergei da3878e16b
Fix missing or partial support for pattern substition in variable references with cache enabled (#2968) 2024-02-13 18:57:19 -08:00
Aaron Prindle 081269d8bb
chore(deps): bump github.com/moby/buildkit from 0.11.6 to 0.12.5, github.com/docker/docker from 24.0.7+incompatible to 25.0.2+incompatible, and other deps (#2995) 2024-02-09 18:03:08 -08:00
Asher 398ebfb6da
Prevent extra snapshot with --use-new-run (#2943)
* Prevent extra snapshot when using new run

* Add unit tests for initializing snapshotter

There should be no snapshot for RunV2.  Added a test for SingleSnapshot
as well to prove that the test actually works (rather than `initialized`
just not being read or set properly).
2024-01-16 21:14:03 -08:00
Bob Du 16ed6b2428
replace Azure/azure-storage-blob-go => Azure/azure-sdk-for-go/sdk/storage/azblob (#2945)
Signed-off-by: BobDu <i@bobdu.cc>
2024-01-16 10:45:40 -08:00
Aaron Prindle dd752d9bbc
chore: update gcr and docker cred helpers (#2910) 2023-12-19 12:36:13 -05:00
Maxime BOSSARD df488dac40
Reproducing and Fixing #2892 (#2893)
* Add an integration test to reproduce #2892

* Fix go compilation

* Fix docker run cmd

* Fixing entrypoint

* Test warmer with cache in a volume.

* Add missing comma

* Fix imports

* Fix dir

* Add logs

* fix

* Use test framework to log

* Fix warmer failing if image already in cache.

* Fix format.
2023-12-14 17:00:54 -08:00
Aaron Prindle 9e992703e4
fix: resolve issue with copy_multistage_test.go and broken ioutil import (#2879) 2023-11-29 10:51:39 -08:00