fix: Remove hardcoded whiteout prefix (#2056)

This commit is contained in:
Gabriel Nützi 2022-04-25 20:52:30 +02:00 committed by GitHub
parent 13ed53e25c
commit 9df31b1bcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -34,6 +34,7 @@ import (
"github.com/GoogleContainerTools/kaniko/pkg/config"
"github.com/GoogleContainerTools/kaniko/pkg/timing"
"github.com/docker/docker/builder/dockerignore"
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/fileutils"
v1 "github.com/google/go-containerregistry/pkg/v1"
"github.com/karrick/godirwalk"
@ -176,10 +177,10 @@ func GetFSFromLayers(root string, layers []v1.Layer, opts ...FSOpt) ([]string, e
base := filepath.Base(path)
dir := filepath.Dir(path)
if strings.HasPrefix(base, ".wh.") {
if strings.HasPrefix(base, archive.WhiteoutPrefix) {
logrus.Debugf("Whiting out %s", path)
name := strings.TrimPrefix(base, ".wh.")
name := strings.TrimPrefix(base, archive.WhiteoutPrefix)
path := filepath.Join(dir, name)
if CheckIgnoreList(path) {

View File

@ -160,7 +160,7 @@ func readSecurityXattrToTarHeader(path string, hdr *tar.Header) error {
func (t *Tar) Whiteout(p string) error {
dir := filepath.Dir(p)
name := ".wh." + filepath.Base(p)
name := archive.WhiteoutPrefix + filepath.Base(p)
th := &tar.Header{
// Docker uses no leading / in the tarball