Skip to content

Commit

Permalink
save snaphots to tmp dir (#1662)
Browse files Browse the repository at this point in the history
  • Loading branch information
pbarker authored Jun 14, 2021
1 parent 04fb2fd commit 754253d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pkg/config/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ import (

var RootDir string
var KanikoDir string
var TempDir string
var IgnoreListPath string

func init() {
RootDir = constants.RootDir
KanikoDir = constants.KanikoDir
TempDir = constants.TempDir
IgnoreListPath = constants.IgnoreListPath
}
3 changes: 3 additions & 0 deletions pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ const (
//KanikoDir is the path to the Kaniko directory
KanikoDir = "/kaniko"

// TempDir is the path to the temp directory
TempDir = "/kaniko/tmp"

IgnoreListPath = "/proc/self/mountinfo"

Author = "kaniko"
Expand Down
4 changes: 2 additions & 2 deletions pkg/snapshot/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (s *Snapshotter) Key() (string, error) {
// TakeSnapshot takes a snapshot of the specified files, avoiding directories in the ignorelist, 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, shdCheckDelete bool) (string, error) {
f, err := ioutil.TempFile(config.KanikoDir, "")
f, err := ioutil.TempFile(config.TempDir, "")
if err != nil {
return "", err
}
Expand Down Expand Up @@ -143,7 +143,7 @@ func (s *Snapshotter) TakeSnapshotFS() (string, error) {

func (s *Snapshotter) getSnashotPathPrefix() string {
if snapshotPathPrefix == "" {
return config.KanikoDir
return config.TempDir
}
return snapshotPathPrefix
}
Expand Down

0 comments on commit 754253d

Please sign in to comment.