feat: propagate job error codes (#6507)

* feat: propagate job error_code

* fix

* Fix

* Fix

* Fix

* add errors to typesGenerated

* Address PR comments

* Fix
This commit is contained in:
Marcin Tojek
2023-03-08 16:32:00 +01:00
committed by GitHub
parent 524b14adbc
commit 3b87316ad7
25 changed files with 406 additions and 234 deletions
@@ -113,6 +113,7 @@ func (server *Server) AcquireJob(ctx context.Context, _ *proto.Empty) (*proto.Ac
String: errorMessage,
Valid: true,
},
ErrorCode: job.ErrorCode,
})
if err != nil {
return xerrors.Errorf("update provisioner job: %w", err)
@@ -639,12 +640,17 @@ func (server *Server) FailJob(ctx context.Context, failJob *proto.FailedJob) (*p
String: failJob.Error,
Valid: failJob.Error != "",
}
job.ErrorCode = sql.NullString{
String: failJob.ErrorCode,
Valid: failJob.ErrorCode != "",
}
err = server.Database.UpdateProvisionerJobWithCompleteByID(ctx, database.UpdateProvisionerJobWithCompleteByIDParams{
ID: jobID,
CompletedAt: job.CompletedAt,
UpdatedAt: database.Now(),
Error: job.Error,
ErrorCode: job.ErrorCode,
})
if err != nil {
return nil, xerrors.Errorf("update provisioner job: %w", err)