Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion coderd/provisionerdserver/provisionerdserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -2175,6 +2175,12 @@ func (s *server) completeWorkspaceBuildJob(ctx context.Context, job database.Pro
continue
}

// Scan does not guarantee validity
if !stg.Valid() {
s.Logger.Warn(ctx, "invalid stage, will fail insert based one enum", slog.F("value", t.Stage))
continue
}

params.Stage = append(params.Stage, stg)
params.Source = append(params.Source, t.Source)
params.Resource = append(params.Resource, t.Resource)
Expand All @@ -2184,8 +2190,11 @@ func (s *server) completeWorkspaceBuildJob(ctx context.Context, job database.Pro
}
_, err = db.InsertProvisionerJobTimings(ctx, params)
if err != nil {
// Log error but don't fail the whole transaction for non-critical data
// A database error here will "fail" this transaction. Making this error fatal.
// If this error is seen, add checks above to validate the insert parameters. In
// production, timings should not be a fatal error.
s.Logger.Warn(ctx, "failed to update provisioner job timings", slog.F("job_id", jobID), slog.Error(err))
return xerrors.Errorf("update provisioner job timings: %w", err)
}

// On start, we want to ensure that workspace agents timeout statuses
Expand Down
Loading