Skip to content

Commit 1b40a44

Browse files
committed
fix review comments
1 parent 6f14cc1 commit 1b40a44

File tree

10 files changed

+44
-5
lines changed

10 files changed

+44
-5
lines changed

coderd/apidoc/docs.go

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/provisionerjobs.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func (api *API) provisionerJobs(rw http.ResponseWriter, r *http.Request) {
4444
qp := r.URL.Query()
4545
p := httpapi.NewQueryParamParser()
4646
limit := p.PositiveInt32(qp, 0, "limit")
47-
status := p.Strings(qp, []string(nil), "status")
47+
status := p.Strings(qp, nil, "status")
4848
p.ErrorExcessParams(qp)
4949
if len(p.Errors) > 0 {
5050
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
@@ -54,8 +54,6 @@ func (api *API) provisionerJobs(rw http.ResponseWriter, r *http.Request) {
5454
return
5555
}
5656

57-
api.Logger.Debug(ctx, "fetching provisioner jobs", slog.F("organization_id", org.ID), slog.F("status", status), slog.F("limit", limit))
58-
5957
jobs, err := api.Database.GetProvisionerJobsByOrganizationAndStatusWithQueuePositionAndProvisioner(ctx, database.GetProvisionerJobsByOrganizationAndStatusWithQueuePositionAndProvisionerParams{
6058
OrganizationID: uuid.NullUUID{UUID: org.ID, Valid: true},
6159
Status: slice.StringEnums[database.ProvisionerJobStatus](status),
@@ -317,8 +315,9 @@ func convertProvisionerJob(pj database.GetProvisionerJobsByIDsWithQueuePositionR
317315
}
318316
job.Status = codersdk.ProvisionerJobStatus(pj.ProvisionerJob.JobStatus)
319317

320-
// Hope this never breaks to avoid changing function signature.
321-
_ = json.Unmarshal(provisionerJob.Input, &job.Input)
318+
if err := json.Unmarshal(provisionerJob.Input, &job.Input); err != nil {
319+
job.Input.Error = xerrors.Errorf("decode input: %w", err).Error()
320+
}
322321

323322
return job
324323
}

codersdk/provisionerdaemons.go

+1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ func ProvisionerJobStatusEnums() []ProvisionerJobStatus {
128128
type ProvisionerJobInput struct {
129129
TemplateVersionID *uuid.UUID `json:"template_version_id,omitempty" format:"uuid" table:"template version id"`
130130
WorkspaceBuildID *uuid.UUID `json:"workspace_build_id,omitempty" format:"uuid" table:"workspace build id"`
131+
Error string `json:"error,omitempty" table:"-"`
131132
}
132133

133134
// ProvisionerJobType represents the type of job.

docs/reference/api/builds.md

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/api/organizations.md

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/api/schemas.md

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/api/templates.md

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)