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

Commitb966df1

Browse files
chore: promote tasks from experimental
1 parentae2c94b commitb966df1

22 files changed

+900
-777
lines changed

‎cli/task_create.go‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ func (r *RootCmd) taskCreate() *serpent.Command {
111111
}
112112

113113
var (
114-
ctx=inv.Context()
115-
expClient=codersdk.NewExperimentalClient(client)
114+
ctx=inv.Context()
116115

117116
taskInputstring
118117
templateVersionID uuid.UUID
@@ -208,7 +207,7 @@ func (r *RootCmd) taskCreate() *serpent.Command {
208207
templateVersionPresetID=preset.ID
209208
}
210209

211-
task,err:=expClient.CreateTask(ctx,ownerArg, codersdk.CreateTaskRequest{
210+
task,err:=client.CreateTask(ctx,ownerArg, codersdk.CreateTaskRequest{
212211
Name:taskName,
213212
TemplateVersionID:templateVersionID,
214213
TemplateVersionPresetID:templateVersionPresetID,

‎cli/task_create_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func TestTaskCreate(t *testing.T) {
6969
ActiveVersionID:templateVersionID,
7070
},
7171
})
72-
casefmt.Sprintf("/api/experimental/tasks/%s",username):
72+
casefmt.Sprintf("/api/v2/tasks/%s",username):
7373
varreq codersdk.CreateTaskRequest
7474
if!httpapi.Read(ctx,w,r,&req) {
7575
return

‎cli/task_delete.go‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,10 @@ func (r *RootCmd) taskDelete() *serpent.Command {
4444
iferr!=nil {
4545
returnerr
4646
}
47-
exp:=codersdk.NewExperimentalClient(client)
4847

4948
vartasks []codersdk.Task
5049
for_,identifier:=rangeinv.Args {
51-
task,err:=exp.TaskByIdentifier(ctx,identifier)
50+
task,err:=client.TaskByIdentifier(ctx,identifier)
5251
iferr!=nil {
5352
returnxerrors.Errorf("resolve task %q: %w",identifier,err)
5453
}
@@ -71,7 +70,7 @@ func (r *RootCmd) taskDelete() *serpent.Command {
7170

7271
fori,task:=rangetasks {
7372
display:=displayList[i]
74-
iferr:=exp.DeleteTask(ctx,task.OwnerName,task.ID);err!=nil {
73+
iferr:=client.DeleteTask(ctx,task.OwnerName,task.ID);err!=nil {
7574
returnxerrors.Errorf("delete task %q: %w",display,err)
7675
}
7776
_,_=fmt.Fprintln(

‎cli/task_delete_test.go‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@ func TestExpTaskDelete(t *testing.T) {
5656
taskID:=uuid.MustParse(id1)
5757
returnfunc(w http.ResponseWriter,r*http.Request) {
5858
switch {
59-
caser.Method==http.MethodGet&&r.URL.Path=="/api/experimental/tasks/me/exists":
59+
caser.Method==http.MethodGet&&r.URL.Path=="/api/v2/tasks/me/exists":
6060
c.nameResolves.Add(1)
6161
httpapi.Write(r.Context(),w,http.StatusOK,
6262
codersdk.Task{
6363
ID:taskID,
6464
Name:"exists",
6565
OwnerName:"me",
6666
})
67-
caser.Method==http.MethodDelete&&r.URL.Path=="/api/experimental/tasks/me/"+id1:
67+
caser.Method==http.MethodDelete&&r.URL.Path=="/api/v2/tasks/me/"+id1:
6868
c.deleteCalls.Add(1)
6969
w.WriteHeader(http.StatusAccepted)
7070
default:
@@ -82,13 +82,13 @@ func TestExpTaskDelete(t *testing.T) {
8282
buildHandler:func(c*testCounters) http.HandlerFunc {
8383
returnfunc(w http.ResponseWriter,r*http.Request) {
8484
switch {
85-
caser.Method==http.MethodGet&&r.URL.Path=="/api/experimental/tasks/me/"+id2:
85+
caser.Method==http.MethodGet&&r.URL.Path=="/api/v2/tasks/me/"+id2:
8686
httpapi.Write(r.Context(),w,http.StatusOK, codersdk.Task{
8787
ID:uuid.MustParse(id2),
8888
OwnerName:"me",
8989
Name:"uuid-task",
9090
})
91-
caser.Method==http.MethodDelete&&r.URL.Path=="/api/experimental/tasks/me/"+id2:
91+
caser.Method==http.MethodDelete&&r.URL.Path=="/api/v2/tasks/me/"+id2:
9292
c.deleteCalls.Add(1)
9393
w.WriteHeader(http.StatusAccepted)
9494
default:
@@ -104,24 +104,24 @@ func TestExpTaskDelete(t *testing.T) {
104104
buildHandler:func(c*testCounters) http.HandlerFunc {
105105
returnfunc(w http.ResponseWriter,r*http.Request) {
106106
switch {
107-
caser.Method==http.MethodGet&&r.URL.Path=="/api/experimental/tasks/me/first":
107+
caser.Method==http.MethodGet&&r.URL.Path=="/api/v2/tasks/me/first":
108108
c.nameResolves.Add(1)
109109
httpapi.Write(r.Context(),w,http.StatusOK, codersdk.Task{
110110
ID:uuid.MustParse(id3),
111111
Name:"first",
112112
OwnerName:"me",
113113
})
114-
caser.Method==http.MethodGet&&r.URL.Path=="/api/experimental/tasks/me/"+id4:
114+
caser.Method==http.MethodGet&&r.URL.Path=="/api/v2/tasks/me/"+id4:
115115
c.nameResolves.Add(1)
116116
httpapi.Write(r.Context(),w,http.StatusOK, codersdk.Task{
117117
ID:uuid.MustParse(id4),
118118
OwnerName:"me",
119119
Name:"uuid-task-4",
120120
})
121-
caser.Method==http.MethodDelete&&r.URL.Path=="/api/experimental/tasks/me/"+id3:
121+
caser.Method==http.MethodDelete&&r.URL.Path=="/api/v2/tasks/me/"+id3:
122122
c.deleteCalls.Add(1)
123123
w.WriteHeader(http.StatusAccepted)
124-
caser.Method==http.MethodDelete&&r.URL.Path=="/api/experimental/tasks/me/"+id4:
124+
caser.Method==http.MethodDelete&&r.URL.Path=="/api/v2/tasks/me/"+id4:
125125
c.deleteCalls.Add(1)
126126
w.WriteHeader(http.StatusAccepted)
127127
default:
@@ -140,7 +140,7 @@ func TestExpTaskDelete(t *testing.T) {
140140
buildHandler:func(_*testCounters) http.HandlerFunc {
141141
returnfunc(w http.ResponseWriter,r*http.Request) {
142142
switch {
143-
caser.Method==http.MethodGet&&r.URL.Path=="/api/experimental/tasks"&&r.URL.Query().Get("q")=="owner:\"me\"":
143+
caser.Method==http.MethodGet&&r.URL.Path=="/api/v2/tasks"&&r.URL.Query().Get("q")=="owner:\"me\"":
144144
httpapi.Write(r.Context(),w,http.StatusOK,struct {
145145
Tasks []codersdk.Task`json:"tasks"`
146146
Countint`json:"count"`
@@ -163,14 +163,14 @@ func TestExpTaskDelete(t *testing.T) {
163163
taskID:=uuid.MustParse(id5)
164164
returnfunc(w http.ResponseWriter,r*http.Request) {
165165
switch {
166-
caser.Method==http.MethodGet&&r.URL.Path=="/api/experimental/tasks/me/bad":
166+
caser.Method==http.MethodGet&&r.URL.Path=="/api/v2/tasks/me/bad":
167167
c.nameResolves.Add(1)
168168
httpapi.Write(r.Context(),w,http.StatusOK, codersdk.Task{
169169
ID:taskID,
170170
Name:"bad",
171171
OwnerName:"me",
172172
})
173-
caser.Method==http.MethodDelete&&r.URL.Path=="/api/experimental/tasks/me/bad":
173+
caser.Method==http.MethodDelete&&r.URL.Path=="/api/v2/tasks/me/bad":
174174
httpapi.InternalServerError(w,xerrors.New("boom"))
175175
default:
176176
httpapi.InternalServerError(w,xerrors.New("unwanted path: "+r.Method+" "+r.URL.Path))

‎cli/task_list.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,13 @@ func (r *RootCmd) taskList() *serpent.Command {
135135
}
136136

137137
ctx:=inv.Context()
138-
exp:=codersdk.NewExperimentalClient(client)
139138

140139
targetUser:=strings.TrimSpace(user)
141140
iftargetUser==""&&!all {
142141
targetUser=codersdk.Me
143142
}
144143

145-
tasks,err:=exp.Tasks(ctx,&codersdk.TasksFilter{
144+
tasks,err:=client.Tasks(ctx,&codersdk.TasksFilter{
146145
Owner:targetUser,
147146
Status:codersdk.TaskStatus(statusFilter),
148147
})

‎cli/task_logs.go‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,15 @@ func (r *RootCmd) taskLogs() *serpent.Command {
4141

4242
var (
4343
ctx=inv.Context()
44-
exp=codersdk.NewExperimentalClient(client)
4544
identifier=inv.Args[0]
4645
)
4746

48-
task,err:=exp.TaskByIdentifier(ctx,identifier)
47+
task,err:=client.TaskByIdentifier(ctx,identifier)
4948
iferr!=nil {
5049
returnxerrors.Errorf("resolve task %q: %w",identifier,err)
5150
}
5251

53-
logs,err:=exp.TaskLogs(ctx,codersdk.Me,task.ID)
52+
logs,err:=client.TaskLogs(ctx,codersdk.Me,task.ID)
5453
iferr!=nil {
5554
returnxerrors.Errorf("get task logs: %w",err)
5655
}

‎cli/task_send.go‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ func (r *RootCmd) taskSend() *serpent.Command {
3939

4040
var (
4141
ctx=inv.Context()
42-
exp=codersdk.NewExperimentalClient(client)
4342
identifier=inv.Args[0]
4443

4544
taskInputstring
@@ -60,12 +59,12 @@ func (r *RootCmd) taskSend() *serpent.Command {
6059
taskInput=inv.Args[1]
6160
}
6261

63-
task,err:=exp.TaskByIdentifier(ctx,identifier)
62+
task,err:=client.TaskByIdentifier(ctx,identifier)
6463
iferr!=nil {
6564
returnxerrors.Errorf("resolve task: %w",err)
6665
}
6766

68-
iferr=exp.TaskSend(ctx,codersdk.Me,task.ID, codersdk.TaskSendRequest{Input:taskInput});err!=nil {
67+
iferr=client.TaskSend(ctx,codersdk.Me,task.ID, codersdk.TaskSendRequest{Input:taskInput});err!=nil {
6968
returnxerrors.Errorf("send input to task: %w",err)
7069
}
7170

‎cli/task_status.go‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,9 @@ func (r *RootCmd) taskStatus() *serpent.Command {
8383
}
8484

8585
ctx:=i.Context()
86-
exp:=codersdk.NewExperimentalClient(client)
8786
identifier:=i.Args[0]
8887

89-
task,err:=exp.TaskByIdentifier(ctx,identifier)
88+
task,err:=client.TaskByIdentifier(ctx,identifier)
9089
iferr!=nil {
9190
returnerr
9291
}
@@ -107,7 +106,7 @@ func (r *RootCmd) taskStatus() *serpent.Command {
107106
// TODO: implement streaming updates instead of polling
108107
lastStatusRow:=tsr
109108
forranget.C {
110-
task,err:=exp.TaskByID(ctx,task.ID)
109+
task,err:=client.TaskByID(ctx,task.ID)
111110
iferr!=nil {
112111
returnerr
113112
}

‎cli/task_status_test.go‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func Test_TaskStatus(t *testing.T) {
3636
hf:func(ctx context.Context,_ time.Time)func(w http.ResponseWriter,r*http.Request) {
3737
returnfunc(w http.ResponseWriter,r*http.Request) {
3838
switchr.URL.Path {
39-
case"/api/experimental/tasks/me/doesnotexist":
39+
case"/api/v2/tasks/me/doesnotexist":
4040
httpapi.ResourceNotFound(w)
4141
return
4242
default:
@@ -52,7 +52,7 @@ func Test_TaskStatus(t *testing.T) {
5252
hf:func(ctx context.Context,now time.Time)func(w http.ResponseWriter,r*http.Request) {
5353
returnfunc(w http.ResponseWriter,r*http.Request) {
5454
switchr.URL.Path {
55-
case"/api/experimental/tasks/me/exists":
55+
case"/api/v2/tasks/me/exists":
5656
httpapi.Write(ctx,w,http.StatusOK, codersdk.Task{
5757
ID:uuid.MustParse("11111111-1111-1111-1111-111111111111"),
5858
WorkspaceStatus:codersdk.WorkspaceStatusRunning,
@@ -88,7 +88,7 @@ func Test_TaskStatus(t *testing.T) {
8888
varcalls atomic.Int64
8989
returnfunc(w http.ResponseWriter,r*http.Request) {
9090
switchr.URL.Path {
91-
case"/api/experimental/tasks/me/exists":
91+
case"/api/v2/tasks/me/exists":
9292
httpapi.Write(ctx,w,http.StatusOK, codersdk.Task{
9393
ID:uuid.MustParse("11111111-1111-1111-1111-111111111111"),
9494
Name:"exists",
@@ -103,7 +103,7 @@ func Test_TaskStatus(t *testing.T) {
103103
Status:codersdk.TaskStatusPending,
104104
})
105105
return
106-
case"/api/experimental/tasks/me/11111111-1111-1111-1111-111111111111":
106+
case"/api/v2/tasks/me/11111111-1111-1111-1111-111111111111":
107107
defercalls.Add(1)
108108
switchcalls.Load() {
109109
case0:
@@ -219,7 +219,7 @@ func Test_TaskStatus(t *testing.T) {
219219
ts:=time.Date(2025,8,26,12,34,56,0,time.UTC)
220220
returnfunc(w http.ResponseWriter,r*http.Request) {
221221
switchr.URL.Path {
222-
case"/api/experimental/tasks/me/exists":
222+
case"/api/v2/tasks/me/exists":
223223
httpapi.Write(ctx,w,http.StatusOK, codersdk.Task{
224224
ID:uuid.MustParse("11111111-1111-1111-1111-111111111111"),
225225
Name:"exists",

‎cli/task_test.go‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ func Test_Tasks(t *testing.T) {
122122
assertFn:func(stdoutstring,userClient*codersdk.Client) {
123123
// The task should eventually no longer show up in the list of tasks
124124
testutil.Eventually(ctx,t,func(ctx context.Context)bool {
125-
expClient:=codersdk.NewExperimentalClient(userClient)
126-
tasks,err:=expClient.Tasks(ctx,&codersdk.TasksFilter{})
125+
tasks,err:=userClient.Tasks(ctx,&codersdk.TasksFilter{})
127126
if!assert.NoError(t,err) {
128127
returnfalse
129128
}
@@ -248,8 +247,7 @@ func setupCLITaskTest(ctx context.Context, t *testing.T, agentAPIHandlers map[st
248247
template:=createAITaskTemplate(t,client,owner.OrganizationID,withSidebarURL(fakeAPI.URL()),withAgentToken(authToken))
249248

250249
wantPrompt:="test prompt"
251-
exp:=codersdk.NewExperimentalClient(userClient)
252-
task,err:=exp.CreateTask(ctx,codersdk.Me, codersdk.CreateTaskRequest{
250+
task,err:=userClient.CreateTask(ctx,codersdk.Me, codersdk.CreateTaskRequest{
253251
TemplateVersionID:template.ActiveVersionID,
254252
Input:wantPrompt,
255253
Name:"test-task",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp