Skip to content

Commit

Permalink
Handle volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
eyusupov committed Sep 20, 2019
1 parent e8f1819 commit 760acb8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/commands/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (v *VolumeCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.
existingVolumes[volume] = x
util.AddVolumePathToWhitelist(volume)

// Only create and snapshot the dir if it didn't exist already
// Only create the dir if it didn't exist already
if _, err := os.Stat(volume); os.IsNotExist(err) {
logrus.Infof("Creating directory %s", volume)
if err := os.MkdirAll(volume, 0755); err != nil {
Expand Down
4 changes: 3 additions & 1 deletion pkg/executor/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ func (s *stageBuilder) build() error {
}

cacheGroup := errgroup.Group{}
snapshotInitialized := false
for index, command := range s.cmds {
if command == nil {
continue
Expand All @@ -261,12 +262,13 @@ func (s *stageBuilder) build() error {

cacheImg := command.CacheImage()
if cacheImg == nil {
if command.RequiresUnpackedFS() && !command.MetadataOnly() {
if !snapshotInitialized && command.RequiresUnpackedFS() && !command.MetadataOnly() {
// Prepare initial state for the FS diff
t := timing.Start("Pre-command execution FS snapshot")
logrus.Debug("Scanning pre-snapshot filesystem state")
s.snapshotter.Init()
timing.DefaultRun.Stop(t)
snapshotInitialized = true
}
} else {
if shouldUnpack {
Expand Down

0 comments on commit 760acb8

Please sign in to comment.