Skip to content

Commit

Permalink
Use ResourceStatusCheckEvent[Updated/Completed] where appropriate (#…
Browse files Browse the repository at this point in the history
…6550)

* use updated/completed where appropriate

* remove duplicates and extra messages
  • Loading branch information
MarlonGamez committed Sep 1, 2021
1 parent de549d5 commit a6931b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
12 changes: 2 additions & 10 deletions pkg/skaffold/kubernetes/status/resource/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ func (d *Deployment) CheckStatus(ctx context.Context, cfg kubectl.Config) {
ae := parseKubectlRolloutError(details, d.deadline, err)
d.UpdateStatus(ae)
// send event update in check status.
event.ResourceStatusCheckEventCompleted(d.String(), ae)
eventV2.ResourceStatusCheckEventCompleted(d.String(), sErrors.V2fromV1(ae))
// if deployment is successfully rolled out, send pod success event to make sure
// all pod are marked as success in V2
// See https://github.com/GoogleCloudPlatform/cloud-code-vscode-internal/issues/5277
Expand Down Expand Up @@ -307,14 +305,8 @@ func (d *Deployment) fetchPods(ctx context.Context) error {
if !found || originalPod.StatusUpdated(p) {
d.status.changed = true
prefix := fmt.Sprintf("%s %s:", tabHeader, p.String())
switch p.ActionableError().ErrCode {
case proto.StatusCode_STATUSCHECK_SUCCESS:
event.ResourceStatusCheckEventCompleted(p.String(), p.ActionableError())
eventV2.ResourceStatusCheckEventCompletedMessage(
p.String(),
fmt.Sprintf("%s running.\n", prefix),
sErrors.V2fromV1(p.ActionableError()))
default:
if p.ActionableError().ErrCode != proto.StatusCode_STATUSCHECK_SUCCESS &&
p.ActionableError().Message != "" {
event.ResourceStatusCheckEventUpdated(p.String(), p.ActionableError())
eventV2.ResourceStatusCheckEventUpdatedMessage(
p.String(),
Expand Down
2 changes: 2 additions & 0 deletions pkg/skaffold/kubernetes/status/status_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ func (s *Monitor) printStatusCheckSummary(out io.Writer, r *resource.Deployment,
// another deployment failed
return
}
event.ResourceStatusCheckEventCompleted(r.String(), ae)
eventV2.ResourceStatusCheckEventCompleted(r.String(), sErrors.V2fromV1(ae))
out, _ = output.WithEventContext(context.Background(), out, constants.Deploy, r.String())
status := fmt.Sprintf("%s %s", tabHeader, r)
if ae.ErrCode != proto.StatusCode_STATUSCHECK_SUCCESS {
Expand Down

0 comments on commit a6931b7

Please sign in to comment.