Skip to content
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

Improve the logs when there's no skaffold.yaml #2467

Merged
merged 2 commits into from
Jul 15, 2019
Merged
Show file tree
Hide file tree
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
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