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

add source file and module to config parsing error description #6087

Merged
merged 1 commit into from
Jun 28, 2021

Conversation

gsquared94
Copy link
Contributor

Fixes: #5456

Description

This PR adds additional context to config-parsing errors like the file name and module name(if defined) or the index of the config.

User facing changes (remove if N/A)

Before:

❯ skaffold build
invalid skaffold config: invalid image "skaffold-example:tag": no tag should be specified. Use taggers instead: https://skaffold.dev/docs/how-tos/taggers/

After:

❯ skaffold build
invalid skaffold config: source /Users/gaghosh/Code/Work/fork/skaffold/integration/examples/getting-started/skaffold.yaml, unnamed config at index 0: invalid image "skaffold-example:tag": no tag should be specified. Use taggers instead: https://skaffold.dev/docs/how-tos/taggers/

@gsquared94 gsquared94 requested a review from a team as a code owner June 28, 2021 10:01
@gsquared94 gsquared94 requested a review from aaron-prindle June 28, 2021 10:01
@google-cla google-cla bot added the cla: yes label Jun 28, 2021
@gsquared94 gsquared94 added this to the v1.27.0 milestone Jun 28, 2021
@codecov
Copy link

codecov bot commented Jun 28, 2021

Codecov Report

Merging #6087 (cba156b) into master (36803b4) will increase coverage by 0.01%.
The diff coverage is 89.74%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6087      +/-   ##
==========================================
+ Coverage   70.20%   70.22%   +0.01%     
==========================================
  Files         475      475              
  Lines       18147    18165      +18     
==========================================
+ Hits        12741    12757      +16     
- Misses       4470     4472       +2     
  Partials      936      936              
Impacted Files Coverage Δ
cmd/skaffold/app/cmd/runner.go 57.14% <55.55%> (-0.55%) ⬇️
cmd/skaffold/app/cmd/fix.go 75.55% <100.00%> (+1.13%) ⬆️
pkg/skaffold/schema/validation/validation.go 87.06% <100.00%> (+0.42%) ⬆️
pkg/skaffold/event/v2/status_check.go 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 36803b4...cba156b. Read the comment docs.

// do not set a default deployer in a multi-config application.
if len(configs) > 1 {
return
}
// there always exists at least one config
defaults.SetDefaultDeployer(configs[0])
defaults.SetDefaultDeployer(configs[0].SkaffoldConfig)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Is it possilbe that configs[0] is nil? From the comment it doesn't seem possible, wanted to verify

Copy link
Contributor

@aaron-prindle aaron-prindle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@gsquared94 gsquared94 merged commit 9cd80d3 into GoogleContainerTools:master Jun 28, 2021
@omninonsense
Copy link

Brilliant! Thanks for this! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide context when reporting required config errors
3 participants