Skip to content

Remove Tagger from Builder interface #1601

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/skaffold/build/build.go
Original file line number Diff line number Diff line change
@@ -37,5 +37,5 @@ type Artifact struct {
type Builder interface {
Labels() map[string]string

Build(ctx context.Context, out io.Writer, tagger tag.Tagger, artifacts []*latest.Artifact) ([]Artifact, error)
Build(ctx context.Context, out io.Writer, tags tag.ImageTags, artifacts []*latest.Artifact) ([]Artifact, error)
}
11 changes: 3 additions & 8 deletions pkg/skaffold/build/gcb/cloud_build.go
Original file line number Diff line number Diff line change
@@ -43,16 +43,11 @@ import (
)

// Build builds a list of artifacts with Google Cloud Build.
func (b *Builder) Build(ctx context.Context, out io.Writer, tagger tag.Tagger, artifacts []*latest.Artifact) ([]build.Artifact, error) {
return build.InParallel(ctx, out, tagger, artifacts, b.buildArtifactWithCloudBuild)
func (b *Builder) Build(ctx context.Context, out io.Writer, tags tag.ImageTags, artifacts []*latest.Artifact) ([]build.Artifact, error) {
return build.InParallel(ctx, out, tags, artifacts, b.buildArtifactWithCloudBuild)
}

func (b *Builder) buildArtifactWithCloudBuild(ctx context.Context, out io.Writer, tagger tag.Tagger, artifact *latest.Artifact) (string, error) {
tag, err := tagger.GenerateFullyQualifiedImageName(artifact.Workspace, artifact.ImageName)
if err != nil {
return "", errors.Wrap(err, "generating tag")
}

func (b *Builder) buildArtifactWithCloudBuild(ctx context.Context, out io.Writer, artifact *latest.Artifact, tag string) (string, error) {
client, err := google.DefaultClient(ctx, cloudbuild.CloudPlatformScope)
if err != nil {
return "", errors.Wrap(err, "getting google client")
11 changes: 3 additions & 8 deletions pkg/skaffold/build/kaniko/kaniko.go
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ import (
)

// Build builds a list of artifacts with Kaniko.
func (b *Builder) Build(ctx context.Context, out io.Writer, tagger tag.Tagger, artifacts []*latest.Artifact) ([]build.Artifact, error) {
func (b *Builder) Build(ctx context.Context, out io.Writer, tags tag.ImageTags, artifacts []*latest.Artifact) ([]build.Artifact, error) {
teardownPullSecret, err := b.setupPullSecret(out)
if err != nil {
return nil, errors.Wrap(err, "setting up pull secret")
@@ -42,15 +42,10 @@ func (b *Builder) Build(ctx context.Context, out io.Writer, tagger tag.Tagger, a
defer teardownDockerConfigSecret()
}

return build.InParallel(ctx, out, tagger, artifacts, b.buildArtifactWithKaniko)
return build.InParallel(ctx, out, tags, artifacts, b.buildArtifactWithKaniko)
}

func (b *Builder) buildArtifactWithKaniko(ctx context.Context, out io.Writer, tagger tag.Tagger, artifact *latest.Artifact) (string, error) {
tag, err := tagger.GenerateFullyQualifiedImageName(artifact.Workspace, artifact.ImageName)
if err != nil {
return "", errors.Wrap(err, "generating tag")
}

func (b *Builder) buildArtifactWithKaniko(ctx context.Context, out io.Writer, artifact *latest.Artifact, tag string) (string, error) {
digest, err := b.run(ctx, out, artifact, tag)
if err != nil {
return "", errors.Wrapf(err, "kaniko build for [%s]", artifact.ImageName)
11 changes: 3 additions & 8 deletions pkg/skaffold/build/local/local.go
Original file line number Diff line number Diff line change
@@ -31,22 +31,17 @@ import (

// Build runs a docker build on the host and tags the resulting image with
// its checksum. It streams build progress to the writer argument.
func (b *Builder) Build(ctx context.Context, out io.Writer, tagger tag.Tagger, artifacts []*latest.Artifact) ([]build.Artifact, error) {
func (b *Builder) Build(ctx context.Context, out io.Writer, tags tag.ImageTags, artifacts []*latest.Artifact) ([]build.Artifact, error) {
if b.localCluster {
color.Default.Fprintf(out, "Found [%s] context, using local docker daemon.\n", b.kubeContext)
}
defer b.localDocker.Close()

// TODO(dgageot): parallel builds
return build.InSequence(ctx, out, tagger, artifacts, b.buildArtifact)
return build.InSequence(ctx, out, tags, artifacts, b.buildArtifact)
}

func (b *Builder) buildArtifact(ctx context.Context, out io.Writer, tagger tag.Tagger, artifact *latest.Artifact) (string, error) {
tag, err := tagger.GenerateFullyQualifiedImageName(artifact.Workspace, artifact.ImageName)
if err != nil {
return "", errors.Wrap(err, "generating tag")
}

func (b *Builder) buildArtifact(ctx context.Context, out io.Writer, artifact *latest.Artifact, tag string) (string, error) {
digestOrImageID, err := b.runBuildForArtifact(ctx, out, artifact, tag)
if err != nil {
return "", errors.Wrap(err, "build artifact")
40 changes: 8 additions & 32 deletions pkg/skaffold/build/local/local_test.go
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@ package local

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

@@ -31,19 +30,6 @@ import (
"github.com/docker/docker/api/types"
)

type FakeTagger struct {
Out string
Err error
}

func (f *FakeTagger) GenerateFullyQualifiedImageName(string, string) (string, error) {
return f.Out, f.Err
}

func (f *FakeTagger) Labels() map[string]string {
return map[string]string{}
}

type testAuthHelper struct{}

func (t testAuthHelper) GetAuthConfig(string) (types.AuthConfig, error) {
@@ -58,7 +44,7 @@ func TestLocalRun(t *testing.T) {
var tests = []struct {
description string
api testutil.FakeAPIClient
tagger tag.Tagger
tags tag.ImageTags
artifacts []*latest.Artifact
expected []build.Artifact
expectedWarnings []string
@@ -73,7 +59,7 @@ func TestLocalRun(t *testing.T) {
DockerArtifact: &latest.DockerArtifact{},
}},
},
tagger: &FakeTagger{Out: "gcr.io/test/image:tag"},
tags: tag.ImageTags(map[string]string{"gcr.io/test/image": "gcr.io/test/image:tag"}),
api: testutil.FakeAPIClient{},
pushImages: false,
expected: []build.Artifact{{
@@ -89,7 +75,7 @@ func TestLocalRun(t *testing.T) {
DockerArtifact: &latest.DockerArtifact{},
}},
},
tagger: &FakeTagger{Out: "gcr.io/test/image:tag"},
tags: tag.ImageTags(map[string]string{"gcr.io/test/image": "gcr.io/test/image:tag"}),
api: testutil.FakeAPIClient{},
pushImages: true,
expected: []build.Artifact{{
@@ -99,7 +85,6 @@ func TestLocalRun(t *testing.T) {
},
{
description: "error image build",
tagger: &FakeTagger{Out: "gcr.io/test/image:tag"},
artifacts: []*latest.Artifact{{}},
api: testutil.FakeAPIClient{
ErrImageBuild: true,
@@ -108,25 +93,17 @@ func TestLocalRun(t *testing.T) {
},
{
description: "unkown artifact type",
tagger: &FakeTagger{Out: "gcr.io/test/image:tag"},
artifacts: []*latest.Artifact{{}},
shouldErr: true,
},
{
description: "error image inspect",
tagger: &FakeTagger{Out: "gcr.io/test/image:tag"},
artifacts: []*latest.Artifact{{}},
api: testutil.FakeAPIClient{
ErrImageInspect: true,
},
shouldErr: true,
},
{
description: "error tagger",
artifacts: []*latest.Artifact{{}},
tagger: &FakeTagger{Err: fmt.Errorf("")},
shouldErr: true,
},
{
description: "cache-from images already pulled",
artifacts: []*latest.Artifact{{
@@ -143,7 +120,7 @@ func TestLocalRun(t *testing.T) {
"pull2": "imageID2",
},
},
tagger: &FakeTagger{Out: "gcr.io/test/image:tag"},
tags: tag.ImageTags(map[string]string{"gcr.io/test/image": "gcr.io/test/image:tag"}),
expected: []build.Artifact{{
ImageName: "gcr.io/test/image",
Tag: "gcr.io/test/image:1",
@@ -159,8 +136,8 @@ func TestLocalRun(t *testing.T) {
},
}},
},
api: testutil.FakeAPIClient{},
tagger: &FakeTagger{Out: "gcr.io/test/image:tag"},
api: testutil.FakeAPIClient{},
tags: tag.ImageTags(map[string]string{"gcr.io/test/image": "gcr.io/test/image:tag"}),
expected: []build.Artifact{{
ImageName: "gcr.io/test/image",
Tag: "gcr.io/test/image:1",
@@ -179,7 +156,7 @@ func TestLocalRun(t *testing.T) {
api: testutil.FakeAPIClient{
ErrImagePull: true,
},
tagger: &FakeTagger{Out: "gcr.io/test/image:tag"},
tags: tag.ImageTags(map[string]string{"gcr.io/test/image": "gcr.io/test/image:tag"}),
expected: []build.Artifact{{
ImageName: "gcr.io/test/image",
Tag: "gcr.io/test/image:1",
@@ -199,7 +176,6 @@ func TestLocalRun(t *testing.T) {
api: testutil.FakeAPIClient{
ErrImageInspect: true,
},
tagger: &FakeTagger{Out: "gcr.io/test/image:tag"},
shouldErr: true,
},
}
@@ -216,7 +192,7 @@ func TestLocalRun(t *testing.T) {
pushImages: test.pushImages,
}

res, err := l.Build(context.Background(), ioutil.Discard, test.tagger, test.artifacts)
res, err := l.Build(context.Background(), ioutil.Discard, test.tags, test.artifacts)

testutil.CheckErrorAndDeepEqual(t, test.shouldErr, err, test.expected, res)
testutil.CheckDeepEqual(t, test.expectedWarnings, fakeWarner.Warnings)
19 changes: 13 additions & 6 deletions pkg/skaffold/build/parallel.go
Original file line number Diff line number Diff line change
@@ -30,19 +30,19 @@ import (

const bufferedLinesPerArtifact = 10000

type artifactBuilder func(ctx context.Context, out io.Writer, tagger tag.Tagger, artifact *latest.Artifact) (string, error)
type artifactBuilder func(ctx context.Context, out io.Writer, artifact *latest.Artifact, tag string) (string, error)

// InParallel builds a list of artifacts in parallel but prints the logs in sequential order.
func InParallel(ctx context.Context, out io.Writer, tagger tag.Tagger, artifacts []*latest.Artifact, buildArtifact artifactBuilder) ([]Artifact, error) {
func InParallel(ctx context.Context, out io.Writer, tags tag.ImageTags, artifacts []*latest.Artifact, buildArtifact artifactBuilder) ([]Artifact, error) {
if len(artifacts) == 1 {
return InSequence(ctx, out, tagger, artifacts, buildArtifact)
return InSequence(ctx, out, tags, artifacts, buildArtifact)
}

ctx, cancel := context.WithCancel(ctx)
defer cancel()

n := len(artifacts)
tags := make([]string, n)
finalTags := make([]string, n)
errs := make([]error, n)
outputs := make([]chan []byte, n)

@@ -65,7 +65,14 @@ func InParallel(ctx context.Context, out io.Writer, tagger tag.Tagger, artifacts
}

color.Default.Fprintf(cw, "Building [%s]...\n", artifacts[i].ImageName)
tags[i], errs[i] = buildArtifact(ctx, cw, tagger, artifacts[i])

tag, present := tags[artifacts[i].ImageName]
if !present {
errs[i] = fmt.Errorf("unable to find tag for image %s", artifacts[i].ImageName)
} else {
finalTags[i], errs[i] = buildArtifact(ctx, cw, artifacts[i], tag)
}

cw.Close()
}()

@@ -93,7 +100,7 @@ func InParallel(ctx context.Context, out io.Writer, tagger tag.Tagger, artifacts

built = append(built, Artifact{
ImageName: artifact.ImageName,
Tag: tags[i],
Tag: finalTags[i],
})
}

87 changes: 87 additions & 0 deletions pkg/skaffold/build/parallel_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
Copyright 2019 The Skaffold Authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package build

import (
"bytes"
"context"
"fmt"
"io"
"testing"

"github.com/GoogleContainerTools/skaffold/pkg/skaffold/build/tag"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest"
"github.com/GoogleContainerTools/skaffold/testutil"
)

func TestInParallel(t *testing.T) {
var tests = []struct {
description string
buildArtifact artifactBuilder
tags tag.ImageTags
expectedArtifacts []Artifact
expectedOut string
shouldErr bool
}{
{
description: "build succeeds",
buildArtifact: func(ctx context.Context, out io.Writer, artifact *latest.Artifact, tag string) (string, error) {
return fmt.Sprintf("%s@sha256:abac", tag), nil
},
tags: tag.ImageTags{
"skaffold/image1": "skaffold/image1:v0.0.1",
"skaffold/image2": "skaffold/image2:v0.0.2",
},
expectedArtifacts: []Artifact{
{ImageName: "skaffold/image1", Tag: "skaffold/image1:v0.0.1@sha256:abac"},
{ImageName: "skaffold/image2", Tag: "skaffold/image2:v0.0.2@sha256:abac"},
},
expectedOut: "Building [skaffold/image1]...\nBuilding [skaffold/image2]...\n",
},
{
description: "build fails",
buildArtifact: func(ctx context.Context, out io.Writer, artifact *latest.Artifact, tag string) (string, error) {
return "", fmt.Errorf("build fails")
},
tags: tag.ImageTags{
"skaffold/image1": "",
},
expectedOut: "Building [skaffold/image1]...\n",
shouldErr: true,
},
{
description: "tag not found",
tags: tag.ImageTags{},
expectedOut: "Building [skaffold/image1]...\n",
shouldErr: true,
},
}
for _, test := range tests {
t.Run(test.description, func(t *testing.T) {
out := new(bytes.Buffer)
artifacts := []*latest.Artifact{
{ImageName: "skaffold/image1"},
{ImageName: "skaffold/image2"},
}

got, err := InParallel(context.Background(), out, test.tags, artifacts, test.buildArtifact)

testutil.CheckErrorAndDeepEqual(t, test.shouldErr, err, test.expectedArtifacts, got)
testutil.CheckDeepEqual(t, test.expectedOut, out.String())
})
}
}
2 changes: 1 addition & 1 deletion pkg/skaffold/build/prebuilt.go
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ func (b *prebuiltImagesBuilder) Labels() map[string]string {
}
}

func (b *prebuiltImagesBuilder) Build(ctx context.Context, out io.Writer, tagger tag.Tagger, artifacts []*latest.Artifact) ([]Artifact, error) {
func (b *prebuiltImagesBuilder) Build(ctx context.Context, out io.Writer, _ tag.ImageTags, artifacts []*latest.Artifact) ([]Artifact, error) {
tags := make(map[string]string)

for _, tag := range b.images {
12 changes: 9 additions & 3 deletions pkg/skaffold/build/sequence.go
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ package build

import (
"context"
"fmt"
"io"

"github.com/GoogleContainerTools/skaffold/pkg/skaffold/build/tag"
@@ -27,20 +28,25 @@ import (
)

// InSequence builds a list of artifacts in sequence.
func InSequence(ctx context.Context, out io.Writer, tagger tag.Tagger, artifacts []*latest.Artifact, buildArtifact artifactBuilder) ([]Artifact, error) {
func InSequence(ctx context.Context, out io.Writer, tags tag.ImageTags, artifacts []*latest.Artifact, buildArtifact artifactBuilder) ([]Artifact, error) {
var builds []Artifact

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

tag, err := buildArtifact(ctx, out, tagger, artifact)
tag, present := tags[artifact.ImageName]
if !present {
return nil, fmt.Errorf("unable to find tag for image %s", artifact.ImageName)
}

finalTag, err := buildArtifact(ctx, out, artifact, tag)
if err != nil {
return nil, errors.Wrapf(err, "building [%s]", artifact.ImageName)
}

builds = append(builds, Artifact{
ImageName: artifact.ImageName,
Tag: tag,
Tag: finalTag,
})
}

56 changes: 27 additions & 29 deletions pkg/skaffold/build/sequence_test.go
Original file line number Diff line number Diff line change
@@ -28,47 +28,46 @@ import (
"github.com/GoogleContainerTools/skaffold/testutil"
)

type MockTagger struct {
Out string
Err error
}

func (f *MockTagger) GenerateFullyQualifiedImageName(workingDir string, imageName string) (string, error) {
return f.Out, f.Err
}

func (f *MockTagger) Labels() map[string]string {
return map[string]string{}
}

func TestInSequence(t *testing.T) {
var tests = []struct {
description string
buildArtifact artifactBuilder
tags tag.ImageTags
expectedArtifacts []Artifact
expectedOut string
shouldErr bool
}{
{
description: "build fails",
buildArtifact: func(ctx context.Context, out io.Writer, tagger tag.Tagger, artifact *latest.Artifact) (string, error) {
return "", fmt.Errorf("build fails")
},
expectedArtifacts: nil,
expectedOut: "Building [skaffold/image1]...\n",
shouldErr: true,
},
{
description: "build succeeds",
buildArtifact: func(ctx context.Context, out io.Writer, tagger tag.Tagger, artifact *latest.Artifact) (string, error) {
return "v0.0.1", nil
buildArtifact: func(ctx context.Context, out io.Writer, artifact *latest.Artifact, tag string) (string, error) {
return fmt.Sprintf("%s@sha256:abac", tag), nil
},
tags: tag.ImageTags{
"skaffold/image1": "skaffold/image1:v0.0.1",
"skaffold/image2": "skaffold/image2:v0.0.2",
},
expectedArtifacts: []Artifact{
{ImageName: "skaffold/image1", Tag: "v0.0.1"},
{ImageName: "skaffold/image2", Tag: "v0.0.1"},
{ImageName: "skaffold/image1", Tag: "skaffold/image1:v0.0.1@sha256:abac"},
{ImageName: "skaffold/image2", Tag: "skaffold/image2:v0.0.2@sha256:abac"},
},
expectedOut: "Building [skaffold/image1]...\nBuilding [skaffold/image2]...\n",
shouldErr: false,
},
{
description: "build fails",
buildArtifact: func(ctx context.Context, out io.Writer, artifact *latest.Artifact, tag string) (string, error) {
return "", fmt.Errorf("build fails")
},
tags: tag.ImageTags{
"skaffold/image1": "",
},
expectedOut: "Building [skaffold/image1]...\n",
shouldErr: true,
},
{
description: "tag not found",
tags: tag.ImageTags{},
expectedOut: "Building [skaffold/image1]...\n",
shouldErr: true,
},
}
for _, test := range tests {
@@ -78,9 +77,8 @@ func TestInSequence(t *testing.T) {
{ImageName: "skaffold/image1"},
{ImageName: "skaffold/image2"},
}
tagger := &MockTagger{Out: ""}

got, err := InSequence(context.Background(), out, tagger, artifacts, test.buildArtifact)
got, err := InSequence(context.Background(), out, test.tags, artifacts, test.buildArtifact)

testutil.CheckErrorAndDeepEqual(t, test.shouldErr, err, test.expectedArtifacts, got)
testutil.CheckDeepEqual(t, test.expectedOut, out.String())
3 changes: 3 additions & 0 deletions pkg/skaffold/build/tag/tag.go
Original file line number Diff line number Diff line change
@@ -16,6 +16,9 @@ limitations under the License.

package tag

// ImageTags maps image names to tags
type ImageTags map[string]string

// Tagger is an interface for tag strategies to be implemented against
type Tagger interface {
Labels() map[string]string
28 changes: 27 additions & 1 deletion pkg/skaffold/runner/runner.go
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@ import (
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/build/kaniko"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/build/local"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/build/tag"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/color"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/config"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/deploy"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/kubernetes"
@@ -254,9 +255,34 @@ func (r *SkaffoldRunner) Run(ctx context.Context, out io.Writer, artifacts []*la
return nil
}

// imageTags generates tags for a list of artifacts
func (r *SkaffoldRunner) imageTags(out io.Writer, artifacts []*latest.Artifact) (tag.ImageTags, error) {
tags := make(tag.ImageTags, len(artifacts))

for _, artifact := range artifacts {
imageName := artifact.ImageName
color.Default.Fprintf(out, "Generating Tag for [%s]...\n", imageName)

tag, err := r.Tagger.GenerateFullyQualifiedImageName(artifact.Workspace, imageName)
if err != nil {
return nil, errors.Wrapf(err, "generating tag for %s", imageName)
}

logrus.Debugf("Tag for %s: %s\n", imageName, tag)
tags[imageName] = tag
}

return tags, nil
}

// BuildAndTest builds artifacts and runs tests on built artifacts
func (r *SkaffoldRunner) BuildAndTest(ctx context.Context, out io.Writer, artifacts []*latest.Artifact) ([]build.Artifact, error) {
bRes, err := r.Build(ctx, out, r.Tagger, artifacts)
tags, err := r.imageTags(out, artifacts)
if err != nil {
return nil, errors.Wrap(err, "generating tag")
}

bRes, err := r.Build(ctx, out, tags, artifacts)
if err != nil {
return nil, errors.Wrap(err, "build failed")
}
10 changes: 5 additions & 5 deletions pkg/skaffold/runner/runner_test.go
Original file line number Diff line number Diff line change
@@ -66,7 +66,7 @@ func (t *TestBench) enterNewCycle() {
t.currentActions = Actions{}
}

func (t *TestBench) Build(ctx context.Context, w io.Writer, tagger tag.Tagger, artifacts []*latest.Artifact) ([]build.Artifact, error) {
func (t *TestBench) Build(ctx context.Context, w io.Writer, tags tag.ImageTags, artifacts []*latest.Artifact) ([]build.Artifact, error) {
if len(t.buildErrors) > 0 {
err := t.buildErrors[0]
t.buildErrors = t.buildErrors[1:]
@@ -85,7 +85,7 @@ func (t *TestBench) Build(ctx context.Context, w io.Writer, tagger tag.Tagger, a
})
}

t.currentActions.Built = tags(builds)
t.currentActions.Built = findTags(builds)
return builds, nil
}

@@ -111,7 +111,7 @@ func (t *TestBench) Test(ctx context.Context, out io.Writer, artifacts []build.A
}
}

t.currentActions.Tested = tags(artifacts)
t.currentActions.Tested = findTags(artifacts)
return nil
}

@@ -124,15 +124,15 @@ func (t *TestBench) Deploy(ctx context.Context, out io.Writer, artifacts []build
}
}

t.currentActions.Deployed = tags(artifacts)
t.currentActions.Deployed = findTags(artifacts)
return nil
}

func (t *TestBench) Actions() []Actions {
return append(t.actions, t.currentActions)
}

func tags(artifacts []build.Artifact) []string {
func findTags(artifacts []build.Artifact) []string {
var tags []string
for _, artifact := range artifacts {
tags = append(tags, artifact.Tag)
4 changes: 2 additions & 2 deletions pkg/skaffold/runner/timings.go
Original file line number Diff line number Diff line change
@@ -52,11 +52,11 @@ func (w withTimings) Labels() map[string]string {
return labels.Merge(w.Builder.Labels(), w.Deployer.Labels())
}

func (w withTimings) Build(ctx context.Context, out io.Writer, tagger tag.Tagger, artifacts []*latest.Artifact) ([]build.Artifact, error) {
func (w withTimings) Build(ctx context.Context, out io.Writer, tags tag.ImageTags, artifacts []*latest.Artifact) ([]build.Artifact, error) {
start := time.Now()
color.Default.Fprintln(out, "Starting build...")

bRes, err := w.Builder.Build(ctx, out, tagger, artifacts)
bRes, err := w.Builder.Build(ctx, out, tags, artifacts)
if err != nil {
return nil, err
}