Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf819477

Browse files
refactor: rename sidebarappid variables to taskappid
1 parent7de7f42 commitf819477

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

‎coderd/provisionerdserver/provisionerdserver.go‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1986,9 +1986,9 @@ func (s *server) completeWorkspaceBuildJob(ctx context.Context, job database.Pro
19861986
}
19871987
}
19881988

1989-
varsidebarAppID uuid.NullUUID
1989+
vartaskAppID uuid.NullUUID
19901990
varhasAITaskbool
1991-
varwarnUnknownSidebarAppIDbool
1991+
varwarnUnknownTaskAppIDbool
19921992
iftasks:=jobType.WorkspaceBuild.GetAiTasks();len(tasks)>0 {
19931993
hasAITask=true
19941994
task:=tasks[0]
@@ -2005,15 +2005,15 @@ func (s *server) completeWorkspaceBuildJob(ctx context.Context, job database.Pro
20052005
}
20062006

20072007
if!slices.Contains(appIDs,appID) {
2008-
warnUnknownSidebarAppID=true
2008+
warnUnknownTaskAppID=true
20092009
}
20102010

20112011
id,err:=uuid.Parse(appID)
20122012
iferr!=nil {
2013-
returnxerrors.Errorf("parsesidebarapp id: %w",err)
2013+
returnxerrors.Errorf("parse app id: %w",err)
20142014
}
20152015

2016-
sidebarAppID= uuid.NullUUID{UUID:id,Valid:true}
2016+
taskAppID= uuid.NullUUID{UUID:id,Valid:true}
20172017
}
20182018

20192019
// This is a hacky workaround for the issue with tasks 'disappearing' on stop:
@@ -2025,19 +2025,19 @@ func (s *server) completeWorkspaceBuildJob(ctx context.Context, job database.Pro
20252025
BuildNumber:workspaceBuild.BuildNumber-1,
20262026
});err==nil {
20272027
hasAITask=prevBuild.HasAITask.Bool
2028-
sidebarAppID=prevBuild.AITaskSidebarAppID
2029-
warnUnknownSidebarAppID=false
2030-
s.Logger.Debug(ctx,"task workaround: reused has_ai_task andsidebar_app_id from previous build to keep track of task",
2028+
taskAppID=prevBuild.AITaskSidebarAppID
2029+
warnUnknownTaskAppID=false
2030+
s.Logger.Debug(ctx,"task workaround: reused has_ai_task andapp_id from previous build to keep track of task",
20312031
slog.F("job_id",job.ID.String()),
20322032
slog.F("build_number",prevBuild.BuildNumber),
20332033
slog.F("workspace_id",workspace.ID),
20342034
slog.F("workspace_build_id",workspaceBuild.ID),
20352035
slog.F("transition",string(workspaceBuild.Transition)),
2036-
slog.F("sidebar_app_id",sidebarAppID.UUID),
2036+
slog.F("sidebar_app_id",taskAppID.UUID),
20372037
slog.F("has_ai_task",hasAITask),
20382038
)
20392039
}else {
2040-
s.Logger.Error(ctx,"task workaround: tracking via has_ai_task andsidebar_app from previous build failed",
2040+
s.Logger.Error(ctx,"task workaround: tracking via has_ai_task andapp_id from previous build failed",
20412041
slog.Error(err),
20422042
slog.F("job_id",job.ID.String()),
20432043
slog.F("workspace_id",workspace.ID),
@@ -2047,14 +2047,14 @@ func (s *server) completeWorkspaceBuildJob(ctx context.Context, job database.Pro
20472047
}
20482048
}
20492049

2050-
ifwarnUnknownSidebarAppID {
2050+
ifwarnUnknownTaskAppID {
20512051
// Ref: https://github.com/coder/coder/issues/18776
20522052
// This can happen for a number of reasons:
20532053
// 1. Misconfigured template
20542054
// 2. Count=0 on the agent due to stop transition, meaning the associated coder_app was not inserted.
20552055
// Failing the build at this point is not ideal, so log a warning instead.
2056-
s.Logger.Warn(ctx,"unknownai_task_sidebar_app_id",
2057-
slog.F("ai_task_sidebar_app_id",sidebarAppID.UUID.String()),
2056+
s.Logger.Warn(ctx,"unknownai_task_app_id",
2057+
slog.F("ai_task_app_id",taskAppID.UUID.String()),
20582058
slog.F("job_id",job.ID.String()),
20592059
slog.F("workspace_id",workspace.ID),
20602060
slog.F("workspace_build_id",workspaceBuild.ID),
@@ -2068,13 +2068,13 @@ func (s *server) completeWorkspaceBuildJob(ctx context.Context, job database.Pro
20682068
Level: []database.LogLevel{database.LogLevelWarn,database.LogLevelWarn,database.LogLevelWarn,database.LogLevelWarn},
20692069
Stage: []string{"Cleaning Up","Cleaning Up","Cleaning Up","Cleaning Up"},
20702070
Output: []string{
2071-
fmt.Sprintf("Unknownai_task_sidebar_app_id %q. This workspace will be unable to run AI tasks. This may be due to a template configuration issue, please check with the template author.",sidebarAppID.UUID.String()),
2071+
fmt.Sprintf("Unknownai_task_app_id %q. This workspace will be unable to run AI tasks. This may be due to a template configuration issue, please check with the template author.",taskAppID.UUID.String()),
20722072
"Template author: double-check the following:",
20732073
" - You have associated the coder_ai_task with a valid coder_app in your template (ref: https://registry.terraform.io/providers/coder/coder/latest/docs/resources/ai_task).",
20742074
" - You have associated the coder_agent with at least one other compute resource. Agents with no other associated resources are not inserted into the database.",
20752075
},
20762076
});err!=nil {
2077-
s.Logger.Error(ctx,"insert provisioner job log for ai tasksidebarapp id warning",
2077+
s.Logger.Error(ctx,"insert provisioner job log for ai task app id warning",
20782078
slog.F("job_id",jobID),
20792079
slog.F("workspace_id",workspace.ID),
20802080
slog.F("workspace_build_id",workspaceBuild.ID),
@@ -2083,7 +2083,7 @@ func (s *server) completeWorkspaceBuildJob(ctx context.Context, job database.Pro
20832083
}
20842084
// Important: reset hasAITask and sidebarAppID so that we don't run into a fk constraint violation.
20852085
hasAITask=false
2086-
sidebarAppID= uuid.NullUUID{}
2086+
taskAppID= uuid.NullUUID{}
20872087
}
20882088

20892089
ifhasAITask&&workspaceBuild.Transition==database.WorkspaceTransitionStart {
@@ -2120,7 +2120,7 @@ func (s *server) completeWorkspaceBuildJob(ctx context.Context, job database.Pro
21202120
Bool:hasExternalAgent,
21212121
Valid:true,
21222122
},
2123-
SidebarAppID:sidebarAppID,
2123+
SidebarAppID:taskAppID,
21242124
UpdatedAt:now,
21252125
});err!=nil {
21262126
returnxerrors.Errorf("update workspace build ai tasks and external agent flag: %w",err)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp