Skip to content

chore: safe type assersions #7770

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

Conversation

OladapoAjala
Copy link
Contributor

Fixes: #7672
Related: Relevant tracking issues, for context
Merge before/after: Dependent or prerequisite PRs

Description

config, ok := cfg.(*latest.SkaffoldConfig)
if !ok {
log.Entry(context.TODO()).Debugf("failed interface conversion: %v is %T not *latest.SkaffoldConfig", cfg, cfg)
return nil, nil, fmt.Errorf("failed interface conversion: %v is %T not *latest.SkaffoldConfig", cfg, cfg)
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks perfect. Can you instead of returning an error, can you return an sErrors.ActionableErr.
Please add a new error code for configuration parsing error here

// Catch-all configuration file parsing error
e.g. CONFIG_UPGRADE_ERR?

Here is the documentation on how to add new error codes.
https://github.com/GoogleContainerTools/skaffold/blob/main/DEVELOPMENT.md#adding-actionable-error-messages-to-code

Copy link
Contributor Author

@OladapoAjala OladapoAjala Aug 11, 2022

Choose a reason for hiding this comment

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

I was thinking

CONFIG_FILE_PARSING_ERR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tejal29 I just added an actionable error. Let me know if this suffices or I still need to create the new actionable error?

Copy link
Contributor

Choose a reason for hiding this comment

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

We want this error code to be unique to distinguish between

  1. when skaffold.yaml is correct
  2. when skaffold code failed to upgrade the config

Lets create a new one if its ok with you?

@codecov
Copy link

codecov bot commented Aug 11, 2022

Codecov Report

Merging #7770 (7c68d89) into main (290280e) will decrease coverage by 3.85%.
The diff coverage is 53.59%.

@@            Coverage Diff             @@
##             main    #7770      +/-   ##
==========================================
- Coverage   70.48%   66.63%   -3.86%     
==========================================
  Files         515      590      +75     
  Lines       23150    28504    +5354     
==========================================
+ Hits        16317    18993    +2676     
- Misses       5776     8120    +2344     
- Partials     1057     1391     +334     
Impacted Files Coverage Δ
cmd/skaffold/app/cmd/credits/export.go 0.00% <0.00%> (ø)
cmd/skaffold/app/cmd/deploy.go 40.90% <0.00%> (-12.94%) ⬇️
cmd/skaffold/app/cmd/test.go 44.44% <0.00%> (ø)
cmd/skaffold/skaffold.go 0.00% <0.00%> (ø)
cmd/skaffold/app/cmd/inspect_tests.go 62.50% <14.28%> (-1.14%) ⬇️
cmd/skaffold/app/cmd/render.go 35.48% <18.18%> (-5.90%) ⬇️
cmd/skaffold/app/cmd/lsp.go 28.12% <28.12%> (ø)
cmd/skaffold/app/cmd/run.go 64.28% <33.33%> (-9.63%) ⬇️
cmd/skaffold/app/cmd/fix.go 56.41% <37.50%> (-20.07%) ⬇️
cmd/skaffold/app/cmd/verify.go 41.17% <41.17%> (ø)
... and 361 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@OladapoAjala
Copy link
Contributor Author

Hi @tejal29, I have added an actionable error. Thanks

@tejal29
Copy link
Contributor

tejal29 commented Aug 15, 2022

Thank you for your contribution!! Will merge if tests are green

@tejal29
Copy link
Contributor

tejal29 commented Aug 15, 2022

Please feel free to change this PR "Ready for Review"

@OladapoAjala OladapoAjala marked this pull request as ready for review August 15, 2022 18:47
@tejal29 tejal29 changed the title WIP: safe type assersions chore: safe type assersions Aug 15, 2022
@OladapoAjala OladapoAjala force-pushed the fix-panics-in-interface-conversions branch from 9f4121a to ce3da76 Compare August 17, 2022 22:11
@tejal29 tejal29 enabled auto-merge (squash) August 19, 2022 15:47
@tejal29 tejal29 merged commit e6c34fe into GoogleContainerTools:main Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panic in interface conversion
3 participants