Skip to content

Commit

Permalink
Merge pull request #732 from dgageot/fix-728
Browse files Browse the repository at this point in the history
Print the image name that's being built
  • Loading branch information
dgageot authored Jun 22, 2018
2 parents da24835 + 4bfd9d1 commit b4a4838
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 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
10 changes: 5 additions & 5 deletions pkg/skaffold/build/local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package build

import (
"bytes"
"context"
"fmt"
"io"
Expand Down Expand Up @@ -80,7 +79,7 @@ func TestLocalRun(t *testing.T) {
}{
{
description: "single build",
out: &bytes.Buffer{},
out: ioutil.Discard,
config: &v1alpha2.BuildConfig{
Artifacts: []*v1alpha2.Artifact{
{
Expand Down Expand Up @@ -108,7 +107,7 @@ func TestLocalRun(t *testing.T) {
},
{
description: "subset build",
out: &bytes.Buffer{},
out: ioutil.Discard,
config: &v1alpha2.BuildConfig{
Artifacts: []*v1alpha2.Artifact{
{
Expand Down Expand Up @@ -159,7 +158,7 @@ func TestLocalRun(t *testing.T) {
},
{
description: "error image build",
out: &bytes.Buffer{},
out: ioutil.Discard,
config: &v1alpha2.BuildConfig{
Artifacts: []*v1alpha2.Artifact{
{
Expand All @@ -176,7 +175,7 @@ func TestLocalRun(t *testing.T) {
},
{
description: "error image tag",
out: &bytes.Buffer{},
out: ioutil.Discard,
config: &v1alpha2.BuildConfig{
Artifacts: []*v1alpha2.Artifact{
{
Expand Down Expand Up @@ -225,6 +224,7 @@ func TestLocalRun(t *testing.T) {
},
{
description: "error tagger",
out: ioutil.Discard,
config: &v1alpha2.BuildConfig{
Artifacts: []*v1alpha2.Artifact{
{
Expand Down

0 comments on commit b4a4838

Please sign in to comment.