-
Notifications
You must be signed in to change notification settings - Fork 894
feat: Add provisionerdaemon to coderd #141
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
ea69016
7a9f714
33ecab0
7987596
bc27864
c448e99
d062b5b
0a83477
e87f31d
2a76b60
03ed951
9cc4756
8282393
aa760cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ const ( | |
ProvisionerJobStatusPending ProvisionerJobStatus = "pending" | ||
ProvisionerJobStatusRunning ProvisionerJobStatus = "running" | ||
ProvisionerJobStatusSucceeded ProvisionerJobStatus = "succeeded" | ||
ProvisionerJobStatusCancelled ProvisionerJobStatus = "canceled" | ||
ProvisionerJobStatusFailed ProvisionerJobStatus = "failed" | ||
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. Should there be a state for cancelled? 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. I suppose I'm not sure. I felt like failed would represent cancelled, but I suppose that's a different state. I'm going to add it in! |
||
) | ||
|
||
|
@@ -41,6 +42,7 @@ func convertProvisionerJob(provisionerJob database.ProvisionerJob) ProvisionerJo | |
Error: provisionerJob.Error.String, | ||
Provisioner: provisionerJob.Provisioner, | ||
} | ||
// Applying values optional to the struct. | ||
if provisionerJob.StartedAt.Valid { | ||
job.StartedAt = &provisionerJob.StartedAt.Time | ||
} | ||
|
@@ -56,7 +58,7 @@ func convertProvisionerJob(provisionerJob database.ProvisionerJob) ProvisionerJo | |
|
||
switch { | ||
case provisionerJob.CancelledAt.Valid: | ||
job.Status = ProvisionerJobStatusFailed | ||
job.Status = ProvisionerJobStatusCancelled | ||
case !provisionerJob.StartedAt.Valid: | ||
job.Status = ProvisionerJobStatusPending | ||
case provisionerJob.CompletedAt.Valid: | ||
|
@@ -68,5 +70,9 @@ func convertProvisionerJob(provisionerJob database.ProvisionerJob) ProvisionerJo | |
job.Status = ProvisionerJobStatusRunning | ||
} | ||
|
||
if job.Error != "" { | ||
job.Status = ProvisionerJobStatusFailed | ||
} | ||
|
||
return job | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ type WorkspaceHistory struct { | |
ProjectHistoryID uuid.UUID `json:"project_history_id"` | ||
BeforeID uuid.UUID `json:"before_id"` | ||
AfterID uuid.UUID `json:"after_id"` | ||
Name string `json:"name"` | ||
Transition database.WorkspaceTransition `json:"transition"` | ||
Initiator string `json:"initiator"` | ||
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. Not an issue with this PR, but I worry that this schema will make it difficult for a user to change names. That username-change will have to percolate through all these places we're storing their name. 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. This is a user ID. It's not very clear, so I should add a comment. We can't use the |
||
Provision ProvisionerJob `json:"provision"` | ||
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. |
||
|
@@ -144,7 +145,7 @@ func (api *api) postWorkspaceHistoryByUser(rw http.ResponseWriter, r *http.Reque | |
} | ||
|
||
workspaceHistory, err = db.InsertWorkspaceHistory(r.Context(), database.InsertWorkspaceHistoryParams{ | ||
ID: uuid.New(), | ||
ID: workspaceHistoryID, | ||
CreatedAt: database.Now(), | ||
UpdatedAt: database.Now(), | ||
WorkspaceID: workspace.ID, | ||
|
@@ -242,6 +243,7 @@ func convertWorkspaceHistory(workspaceHistory database.WorkspaceHistory, provisi | |
ProjectHistoryID: workspaceHistory.ProjectHistoryID, | ||
BeforeID: workspaceHistory.BeforeID.UUID, | ||
AfterID: workspaceHistory.AfterID.UUID, | ||
Name: workspaceHistory.Name, | ||
Transition: workspaceHistory.Transition, | ||
Initiator: workspaceHistory.Initiator, | ||
Provision: convertProvisionerJob(provisionerJob), | ||
|
Uh oh!
There was an error while loading. Please reload this page.