Skip to content

Commit

Permalink
Merge pull request #2467 from dgageot/no-skaffold
Browse files Browse the repository at this point in the history
Improve the logs when there's no skaffold.yaml
  • Loading branch information
tejal29 authored Jul 15, 2019
2 parents fe68372 + 69ecfc7 commit 883d134
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
7 changes: 0 additions & 7 deletions cmd/skaffold/app/cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ import (
"context"
"io"
"io/ioutil"
"time"

"github.com/GoogleContainerTools/skaffold/cmd/skaffold/app/flags"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/color"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/config"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest"
Expand Down Expand Up @@ -56,11 +54,6 @@ func doBuild(ctx context.Context, out io.Writer) error {
buildOut = ioutil.Discard
}

start := time.Now()
defer func() {
color.Default.Fprintln(buildOut, "Complete in", time.Since(start))
}()

return withRunner(ctx, func(r runner.Runner, config *latest.SkaffoldConfig) error {
bRes, err := r.BuildAndTest(ctx, buildOut, targetArtifacts(opts, config))

Expand Down
10 changes: 6 additions & 4 deletions cmd/skaffold/app/cmd/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package cmd

import (
"context"
"fmt"
"os"

configutil "github.com/GoogleContainerTools/skaffold/cmd/skaffold/app/cmd/config"
Expand Down Expand Up @@ -52,13 +53,14 @@ func withRunner(ctx context.Context, action func(runner.Runner, *latest.Skaffold
func createNewRunner(opts *config.SkaffoldOptions) (runner.Runner, *latest.SkaffoldConfig, error) {
parsed, err := schema.ParseConfig(opts.ConfigurationFile, true)
if err != nil {
if os.IsNotExist(errors.Cause(err)) {
return nil, nil, fmt.Errorf("[%s] not found. You might need to run `skaffold init`", opts.ConfigurationFile)
}

// If the error is NOT that the file doesn't exist, then we warn the user
// that maybe they are using an outdated version of Skaffold that's unable to read
// the configuration.
if !os.IsNotExist(err) {
warnIfUpdateIsAvailable()
}

warnIfUpdateIsAvailable()
return nil, nil, errors.Wrap(err, "parsing skaffold config")
}

Expand Down

0 comments on commit 883d134

Please sign in to comment.