Add a lot more timing data. (#518)

This commit is contained in:
dlorenc
2019-01-10 13:27:55 -07:00
committed by GitHub
parent 9ab66560db
commit 170e0a2d94
6 changed files with 31 additions and 16 deletions
-14
View File
@@ -382,20 +382,6 @@ func DoBuild(opts *config.KanikoOptions) (v1.Image, error) {
}
}
timing.DefaultRun.Stop(t)
benchmarkFile := os.Getenv("BENCHMARK_FILE")
// false is a keyword for integration tests to turn off benchmarking
if benchmarkFile != "" && benchmarkFile != "false" {
f, err := os.Create(benchmarkFile)
if err != nil {
logrus.Warnf("Unable to create benchmarking file %s: %s", benchmarkFile, err)
}
defer f.Close()
s, err := timing.JSON()
if err != nil {
logrus.Warnf("Unable to write benchmark file: %s", err)
}
f.WriteString(s)
}
return sourceImage, nil
}
if stage.SaveStage {
+3
View File
@@ -25,6 +25,7 @@ import (
"github.com/GoogleContainerTools/kaniko/pkg/cache"
"github.com/GoogleContainerTools/kaniko/pkg/config"
"github.com/GoogleContainerTools/kaniko/pkg/constants"
"github.com/GoogleContainerTools/kaniko/pkg/timing"
"github.com/GoogleContainerTools/kaniko/pkg/version"
"github.com/google/go-containerregistry/pkg/authn"
"github.com/google/go-containerregistry/pkg/authn/k8schain"
@@ -53,6 +54,7 @@ func DoPush(image v1.Image, opts *config.KanikoOptions) error {
logrus.Info("Skipping push to container registry due to --no-push flag")
return nil
}
t := timing.Start("Total Push Time")
destRefs := []name.Tag{}
for _, destination := range opts.Destinations {
destRef, err := name.NewTag(destination, name.WeakValidation)
@@ -103,6 +105,7 @@ func DoPush(image v1.Image, opts *config.KanikoOptions) error {
return errors.Wrap(err, fmt.Sprintf("failed to push to destination %s", destRef))
}
}
timing.DefaultRun.Stop(t)
return nil
}