Skip to content

Add error codes to event api to send error codes to Skaffold Event API#3954

Merged
tejal29 merged 1 commit intoGoogleContainerTools:masterfrom
tejal29:add_error_codes
Apr 15, 2020
Merged

Add error codes to event api to send error codes to Skaffold Event API#3954
tejal29 merged 1 commit intoGoogleContainerTools:masterfrom
tejal29:add_error_codes

Conversation

@tejal29
Copy link
Copy Markdown
Contributor

@tejal29 tejal29 commented Apr 15, 2020

Fixes: This is an internal work item requested by IDEs to better report failure cause.

Description
This change

  1. Adds a ENUM type to skaffold event proto ErrorCode
    This Enum is added to each
  • Build,
  • Deploy,
  • FileSync
  • StatusCheckEvent
  1. Adds a new errors package at pkg/skaffold/errors with a function ErrorCodeFromError which will responsible to translate an error string to error code.
    Currently this returns error code COULD_NOT_DETERMINE

User facing changes (remove if N/A)
New field for IDEs to consume.

Follow-up Work (remove if N/A)
The follow work will include,

  1. Going through all errors in pkg/skaffold/<pkg> e.g. below and converting them to distinct error codes wherever possible.
git grep 'fmt.Errorf' pkg/skaffold/build/jib/
pkg/skaffold/build/jib/sync.go:         return nil, fmt.Errorf("failed to unmarshal jib sync JSON: %w", err)
pkg/skaffold/build/jib/sync.go:         return nil, fmt.Errorf("failed to add jib json direct entries to sync state: %w", err)
pkg/skaffold/build/jib/sync.go:         return nil, fmt.Errorf("failed to add jib json generated entries to sync state: %w", err)
  1. Add implementation to ErrorCodeFromError which could be as simple as regex matching.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 15, 2020

Codecov Report

Merging #3954 into master will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted Files Coverage Δ
pkg/skaffold/errors/errors.go 100.00% <100.00%> (ø)
pkg/skaffold/event/event.go 93.05% <100.00%> (+0.10%) ⬆️
...affold/kubernetes/portforward/kubectl_forwarder.go 65.85% <0.00%> (-2.44%) ⬇️

@tejal29 tejal29 merged commit bb7807e into GoogleContainerTools:master Apr 15, 2020
@tejal29 tejal29 deleted the add_error_codes branch April 15, 2021 07:35
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.

3 participants