mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-18 10:08:11 +02:00
Merge branch 'master' into snapshot-directories
This commit is contained in:
@@ -28,14 +28,14 @@ import (
|
||||
"github.com/GoogleContainerTools/kaniko/pkg/timing"
|
||||
"github.com/karrick/godirwalk"
|
||||
|
||||
"github.com/GoogleContainerTools/kaniko/pkg/constants"
|
||||
"github.com/GoogleContainerTools/kaniko/pkg/config"
|
||||
|
||||
"github.com/GoogleContainerTools/kaniko/pkg/util"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// For testing
|
||||
var snapshotPathPrefix = constants.KanikoDir
|
||||
var snapshotPathPrefix = config.KanikoDir
|
||||
|
||||
// Snapshotter holds the root directory from which to take snapshots, and a list of snapshots taken
|
||||
type Snapshotter struct {
|
||||
@@ -63,7 +63,7 @@ func (s *Snapshotter) Key() (string, error) {
|
||||
// TakeSnapshot takes a snapshot of the specified files, avoiding directories in the whitelist, and creates
|
||||
// a tarball of the changed files. Return contents of the tarball, and whether or not any files were changed
|
||||
func (s *Snapshotter) TakeSnapshot(files []string) (string, error) {
|
||||
f, err := ioutil.TempFile(snapshotPathPrefix, "")
|
||||
f, err := ioutil.TempFile(config.KanikoDir, "")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/GoogleContainerTools/kaniko/pkg/config"
|
||||
"github.com/GoogleContainerTools/kaniko/pkg/util"
|
||||
"github.com/GoogleContainerTools/kaniko/testutil"
|
||||
"github.com/pkg/errors"
|
||||
@@ -174,7 +175,6 @@ func TestSnapshotFSChangePermissions(t *testing.T) {
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
t.Logf("Info %s in tar", hdr.Name)
|
||||
foundFiles = append(foundFiles, hdr.Name)
|
||||
if _, isFile := snapshotFiles[hdr.Name]; !isFile {
|
||||
t.Fatalf("File %s unexpectedly in tar", hdr.Name)
|
||||
@@ -478,8 +478,11 @@ func setUpTest() (string, *Snapshotter, func(), error) {
|
||||
return "", nil, nil, errors.Wrap(err, "initializing snapshotter")
|
||||
}
|
||||
|
||||
original := config.KanikoDir
|
||||
config.KanikoDir = testDir
|
||||
cleanup := func() {
|
||||
os.RemoveAll(snapshotPath)
|
||||
config.KanikoDir = original
|
||||
dirCleanUp()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user