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

Commit8c3e53e

Browse files
committed
Merge branch 'main' of github.com:/coder/coder into dk/enable-prebuilds
2 parents793cf74 +118f12a commit8c3e53e

File tree

5 files changed

+14
-17
lines changed

5 files changed

+14
-17
lines changed

‎coderd/prebuilds/noop.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ func (NoopClaimer) Claim(context.Context, uuid.UUID, string, uuid.UUID) (*uuid.U
2929
// Not entitled to claim prebuilds in AGPL version.
3030
returnnil,ErrNoClaimablePrebuiltWorkspaces
3131
}
32-
func (NoopClaimer)Initiator() uuid.UUID {returnuuid.Nil }
32+
func (NoopClaimer)Initiator() uuid.UUID {
33+
returnuuid.Nil
34+
}
3335

3436
varDefaultClaimerClaimer=NoopClaimer{}

‎coderd/workspaces.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -876,15 +876,13 @@ func requestTemplate(ctx context.Context, rw http.ResponseWriter, req codersdk.C
876876
}
877877

878878
funcclaimPrebuild(ctx context.Context,claimer prebuilds.Claimer,db database.Store,logger slog.Logger,req codersdk.CreateWorkspaceRequest,ownerworkspaceOwner) (*database.Workspace,error) {
879-
prebuildsCtx:=dbauthz.AsPrebuildsOrchestrator(ctx)
880-
881-
claimedID,err:=claimer.Claim(prebuildsCtx,owner.ID,req.Name,req.TemplateVersionPresetID)
879+
claimedID,err:=claimer.Claim(ctx,owner.ID,req.Name,req.TemplateVersionPresetID)
882880
iferr!=nil {
883881
// TODO: enhance this by clarifying whether this *specific* prebuild failed or whether there are none to claim.
884882
returnnil,xerrors.Errorf("claim prebuild: %w",err)
885883
}
886884

887-
lookup,err:=db.GetWorkspaceByID(prebuildsCtx,*claimedID)
885+
lookup,err:=db.GetWorkspaceByID(ctx,*claimedID)
888886
iferr!=nil {
889887
logger.Error(ctx,"unable to find claimed workspace by ID",slog.Error(err),slog.F("claimed_prebuild_id",claimedID.String()))
890888
returnnil,xerrors.Errorf("find claimed workspace by ID %q: %w",claimedID.String(),err)

‎enterprise/coderd/prebuilds/claim_test.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package prebuilds_test
33
import (
44
"context"
55
"database/sql"
6+
"slices"
67
"strings"
78
"sync/atomic"
89
"testing"
@@ -125,7 +126,7 @@ func TestClaimPrebuild(t *testing.T) {
125126
t.Parallel()
126127

127128
// Setup.
128-
ctx:=testutil.Context(t,testutil.WaitMedium)
129+
ctx:=testutil.Context(t,testutil.WaitSuperLong)
129130
db,pubsub:=dbtestutil.NewDB(t)
130131
spy:=newStoreSpy(db)
131132
expectedPrebuildsCount:=desiredInstances*presetCount
@@ -250,13 +251,9 @@ func TestClaimPrebuild(t *testing.T) {
250251
require.Equal(t,expectedPrebuildsCount-1,len(currentPrebuilds))
251252

252253
// Then: the claimed prebuild is now missing from the running prebuilds set.
253-
varfoundbool
254-
for_,prebuild:=rangecurrentPrebuilds {
255-
ifprebuild.ID==claimed.ID {
256-
found=true
257-
break
258-
}
259-
}
254+
found:=slices.ContainsFunc(currentPrebuilds,func(prebuild database.GetRunningPrebuiltWorkspacesRow)bool {
255+
returnprebuild.ID==claimed.ID
256+
})
260257
require.False(t,found,"claimed prebuild should not still be considered a running prebuild")
261258

262259
// Then: reconciling at this point will provision a new prebuild to replace the claimed one.
@@ -407,7 +404,7 @@ func TestClaimPrebuild_CheckDifferentErrors(t *testing.T) {
407404
t.Parallel()
408405

409406
// Setup.
410-
ctx:=testutil.Context(t,testutil.WaitMedium)
407+
ctx:=testutil.Context(t,testutil.WaitSuperLong)
411408
db,pubsub:=dbtestutil.NewDB(t)
412409
errorStore:=newErrorStore(db,tc.claimingErr)
413410

‎go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ require (
164164
github.com/pkg/browserv0.0.0-20240102092130-5ac0b6a4141c
165165
github.com/pkg/diffv0.0.0-20210226163009-20ebb0f2a09e
166166
github.com/pkg/sftpv1.13.7
167-
github.com/prometheus-community/pro-bingv0.6.0
167+
github.com/prometheus-community/pro-bingv0.7.0
168168
github.com/prometheus/client_golangv1.22.0
169169
github.com/prometheus/client_modelv0.6.1
170170
github.com/prometheus/commonv0.63.0

‎go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,8 +1671,8 @@ github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndr
16711671
github.com/power-devops/perfstatv0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
16721672
github.com/power-devops/perfstatv0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU=
16731673
github.com/power-devops/perfstatv0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
1674-
github.com/prometheus-community/pro-bingv0.6.0 h1:04SZ/092gONTE1XUFzYFWqgB4mKwcdkqNChLMFedwhg=
1675-
github.com/prometheus-community/pro-bingv0.6.0/go.mod h1:jNCOI3D7pmTCeaoF41cNS6uaxeFY/Gmc3ffwbuJVzAQ=
1674+
github.com/prometheus-community/pro-bingv0.7.0 h1:KFYFbxC2f2Fp6c+TyxbCOEarf7rbnzr9Gw8eIb0RfZA=
1675+
github.com/prometheus-community/pro-bingv0.7.0/go.mod h1:Moob9dvlY50Bfq6i88xIwfyw7xLFHH69LUgx9n5zqCE=
16761676
github.com/prometheus/client_golangv1.22.0 h1:rb93p9lokFEsctTys46VnV1kLCDpVZ0a/Y92Vm0Zc6Q=
16771677
github.com/prometheus/client_golangv1.22.0/go.mod h1:R7ljNsLXhuQXYZYtw6GAE9AZg8Y7vEW5scdCXrWRXC0=
16781678
github.com/prometheus/client_modelv0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp