mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-10 00:36:27 +02:00
intoduce delay
This commit is contained in:
@@ -20,6 +20,7 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/GoogleContainerTools/kaniko/pkg/dockerfile"
|
||||
"github.com/GoogleContainerTools/kaniko/pkg/util"
|
||||
@@ -48,6 +49,8 @@ func (r *RunMarkerCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfi
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not place a marker file")
|
||||
}
|
||||
// introduce a delay
|
||||
time.Sleep(time.Second)
|
||||
if err := runCommandInExec(config, buildArgs, r.cmd); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -372,7 +372,7 @@ func (s *stageBuilder) build() error {
|
||||
files = command.FilesToSnapshot()
|
||||
timing.DefaultRun.Stop(t)
|
||||
|
||||
if !s.shouldTakeSnapshot(index, files, command.MetadataOnly()) {
|
||||
if !s.shouldTakeSnapshot(index, command.MetadataOnly()) {
|
||||
continue
|
||||
}
|
||||
if isCacheCommand {
|
||||
@@ -432,7 +432,7 @@ func (s *stageBuilder) takeSnapshot(files []string, shdDelete bool) (string, err
|
||||
return snapshot, err
|
||||
}
|
||||
|
||||
func (s *stageBuilder) shouldTakeSnapshot(index int, files []string, isMetadatCmd bool) bool {
|
||||
func (s *stageBuilder) shouldTakeSnapshot(index int, isMetadatCmd bool) bool {
|
||||
isLastCommand := index == len(s.cmds)-1
|
||||
|
||||
// We only snapshot the very end with single snapshot mode on.
|
||||
|
||||
@@ -104,7 +104,6 @@ func Test_stageBuilder_shouldTakeSnapshot(t *testing.T) {
|
||||
}
|
||||
type args struct {
|
||||
index int
|
||||
files []string
|
||||
metadataOnly bool
|
||||
}
|
||||
tests := []struct {
|
||||
@@ -159,7 +158,6 @@ func Test_stageBuilder_shouldTakeSnapshot(t *testing.T) {
|
||||
},
|
||||
args: args{
|
||||
index: 0,
|
||||
files: []string{},
|
||||
metadataOnly: true,
|
||||
},
|
||||
want: false,
|
||||
@@ -173,7 +171,6 @@ func Test_stageBuilder_shouldTakeSnapshot(t *testing.T) {
|
||||
},
|
||||
args: args{
|
||||
index: 0,
|
||||
files: nil,
|
||||
metadataOnly: false,
|
||||
},
|
||||
want: true,
|
||||
@@ -204,7 +201,7 @@ func Test_stageBuilder_shouldTakeSnapshot(t *testing.T) {
|
||||
opts: tt.fields.opts,
|
||||
cmds: tt.fields.cmds,
|
||||
}
|
||||
if got := s.shouldTakeSnapshot(tt.args.index, tt.args.files, tt.args.metadataOnly); got != tt.want {
|
||||
if got := s.shouldTakeSnapshot(tt.args.index, tt.args.metadataOnly); got != tt.want {
|
||||
t.Errorf("stageBuilder.shouldTakeSnapshot() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user