fix: Remove hardcoded whiteout prefix (#2056)
This commit is contained in:
parent
13ed53e25c
commit
9df31b1bcb
|
|
@ -34,6 +34,7 @@ import (
|
||||||
"github.com/GoogleContainerTools/kaniko/pkg/config"
|
"github.com/GoogleContainerTools/kaniko/pkg/config"
|
||||||
"github.com/GoogleContainerTools/kaniko/pkg/timing"
|
"github.com/GoogleContainerTools/kaniko/pkg/timing"
|
||||||
"github.com/docker/docker/builder/dockerignore"
|
"github.com/docker/docker/builder/dockerignore"
|
||||||
|
"github.com/docker/docker/pkg/archive"
|
||||||
"github.com/docker/docker/pkg/fileutils"
|
"github.com/docker/docker/pkg/fileutils"
|
||||||
v1 "github.com/google/go-containerregistry/pkg/v1"
|
v1 "github.com/google/go-containerregistry/pkg/v1"
|
||||||
"github.com/karrick/godirwalk"
|
"github.com/karrick/godirwalk"
|
||||||
|
|
@ -176,10 +177,10 @@ func GetFSFromLayers(root string, layers []v1.Layer, opts ...FSOpt) ([]string, e
|
||||||
base := filepath.Base(path)
|
base := filepath.Base(path)
|
||||||
dir := filepath.Dir(path)
|
dir := filepath.Dir(path)
|
||||||
|
|
||||||
if strings.HasPrefix(base, ".wh.") {
|
if strings.HasPrefix(base, archive.WhiteoutPrefix) {
|
||||||
logrus.Debugf("Whiting out %s", path)
|
logrus.Debugf("Whiting out %s", path)
|
||||||
|
|
||||||
name := strings.TrimPrefix(base, ".wh.")
|
name := strings.TrimPrefix(base, archive.WhiteoutPrefix)
|
||||||
path := filepath.Join(dir, name)
|
path := filepath.Join(dir, name)
|
||||||
|
|
||||||
if CheckIgnoreList(path) {
|
if CheckIgnoreList(path) {
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ func readSecurityXattrToTarHeader(path string, hdr *tar.Header) error {
|
||||||
|
|
||||||
func (t *Tar) Whiteout(p string) error {
|
func (t *Tar) Whiteout(p string) error {
|
||||||
dir := filepath.Dir(p)
|
dir := filepath.Dir(p)
|
||||||
name := ".wh." + filepath.Base(p)
|
name := archive.WhiteoutPrefix + filepath.Base(p)
|
||||||
|
|
||||||
th := &tar.Header{
|
th := &tar.Header{
|
||||||
// Docker uses no leading / in the tarball
|
// Docker uses no leading / in the tarball
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue