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

Commit6769a71

Browse files
committed
chore: add experiment toggle for terraform workspace caching
1 parentf798c44 commit6769a71

File tree

6 files changed

+22
-0
lines changed

6 files changed

+22
-0
lines changed

‎cli/server.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,6 +1476,7 @@ func newProvisionerDaemon(
14761476
Listener:terraformServer,
14771477
Logger:provisionerLogger,
14781478
WorkDirectory:workDir,
1479+
Experiments:coderAPI.Experiments,
14791480
},
14801481
CachePath:tfDir,
14811482
Tracer:tracer,

‎codersdk/deployment.go‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3635,6 +3635,8 @@ const (
36353635
ExperimentOAuth2Experiment="oauth2"// Enables OAuth2 provider functionality.
36363636
ExperimentMCPServerHTTPExperiment="mcp-server-http"// Enables the MCP HTTP server functionality.
36373637
ExperimentWorkspaceSharingExperiment="workspace-sharing"// Enables updating workspace ACLs for sharing with users and groups.
3638+
// ExperimentTerraformWorkspace is named after the "Terraform Workspaces" feature, not to be confused with Coder Workspaces.
3639+
ExperimentTerraformWorkspaceExperiment="terraform-workspaces"// Enables reuse of existing terraform directory for builds
36383640
)
36393641

36403642
func (eExperiment)DisplayName()string {
@@ -3655,6 +3657,8 @@ func (e Experiment) DisplayName() string {
36553657
return"MCP HTTP Server Functionality"
36563658
caseExperimentWorkspaceSharing:
36573659
return"Workspace Sharing"
3660+
caseExperimentTerraformWorkspace:
3661+
return"Terraform Workspace Caching"
36583662
default:
36593663
// Split on hyphen and convert to title case
36603664
// e.g. "web-push" -> "Web Push", "mcp-server-http" -> "Mcp Server Http"

‎enterprise/cli/provisionerdaemonstart.go‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"github.com/coder/coder/v2/cli/clilog"
2424
"github.com/coder/coder/v2/cli/cliui"
2525
"github.com/coder/coder/v2/cli/cliutil"
26+
"github.com/coder/coder/v2/coderd"
2627
"github.com/coder/coder/v2/coderd/database"
2728
"github.com/coder/coder/v2/codersdk"
2829
"github.com/coder/coder/v2/codersdk/drpcsdk"
@@ -48,6 +49,7 @@ func (r *RootCmd) provisionerDaemonStart() *serpent.Command {
4849
preSharedKeystring
4950
provisionerKeystring
5051
verbosebool
52+
experiments []string
5153

5254
prometheusEnablebool
5355
prometheusAddressstring
@@ -186,6 +188,7 @@ func (r *RootCmd) provisionerDaemonStart() *serpent.Command {
186188
Listener:terraformServer,
187189
Logger:logger.Named("terraform"),
188190
WorkDirectory:tempDir,
191+
Experiments:coderd.ReadExperiments(logger,experiments),
189192
},
190193
CachePath:cacheDir,
191194
})
@@ -378,6 +381,14 @@ func (r *RootCmd) provisionerDaemonStart() *serpent.Command {
378381
Value:serpent.StringOf(&prometheusAddress),
379382
Default:"127.0.0.1:2112",
380383
},
384+
{
385+
Name:"Experiments",
386+
Description:"Enable one or more experiments. These are not ready for production. Separate multiple experiments with commas, or enter '*' to opt-in to all available experiments.",
387+
Flag:"experiments",
388+
Env:"CODER_EXPERIMENTS",
389+
Value:serpent.StringArrayOf(&experiments),
390+
YAML:"experiments",
391+
},
381392
}
382393
orgContext.AttachOptions(cmd)
383394

‎enterprise/coderd/coderdenttest/coderdenttest.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ func newExternalProvisionerDaemon(t testing.TB, client *codersdk.Client, org uui
414414
ServeOptions:&provisionersdk.ServeOptions{
415415
Listener:provisionerSrv,
416416
WorkDirectory:t.TempDir(),
417+
Experiments: codersdk.Experiments{},
417418
},
418419
}))
419420
}()

‎provisionersdk/serve.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"storj.io/drpc/drpcserver"
1616

1717
"cdr.dev/slog"
18+
"github.com/coder/coder/v2/codersdk"
1819
"github.com/coder/coder/v2/codersdk/drpcsdk"
1920

2021
"github.com/coder/coder/v2/coderd/tracing"
@@ -30,6 +31,7 @@ type ServeOptions struct {
3031
Logger slog.Logger
3132
WorkDirectorystring
3233
ExternalProvisionerbool
34+
Experiments codersdk.Experiments
3335
}
3436

3537
typeServerinterface {

‎provisionersdk/session.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,13 @@ func (p *protoServer) Session(stream proto.DRPCProvisioner_SessionStream) error
6767
s.logLevel=proto.LogLevel_value[strings.ToUpper(s.Config.ProvisionerLogLevel)]
6868
}
6969

70+
// Extract the template source archive into the work directory.
7071
err=s.Files.ExtractArchive(s.Context(),s.Logger,afero.NewOsFs(),s.Config)
7172
iferr!=nil {
7273
returnxerrors.Errorf("extract archive: %w",err)
7374
}
75+
76+
// Handle requests, which will amount to terraform cli execs.
7477
returns.handleRequests()
7578
}
7679

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp