ADD is cacheable now

This commit is contained in:
Martin Zihlmann 2025-05-30 18:01:21 +01:00
parent 742e75b1ea
commit 0f483da361
No known key found for this signature in database
GPG Key ID: 0F7784F41354DE99
2 changed files with 3 additions and 9 deletions

View File

@ -93,6 +93,7 @@ var additionalKanikoFlagsMap = map[string][]string{
"Dockerfile_test_cache_install_oci": {"--cache-copy-layers=true"}, "Dockerfile_test_cache_install_oci": {"--cache-copy-layers=true"},
"Dockerfile_test_cache_copy": {"--cache-copy-layers=true"}, "Dockerfile_test_cache_copy": {"--cache-copy-layers=true"},
"Dockerfile_test_cache_copy_oci": {"--cache-copy-layers=true"}, "Dockerfile_test_cache_copy_oci": {"--cache-copy-layers=true"},
"Dockerfile_test_issue_add": {"--cache-copy-layers=true"},
} }
// output check to do when building with kaniko // output check to do when building with kaniko
@ -226,9 +227,8 @@ func NewDockerFileBuilder() *DockerFileBuilder {
"Dockerfile_test_cache_copy": {}, "Dockerfile_test_cache_copy": {},
"Dockerfile_test_issue_3429": {}, "Dockerfile_test_issue_3429": {},
"Dockerfile_test_issue_workdir": {}, "Dockerfile_test_issue_workdir": {},
// TODO: ADD command is uncacheable "Dockerfile_test_issue_add": {},
//"Dockerfile_test_issue_add": {}, "Dockerfile_test_issue_empty": {},
"Dockerfile_test_issue_empty": {},
} }
d.TestOCICacheDockerfiles = map[string]struct{}{ d.TestOCICacheDockerfiles = map[string]struct{}{
"Dockerfile_test_cache_oci": {}, "Dockerfile_test_cache_oci": {},

View File

@ -440,12 +440,6 @@ func (s *stageBuilder) build() error {
logrus.Debugf("Build: cache key for command %v %v", command.String(), ck) logrus.Debugf("Build: cache key for command %v %v", command.String(), ck)
// Raise Warnings for commands that are uncacheable
switch command.(type) {
case *commands.AddCommand:
logrus.Warn("cache-violation: ADD can't be cached - consider using COPY instead.")
}
// Push layer to cache (in parallel) now along with new config file // Push layer to cache (in parallel) now along with new config file
if command.ShouldCacheOutput() && !s.opts.NoPushCache { if command.ShouldCacheOutput() && !s.opts.NoPushCache {
cacheGroup.Go(func() error { cacheGroup.Go(func() error {