fix(runner): check task state field exist.

Signed-off-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi.Wu 2022-10-30 11:47:06 +08:00 committed by Jason Song
parent 08c94bb564
commit 2442cdd8ad

View File

@ -224,12 +224,15 @@ func (r *Reporter) ReportState() error {
resp, err := r.client.UpdateTask(r.ctx, connect.NewRequest(&runnerv1.UpdateTaskRequest{
State: state,
}))
if err != nil {
return err
}
if resp.Msg.State.Result == runnerv1.Result_RESULT_CANCELLED {
if resp.Msg.State != nil && resp.Msg.State.Result == runnerv1.Result_RESULT_CANCELLED {
r.cancel()
}
return err
return nil
}
func (r *Reporter) duringSteps() bool {