Skip to content

Commit

Permalink
chore(logs): update log messages for better clarity (#9443)
Browse files Browse the repository at this point in the history
  • Loading branch information
idsulik authored Jun 19, 2024
1 parent 64585c1 commit 54102ff
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
6 changes: 6 additions & 0 deletions pkg/skaffold/build/cluster/kaniko.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ const (
)

func (b *Builder) buildWithKaniko(ctx context.Context, out io.Writer, workspace string, artifactName string, artifact *latest.KanikoArtifact, tag string, requiredImages map[string]*string, platforms platform.Matcher) (string, error) {
log.Entry(ctx).Info("Start building with kaniko for artifact")
start := time.Now()
defer func() {
log.Entry(ctx).Infof("Building with kaniko completed in %s", time.Since(start))
}()

// TODO: Implement building multi-platform images for cluster builder
if platforms.IsMultiPlatform() {
log.Entry(ctx).Warnf("multiple target platforms %q found for artifact %q. Skaffold doesn't yet support multi-platform builds for the docker builder. Consider specifying a single target platform explicitly. See https://skaffold.dev/docs/pipeline-stages/builders/#cross-platform-build-support", platforms.String(), artifactName)
Expand Down
4 changes: 2 additions & 2 deletions pkg/skaffold/deploy/cloudrun/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ func (d *Deployer) deployService(crclient *run.APIService, manifest []byte, out
func (d *Deployer) deployJob(crclient *run.APIService, manifest []byte, out io.Writer) (*RunResourceName, error) {
job := &run.Job{}
if err := k8syaml.Unmarshal(manifest, job); err != nil {
return nil, sErrors.NewError(fmt.Errorf("unable to unmarshal Cloud Run Service config"), &proto.ActionableErr{
return nil, sErrors.NewError(fmt.Errorf("unable to unmarshal Cloud Run Job config"), &proto.ActionableErr{
Message: err.Error(),
ErrCode: proto.StatusCode_DEPLOY_READ_MANIFEST_ERR,
})
Expand Down Expand Up @@ -440,7 +440,7 @@ func (d *Deployer) deleteRunService(crclient *run.APIService, out io.Writer, dry
func (d *Deployer) deleteRunJob(crclient *run.APIService, out io.Writer, dryRun bool, manifest []byte) error {
job := &run.Job{}
if err := k8syaml.Unmarshal(manifest, job); err != nil {
return sErrors.NewError(fmt.Errorf("unable to unmarshal Cloud Run Service config"), &proto.ActionableErr{
return sErrors.NewError(fmt.Errorf("unable to unmarshal Cloud Run Job config"), &proto.ActionableErr{
Message: err.Error(),
ErrCode: proto.StatusCode_DEPLOY_READ_MANIFEST_ERR,
})
Expand Down
7 changes: 6 additions & 1 deletion pkg/skaffold/util/tar.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/constants"
"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/output/log"
timeutil "github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/util/time"
)

type headerModifier func(*tar.Header)
Expand Down Expand Up @@ -72,6 +73,11 @@ func CreateTar(ctx context.Context, w io.Writer, root string, paths []string) er
}

log.Entry(ctx).Infof("Creating tar file from %d file(s)", len(paths))
start := time.Now()
defer func() {
log.Entry(ctx).Infof("Creating tar file completed in %s", timeutil.Humanize(time.Since(start)))
}()

for i, path := range paths {
if err := addFileToTar(ctx, root, path, "", tw, nil); err != nil {
return err
Expand All @@ -81,7 +87,6 @@ func CreateTar(ctx context.Context, w io.Writer, root string, paths []string) er
log.Entry(ctx).Infof("Added %d/%d files to tar file", i+1, len(paths))
}
}
log.Entry(ctx).Info("Successfully created tar file")

return nil
}
Expand Down

0 comments on commit 54102ff

Please sign in to comment.