Skip to content

Commit

Permalink
Print the image name that's being built
Browse files Browse the repository at this point in the history
Also prints the name in case of an error

Fixes #728
  • Loading branch information
dgageot committed Jun 22, 2018
1 parent 3d07bf2 commit 83e86f6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions pkg/skaffold/build/container_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,17 @@ func (cb *GoogleCloudBuilder) Build(ctx context.Context, out io.Writer, tagger t
for _, artifact := range artifacts {
build, err := cb.buildArtifact(ctx, out, tagger, cbclient, c, artifact)
if err != nil {
return nil, errors.Wrapf(err, "building artifact %s", artifact.ImageName)
return nil, errors.Wrapf(err, "building [%s]", artifact.ImageName)
}

builds = append(builds, *build)
}

return builds, nil
}

func (cb *GoogleCloudBuilder) buildArtifact(ctx context.Context, out io.Writer, tagger tag.Tagger, cbclient *cloudbuild.Service, c *cstorage.Client, artifact *v1alpha2.Artifact) (*Artifact, error) {
logrus.Infof("Building artifact: %+v", artifact)
fmt.Fprintf(out, "Building [%s]...\n", artifact.ImageName)

// need to format build args as strings to pass to container builder docker
var buildArgs []string
Expand Down
5 changes: 4 additions & 1 deletion pkg/skaffold/build/kaniko.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package build

import (
"context"
"fmt"
"io"
"io/ioutil"

Expand Down Expand Up @@ -64,9 +65,11 @@ func (k *KanikoBuilder) Build(ctx context.Context, out io.Writer, tagger tag.Tag
var builds []Artifact

for _, artifact := range artifacts {
fmt.Fprintf(out, "Building [%s]...\n", artifact.ImageName)

initialTag, err := kaniko.RunKanikoBuild(ctx, out, artifact, k.KanikoBuild)
if err != nil {
return nil, errors.Wrapf(err, "running kaniko build for %s", artifact.ImageName)
return nil, errors.Wrapf(err, "kaniko build for [%s]", artifact.ImageName)
}

digest, err := docker.RemoteDigest(initialTag)
Expand Down
4 changes: 3 additions & 1 deletion pkg/skaffold/build/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ func (l *LocalBuilder) Build(ctx context.Context, out io.Writer, tagger tag.Tagg
var builds []Artifact

for _, artifact := range artifacts {
fmt.Fprintf(out, "Building [%s]...\n", artifact.ImageName)

initialTag, err := l.runBuildForArtifact(ctx, out, artifact)
if err != nil {
return nil, errors.Wrap(err, "running build for artifact")
return nil, errors.Wrapf(err, "building [%s]", artifact.ImageName)
}

digest, err := docker.Digest(ctx, l.api, initialTag)
Expand Down

0 comments on commit 83e86f6

Please sign in to comment.