- Notifications
You must be signed in to change notification settings - Fork1k
feat(coderd): add matched provisioner daemons information to more places#15688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
ba944ab
4e51f20
47036e8
16be03b
4304a06
9ef68dd
38788d5
1c95ffe
98521be
e1423f5
517a505
c4295ef
c5fb83b
3bd62fd
2f625bc
848338e
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -245,7 +245,7 @@ func (e *Executor) runOnce(t time.Time) Stats { | ||
} | ||
} | ||
nextBuild, job,_,err = builder.Build(e.ctx, tx, nil, audit.WorkspaceBuildBaggage{IP: "127.0.0.1"}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. self-review: we may need to notify or log about this, but deferring for later. | ||
if err != nil { | ||
return xerrors.Errorf("build workspace with transition %q: %w", nextTransition, err) | ||
} | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -10,7 +10,6 @@ import ( | ||
"fmt" | ||
"net/http" | ||
"os" | ||
"github.com/go-chi/chi/v5" | ||
"github.com/google/uuid" | ||
@@ -22,6 +21,7 @@ import ( | ||
"github.com/coder/coder/v2/coderd/audit" | ||
"github.com/coder/coder/v2/coderd/database" | ||
"github.com/coder/coder/v2/coderd/database/db2sdk" | ||
"github.com/coder/coder/v2/coderd/database/dbtime" | ||
"github.com/coder/coder/v2/coderd/database/provisionerjobs" | ||
"github.com/coder/coder/v2/coderd/externalauth" | ||
@@ -1513,27 +1513,6 @@ func (api *API) postTemplateVersionsByOrganization(rw http.ResponseWriter, r *ht | ||
return err | ||
} | ||
provisionerJob, err = tx.InsertProvisionerJob(ctx, database.InsertProvisionerJobParams{ | ||
ID: jobID, | ||
CreatedAt: dbtime.Now(), | ||
@@ -1559,6 +1538,33 @@ func (api *API) postTemplateVersionsByOrganization(rw http.ResponseWriter, r *ht | ||
return err | ||
} | ||
// Check for eligible provisioners. This allows us to return a warning to the user if they | ||
// submit a job for which no provisioner is available. | ||
eligibleProvisioners, err := tx.GetProvisionerDaemonsByOrganization(ctx, database.GetProvisionerDaemonsByOrganizationParams{ | ||
OrganizationID: organization.ID, | ||
WantTags: provisionerJob.Tags, | ||
}) | ||
if err != nil { | ||
// Log the error but do not return any warnings. This is purely advisory and we should not block. | ||
api.Logger.Error(ctx, "failed to check eligible provisioner daemons for job", slog.Error(err)) | ||
} | ||
matchedProvisioners = db2sdk.MatchedProvisioners(eligibleProvisioners, provisionerJob.CreatedAt, provisionerdserver.StaleInterval) | ||
if matchedProvisioners.Count == 0 { | ||
api.Logger.Warn(ctx, "no matching provisioners found for job", | ||
slog.F("user_id", apiKey.UserID), | ||
slog.F("job_id", jobID), | ||
slog.F("job_type", database.ProvisionerJobTypeTemplateVersionImport), | ||
slog.F("tags", tags), | ||
) | ||
} else if matchedProvisioners.Available == 0 { | ||
api.Logger.Warn(ctx, "no active provisioners found for job", | ||
slog.F("user_id", apiKey.UserID), | ||
slog.F("job_id", jobID), | ||
slog.F("job_type", database.ProvisionerJobTypeTemplateVersionImport), | ||
slog.F("tags", tags), | ||
) | ||
} | ||
var templateID uuid.NullUUID | ||
if req.TemplateID != uuid.Nil { | ||
templateID = uuid.NullUUID{ | ||
@@ -1822,34 +1828,3 @@ func (api *API) publishTemplateUpdate(ctx context.Context, templateID uuid.UUID) | ||
slog.F("template_id", templateID), slog.Error(err)) | ||
} | ||
} | ||
Comment on lines -1826 to -1855 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. self-review: extracted to |
Uh oh!
There was an error while loading.Please reload this page.