mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: persist generated coder_app id (#18487)
This commit is contained in:
@@ -92,7 +92,7 @@ func (a *AppsAPI) BatchUpdateAppHealths(ctx context.Context, req *agentproto.Bat
|
||||
Health: app.Health,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("update workspace app health for app %q (%q): %w", err, app.ID, app.Slug)
|
||||
return nil, xerrors.Errorf("update workspace app health for app %q (%q): %w", app.ID, app.Slug, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2595,8 +2595,19 @@ func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
|
||||
openIn = database.WorkspaceAppOpenInSlimWindow
|
||||
}
|
||||
|
||||
var appID string
|
||||
if app.Id == "" || app.Id == uuid.Nil.String() {
|
||||
appID = uuid.NewString()
|
||||
} else {
|
||||
appID = app.Id
|
||||
}
|
||||
id, err := uuid.Parse(appID)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("parse app uuid: %w", err)
|
||||
}
|
||||
|
||||
dbApp, err := db.InsertWorkspaceApp(ctx, database.InsertWorkspaceAppParams{
|
||||
ID: uuid.New(),
|
||||
ID: id,
|
||||
CreatedAt: dbtime.Now(),
|
||||
AgentID: dbAgent.ID,
|
||||
Slug: slug,
|
||||
|
||||
Reference in New Issue
Block a user