@@ -30,6 +30,7 @@ import (
30
30
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/kubectl"
31
31
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/output/log"
32
32
"github.com/GoogleContainerTools/skaffold/proto/v1"
33
+ protoV2 "github.com/GoogleContainerTools/skaffold/proto/v2"
33
34
)
34
35
35
36
const (
@@ -132,12 +133,24 @@ func (d *Deployment) CheckStatus(ctx context.Context, cfg kubectl.Config) {
132
133
133
134
details := d .cleanupStatus (string (b ))
134
135
135
- ae := parseKubectlRolloutError (details , err )
136
- if ae .ErrCode == proto .StatusCode_STATUSCHECK_KUBECTL_PID_KILLED {
137
- ae .Message = fmt .Sprintf ("received Ctrl-C or deployments could not stabilize within %v: %v" , d .deadline , err )
138
- }
139
-
136
+ ae := parseKubectlRolloutError (details , d .deadline , err )
140
137
d .UpdateStatus (ae )
138
+ // send event update in check status.
139
+ event .ResourceStatusCheckEventCompleted (d .String (), ae )
140
+ eventV2 .ResourceStatusCheckEventCompleted (d .String (), sErrors .V2fromV1 (ae ))
141
+ // if deployment is successfully rolled out, send pod success event to make sure
142
+ // all pod are marked as success in V2
143
+ // See https://github.com/GoogleCloudPlatform/cloud-code-vscode-internal/issues/5277
144
+ if ae .ErrCode == proto .StatusCode_STATUSCHECK_SUCCESS {
145
+ for _ , pod := range d .pods {
146
+ eventV2 .ResourceStatusCheckEventCompletedMessage (
147
+ pod .String (),
148
+ fmt .Sprintf ("%s %s: running.\n " , tabHeader , pod .String ()),
149
+ protoV2.ActionableErr {ErrCode : proto .StatusCode_STATUSCHECK_SUCCESS },
150
+ )
151
+ }
152
+ return
153
+ }
141
154
if err := d .fetchPods (ctx ); err != nil {
142
155
log .Entry (ctx ).Debugf ("pod statuses could not be fetched this time due to %s" , err )
143
156
}
@@ -233,7 +246,7 @@ func (d *Deployment) cleanupStatus(msg string) string {
233
246
// $kubectl logs testPod -f
234
247
// 2020/06/18 17:28:31 service is running
235
248
// Killed: 9
236
- func parseKubectlRolloutError (details string , err error ) proto.ActionableErr {
249
+ func parseKubectlRolloutError (details string , deadline time. Duration , err error ) proto.ActionableErr {
237
250
switch {
238
251
case err == nil && strings .Contains (details , rollOutSuccess ):
239
252
return proto.ActionableErr {
@@ -253,7 +266,7 @@ func parseKubectlRolloutError(details string, err error) proto.ActionableErr {
253
266
case strings .Contains (err .Error (), killedErrMsg ):
254
267
return proto.ActionableErr {
255
268
ErrCode : proto .StatusCode_STATUSCHECK_KUBECTL_PID_KILLED ,
256
- Message : msgKubectlKilled ,
269
+ Message : fmt . Sprintf ( "received Ctrl-C or deployments could not stabilize within %v: %s" , deadline , msgKubectlKilled ) ,
257
270
}
258
271
default :
259
272
return proto.ActionableErr {
0 commit comments