Skip to content

Commit c924457

Browse files
committed
fix review comments
1 parent 77a12c8 commit c924457

File tree

10 files changed

+44
-5
lines changed

10 files changed

+44
-5
lines changed

coderd/apidoc/docs.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/provisionerjobs.go

Lines changed: 4 additions & 5 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/api/organizations.md

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/api/schemas.md

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/api/templates.md

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy