diff --git a/cli/agent_test.go b/cli/agent_test.go index 2d98eab12ba28..a2c79ceae2753 100644 --- a/cli/agent_test.go +++ b/cli/agent_test.go @@ -30,7 +30,7 @@ func TestWorkspaceAgent(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ @@ -93,7 +93,7 @@ func TestWorkspaceAgent(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ @@ -156,7 +156,7 @@ func TestWorkspaceAgent(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ diff --git a/cli/configssh_test.go b/cli/configssh_test.go index 66fb02daf5e83..d8fcae980b08c 100644 --- a/cli/configssh_test.go +++ b/cli/configssh_test.go @@ -68,7 +68,7 @@ func TestConfigSSH(t *testing.T) { authToken := uuid.NewString() version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - ProvisionDryRun: []*proto.Provision_Response{{ + ProvisionPlan: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ @@ -82,7 +82,7 @@ func TestConfigSSH(t *testing.T) { }, }, }}, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ @@ -662,9 +662,9 @@ func TestConfigSSH_Hostnames(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) // authToken := uuid.NewString() version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - ProvisionDryRun: provisionResponse, - Provision: provisionResponse, + Parse: echo.ParseComplete, + ProvisionPlan: provisionResponse, + ProvisionApply: provisionResponse, }) coderdtest.AwaitTemplateVersionJob(t, client, version.ID) template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID) diff --git a/cli/create_test.go b/cli/create_test.go index 806b365f0ec82..ce5f922258158 100644 --- a/cli/create_test.go +++ b/cli/create_test.go @@ -26,9 +26,9 @@ func TestCreate(t *testing.T) { client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true}) user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - Provision: provisionCompleteWithAgent, - ProvisionDryRun: provisionCompleteWithAgent, + Parse: echo.ParseComplete, + ProvisionApply: provisionCompleteWithAgent, + ProvisionPlan: provisionCompleteWithAgent, }) coderdtest.AwaitTemplateVersionJob(t, client, version.ID) template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID) @@ -144,9 +144,9 @@ func TestCreate(t *testing.T) { defaultValue := "something" version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: createTestParseResponseWithDefault(defaultValue), - Provision: echo.ProvisionComplete, - ProvisionDryRun: echo.ProvisionComplete, + Parse: createTestParseResponseWithDefault(defaultValue), + ProvisionApply: echo.ProvisionComplete, + ProvisionPlan: echo.ProvisionComplete, }) coderdtest.AwaitTemplateVersionJob(t, client, version.ID) @@ -185,9 +185,9 @@ func TestCreate(t *testing.T) { defaultValue := "something" version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: createTestParseResponseWithDefault(defaultValue), - Provision: echo.ProvisionComplete, - ProvisionDryRun: echo.ProvisionComplete, + Parse: createTestParseResponseWithDefault(defaultValue), + ProvisionApply: echo.ProvisionComplete, + ProvisionPlan: echo.ProvisionComplete, }) coderdtest.AwaitTemplateVersionJob(t, client, version.ID) @@ -228,9 +228,9 @@ func TestCreate(t *testing.T) { defaultValue := "something" version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: createTestParseResponseWithDefault(defaultValue), - Provision: echo.ProvisionComplete, - ProvisionDryRun: echo.ProvisionComplete, + Parse: createTestParseResponseWithDefault(defaultValue), + ProvisionApply: echo.ProvisionComplete, + ProvisionPlan: echo.ProvisionComplete, }) coderdtest.AwaitTemplateVersionJob(t, client, version.ID) template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID) @@ -264,7 +264,7 @@ func TestCreate(t *testing.T) { }, }, }}, - ProvisionDryRun: []*proto.Provision_Response{ + ProvisionPlan: []*proto.Provision_Response{ { Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{}, diff --git a/cli/gitssh_test.go b/cli/gitssh_test.go index 566877a8c0429..8d7420b9b0d89 100644 --- a/cli/gitssh_test.go +++ b/cli/gitssh_test.go @@ -48,9 +48,9 @@ func prepareTestGitSSH(ctx context.Context, t *testing.T) (*codersdk.Client, str // setup template agentToken := uuid.NewString() version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - ProvisionDryRun: echo.ProvisionComplete, - Provision: []*proto.Provision_Response{{ + Parse: echo.ParseComplete, + ProvisionPlan: echo.ProvisionComplete, + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ diff --git a/cli/portforward_test.go b/cli/portforward_test.go index 93719b2a13e5d..133bbf1f9a431 100644 --- a/cli/portforward_test.go +++ b/cli/portforward_test.go @@ -293,9 +293,9 @@ func runAgent(t *testing.T, client *codersdk.Client, userID uuid.UUID) codersdk. // Setup template agentToken := uuid.NewString() version := coderdtest.CreateTemplateVersion(t, client, orgID, &echo.Responses{ - Parse: echo.ParseComplete, - ProvisionDryRun: echo.ProvisionComplete, - Provision: []*proto.Provision_Response{{ + Parse: echo.ParseComplete, + ProvisionPlan: echo.ProvisionComplete, + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ diff --git a/cli/show_test.go b/cli/show_test.go index d7d5679951135..088c0c21e60d8 100644 --- a/cli/show_test.go +++ b/cli/show_test.go @@ -18,9 +18,9 @@ func TestShow(t *testing.T) { client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true}) user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - Provision: provisionCompleteWithAgent, - ProvisionDryRun: provisionCompleteWithAgent, + Parse: echo.ParseComplete, + ProvisionApply: provisionCompleteWithAgent, + ProvisionPlan: provisionCompleteWithAgent, }) coderdtest.AwaitTemplateVersionJob(t, client, version.ID) template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID) diff --git a/cli/ssh_test.go b/cli/ssh_test.go index e6eef88fe5469..27d1335bdfb57 100644 --- a/cli/ssh_test.go +++ b/cli/ssh_test.go @@ -42,9 +42,9 @@ func setupWorkspaceForAgent(t *testing.T, mutate func([]*proto.Agent) []*proto.A user := coderdtest.CreateFirstUser(t, client) agentToken := uuid.NewString() version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - ProvisionDryRun: echo.ProvisionComplete, - Provision: []*proto.Provision_Response{{ + Parse: echo.ParseComplete, + ProvisionPlan: echo.ProvisionComplete, + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ diff --git a/cli/state_test.go b/cli/state_test.go index b1482191c8609..5d05313eb5414 100644 --- a/cli/state_test.go +++ b/cli/state_test.go @@ -25,7 +25,7 @@ func TestStatePull(t *testing.T) { wantState := []byte("some state") version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ State: wantState, @@ -53,7 +53,7 @@ func TestStatePull(t *testing.T) { wantState := []byte("some state") version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ State: wantState, @@ -82,8 +82,8 @@ func TestStatePush(t *testing.T) { client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true}) user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - Provision: echo.ProvisionComplete, + Parse: echo.ParseComplete, + ProvisionApply: echo.ProvisionComplete, }) coderdtest.AwaitTemplateVersionJob(t, client, version.ID) template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID) @@ -107,8 +107,8 @@ func TestStatePush(t *testing.T) { client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true}) user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - Provision: echo.ProvisionComplete, + Parse: echo.ParseComplete, + ProvisionApply: echo.ProvisionComplete, }) coderdtest.AwaitTemplateVersionJob(t, client, version.ID) template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID) diff --git a/cli/templatecreate_test.go b/cli/templatecreate_test.go index 98af8158241d3..c19cbe8f0318d 100644 --- a/cli/templatecreate_test.go +++ b/cli/templatecreate_test.go @@ -43,8 +43,8 @@ func TestTemplateCreate(t *testing.T) { client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true}) coderdtest.CreateFirstUser(t, client) source := clitest.CreateTemplateVersionSource(t, &echo.Responses{ - Parse: echo.ParseComplete, - Provision: provisionCompleteWithAgent, + Parse: echo.ParseComplete, + ProvisionApply: provisionCompleteWithAgent, }) args := []string{ "templates", @@ -89,9 +89,9 @@ func TestTemplateCreate(t *testing.T) { client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true}) coderdtest.CreateFirstUser(t, client) source := clitest.CreateTemplateVersionSource(t, &echo.Responses{ - Parse: createTestParseResponse(), - Provision: echo.ProvisionComplete, - ProvisionDryRun: echo.ProvisionComplete, + Parse: createTestParseResponse(), + ProvisionApply: echo.ProvisionComplete, + ProvisionPlan: echo.ProvisionComplete, }) cmd, root := clitest.New(t, "templates", "create", "my-template", "--directory", source, "--test.provisioner", string(database.ProvisionerTypeEcho)) clitest.SetupConfig(t, client, root) @@ -125,9 +125,9 @@ func TestTemplateCreate(t *testing.T) { client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true}) coderdtest.CreateFirstUser(t, client) source := clitest.CreateTemplateVersionSource(t, &echo.Responses{ - Parse: createTestParseResponse(), - Provision: echo.ProvisionComplete, - ProvisionDryRun: echo.ProvisionComplete, + Parse: createTestParseResponse(), + ProvisionApply: echo.ProvisionComplete, + ProvisionPlan: echo.ProvisionComplete, }) tempDir := t.TempDir() removeTmpDirUntilSuccessAfterTest(t, tempDir) @@ -164,9 +164,9 @@ func TestTemplateCreate(t *testing.T) { client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true}) coderdtest.CreateFirstUser(t, client) source := clitest.CreateTemplateVersionSource(t, &echo.Responses{ - Parse: createTestParseResponse(), - Provision: echo.ProvisionComplete, - ProvisionDryRun: echo.ProvisionComplete, + Parse: createTestParseResponse(), + ProvisionApply: echo.ProvisionComplete, + ProvisionPlan: echo.ProvisionComplete, }) tempDir := t.TempDir() removeTmpDirUntilSuccessAfterTest(t, tempDir) @@ -204,8 +204,8 @@ func TestTemplateCreate(t *testing.T) { create := func() error { source := clitest.CreateTemplateVersionSource(t, &echo.Responses{ - Parse: echo.ParseComplete, - Provision: provisionCompleteWithAgent, + Parse: echo.ParseComplete, + ProvisionApply: provisionCompleteWithAgent, }) args := []string{ "templates", diff --git a/cli/templatepull_test.go b/cli/templatepull_test.go index 53cda41ed5fd5..0ae1fc740a43a 100644 --- a/cli/templatepull_test.go +++ b/cli/templatepull_test.go @@ -146,6 +146,6 @@ func genTemplateVersionSource() *echo.Responses { }, }, }, - Provision: echo.ProvisionComplete, + ProvisionApply: echo.ProvisionComplete, } } diff --git a/cli/templatepush_test.go b/cli/templatepush_test.go index a372fb987e1ce..4aa7867c0df8b 100644 --- a/cli/templatepush_test.go +++ b/cli/templatepush_test.go @@ -40,8 +40,8 @@ func TestTemplatePush(t *testing.T) { // Create new template version with a new parameter source := clitest.CreateTemplateVersionSource(t, &echo.Responses{ - Parse: createTestParseResponse(), - Provision: echo.ProvisionComplete, + Parse: createTestParseResponse(), + ProvisionApply: echo.ProvisionComplete, }) cmd, root := clitest.New(t, "templates", "push", template.Name, "-y", "--directory", source, "--test.provisioner", string(database.ProvisionerTypeEcho)) clitest.SetupConfig(t, client, root) @@ -91,8 +91,8 @@ func TestTemplatePush(t *testing.T) { // Remove the param source = clitest.CreateTemplateVersionSource(t, &echo.Responses{ - Parse: echo.ParseComplete, - Provision: echo.ProvisionComplete, + Parse: echo.ParseComplete, + ProvisionApply: echo.ProvisionComplete, }) cmd, root = clitest.New(t, "templates", "push", template.Name, "-y", "--directory", source, "--test.provisioner", string(database.ProvisionerTypeEcho)) @@ -119,8 +119,8 @@ func TestTemplatePush(t *testing.T) { // Test the cli command. source := clitest.CreateTemplateVersionSource(t, &echo.Responses{ - Parse: echo.ParseComplete, - Provision: echo.ProvisionComplete, + Parse: echo.ParseComplete, + ProvisionApply: echo.ProvisionComplete, }) cmd, root := clitest.New(t, "templates", "push", template.Name, "--directory", source, "--test.provisioner", string(database.ProvisionerTypeEcho), "--name", "example") clitest.SetupConfig(t, client, root) @@ -165,8 +165,8 @@ func TestTemplatePush(t *testing.T) { // Test the cli command. source := clitest.CreateTemplateVersionSource(t, &echo.Responses{ - Parse: echo.ParseComplete, - Provision: echo.ProvisionComplete, + Parse: echo.ParseComplete, + ProvisionApply: echo.ProvisionComplete, }) template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID, diff --git a/cli/update_test.go b/cli/update_test.go index 7d5807b275e01..73a30544d5ef6 100644 --- a/cli/update_test.go +++ b/cli/update_test.go @@ -52,9 +52,9 @@ func TestUpdate(t *testing.T) { require.Equal(t, version1.ID.String(), ws.LatestBuild.TemplateVersionID.String()) version2 := coderdtest.UpdateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - Provision: echo.ProvisionComplete, - ProvisionDryRun: echo.ProvisionComplete, + Parse: echo.ParseComplete, + ProvisionApply: echo.ProvisionComplete, + ProvisionPlan: echo.ProvisionComplete, }, template.ID) _ = coderdtest.AwaitTemplateVersionJob(t, client, version2.ID) @@ -100,9 +100,9 @@ func TestUpdate(t *testing.T) { defaultValue := "something" version2 := coderdtest.UpdateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: createTestParseResponseWithDefault(defaultValue), - Provision: echo.ProvisionComplete, - ProvisionDryRun: echo.ProvisionComplete, + Parse: createTestParseResponseWithDefault(defaultValue), + ProvisionApply: echo.ProvisionComplete, + ProvisionPlan: echo.ProvisionComplete, }, template.ID) coderdtest.AwaitTemplateVersionJob(t, client, version2.ID) diff --git a/coderd/coderdtest/authorize.go b/coderd/coderdtest/authorize.go index 0443e654ed1cb..7823054d88401 100644 --- a/coderd/coderdtest/authorize.go +++ b/coderd/coderdtest/authorize.go @@ -320,7 +320,7 @@ func NewAuthTester(ctx context.Context, t *testing.T, client *codersdk.Client, a // Setup some data in the database. version := CreateTemplateVersion(t, client, admin.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ // Return a workspace resource diff --git a/coderd/gitsshkey_test.go b/coderd/gitsshkey_test.go index 67fa7122bf4f1..60dc60ac5cb7e 100644 --- a/coderd/gitsshkey_test.go +++ b/coderd/gitsshkey_test.go @@ -109,9 +109,9 @@ func TestAgentGitSSHKey(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) authToken := uuid.NewString() version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - ProvisionDryRun: echo.ProvisionComplete, - Provision: []*proto.Provision_Response{{ + Parse: echo.ParseComplete, + ProvisionPlan: echo.ProvisionComplete, + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ diff --git a/coderd/parameters_test.go b/coderd/parameters_test.go index 450e0a26242e9..89bf2be8c4f77 100644 --- a/coderd/parameters_test.go +++ b/coderd/parameters_test.go @@ -160,7 +160,7 @@ func createTemplate(t *testing.T, client *codersdk.Client, user codersdk.CreateF instanceID := "instanceidentifier" version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ diff --git a/coderd/provisionerjobs_test.go b/coderd/provisionerjobs_test.go index d55374fef4c46..1e0b327d355e6 100644 --- a/coderd/provisionerjobs_test.go +++ b/coderd/provisionerjobs_test.go @@ -20,7 +20,7 @@ func TestProvisionerJobLogs(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Log{ Log: &proto.Log{ Level: proto.LogLevel_INFO, @@ -59,7 +59,7 @@ func TestProvisionerJobLogs(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Log{ Log: &proto.Log{ Level: proto.LogLevel_INFO, @@ -96,7 +96,7 @@ func TestProvisionerJobLogs(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Log{ Log: &proto.Log{ Level: proto.LogLevel_INFO, diff --git a/coderd/templates_test.go b/coderd/templates_test.go index a7f4e0ffce6da..94bc5383bf02a 100644 --- a/coderd/templates_test.go +++ b/coderd/templates_test.go @@ -515,9 +515,9 @@ func TestTemplateMetrics(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) authToken := uuid.NewString() version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - ProvisionDryRun: echo.ProvisionComplete, - Provision: []*proto.Provision_Response{{ + Parse: echo.ParseComplete, + ProvisionPlan: echo.ProvisionComplete, + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ diff --git a/coderd/templateversions_test.go b/coderd/templateversions_test.go index 02ed6f1b9f30e..193fc787822d4 100644 --- a/coderd/templateversions_test.go +++ b/coderd/templateversions_test.go @@ -97,9 +97,9 @@ func TestPostTemplateVersionsByOrganization(t *testing.T) { client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true, Auditor: auditor}) user := coderdtest.CreateFirstUser(t, client) data, err := echo.Tar(&echo.Responses{ - Parse: echo.ParseComplete, - Provision: echo.ProvisionComplete, - ProvisionDryRun: echo.ProvisionComplete, + Parse: echo.ParseComplete, + ProvisionApply: echo.ProvisionComplete, + ProvisionPlan: echo.ProvisionComplete, }) require.NoError(t, err) @@ -151,7 +151,7 @@ func TestPatchCancelTemplateVersion(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Log{ Log: &proto.Log{}, }, @@ -190,7 +190,7 @@ func TestPatchCancelTemplateVersion(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Log{ Log: &proto.Log{}, }, @@ -256,7 +256,7 @@ func TestTemplateVersionSchema(t *testing.T) { }, }, }}, - Provision: echo.ProvisionComplete, + ProvisionApply: echo.ProvisionComplete, }) coderdtest.AwaitTemplateVersionJob(t, client, version.ID) @@ -288,7 +288,7 @@ func TestTemplateVersionSchema(t *testing.T) { }, }, }}, - Provision: echo.ProvisionComplete, + ProvisionApply: echo.ProvisionComplete, }) coderdtest.AwaitTemplateVersionJob(t, client, version.ID) @@ -354,7 +354,7 @@ func TestTemplateVersionParameters(t *testing.T) { }, }, }}, - Provision: echo.ProvisionComplete, + ProvisionApply: echo.ProvisionComplete, }) coderdtest.AwaitTemplateVersionJob(t, client, version.ID) @@ -392,7 +392,7 @@ func TestTemplateVersionResources(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ @@ -430,9 +430,9 @@ func TestTemplateVersionLogs(t *testing.T) { client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true}) user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - ProvisionDryRun: echo.ProvisionComplete, - Provision: []*proto.Provision_Response{{ + Parse: echo.ParseComplete, + ProvisionPlan: echo.ProvisionComplete, + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Log{ Log: &proto.Log{ Level: proto.LogLevel_INFO, @@ -602,7 +602,7 @@ func TestTemplateVersionDryRun(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{ + ProvisionApply: []*proto.Provision_Response{ { Type: &proto.Provision_Response_Log{ Log: &proto.Log{}, @@ -671,7 +671,7 @@ func TestTemplateVersionDryRun(t *testing.T) { // This import job will never finish version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Log{ Log: &proto.Log{}, }, @@ -701,7 +701,7 @@ func TestTemplateVersionDryRun(t *testing.T) { version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{ + ProvisionApply: []*proto.Provision_Response{ { Type: &proto.Provision_Response_Log{ Log: &proto.Log{}, @@ -776,7 +776,7 @@ func TestTemplateVersionDryRun(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{ + ProvisionApply: []*proto.Provision_Response{ { Type: &proto.Provision_Response_Log{ Log: &proto.Log{}, diff --git a/coderd/workspaceagents_test.go b/coderd/workspaceagents_test.go index fcd13635ba772..9a3088711fe24 100644 --- a/coderd/workspaceagents_test.go +++ b/coderd/workspaceagents_test.go @@ -40,9 +40,9 @@ func TestWorkspaceAgent(t *testing.T) { authToken := uuid.NewString() tmpDir := t.TempDir() version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - ProvisionDryRun: echo.ProvisionComplete, - Provision: []*proto.Provision_Response{{ + Parse: echo.ParseComplete, + ProvisionPlan: echo.ProvisionComplete, + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ @@ -83,9 +83,9 @@ func TestWorkspaceAgent(t *testing.T) { authToken := uuid.NewString() tmpDir := t.TempDir() version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - ProvisionDryRun: echo.ProvisionComplete, - Provision: []*proto.Provision_Response{{ + Parse: echo.ParseComplete, + ProvisionPlan: echo.ProvisionComplete, + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ @@ -135,9 +135,9 @@ func TestWorkspaceAgentListen(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) authToken := uuid.NewString() version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - ProvisionDryRun: echo.ProvisionComplete, - Provision: []*proto.Provision_Response{{ + Parse: echo.ParseComplete, + ProvisionPlan: echo.ProvisionComplete, + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ @@ -196,9 +196,9 @@ func TestWorkspaceAgentListen(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) authToken := uuid.NewString() version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - ProvisionDryRun: echo.ProvisionComplete, - Provision: []*proto.Provision_Response{{ + Parse: echo.ParseComplete, + ProvisionPlan: echo.ProvisionComplete, + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ @@ -222,9 +222,9 @@ func TestWorkspaceAgentListen(t *testing.T) { coderdtest.AwaitWorkspaceBuildJob(t, client, workspace.LatestBuild.ID) version = coderdtest.UpdateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - ProvisionDryRun: echo.ProvisionComplete, - Provision: []*proto.Provision_Response{{ + Parse: echo.ParseComplete, + ProvisionPlan: echo.ProvisionComplete, + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ @@ -268,9 +268,9 @@ func TestWorkspaceAgentTailnet(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) authToken := uuid.NewString() version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - ProvisionDryRun: echo.ProvisionComplete, - Provision: []*proto.Provision_Response{{ + Parse: echo.ParseComplete, + ProvisionPlan: echo.ProvisionComplete, + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ @@ -335,9 +335,9 @@ func TestWorkspaceAgentPTY(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) authToken := uuid.NewString() version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - ProvisionDryRun: echo.ProvisionComplete, - Provision: []*proto.Provision_Response{{ + Parse: echo.ParseComplete, + ProvisionPlan: echo.ProvisionComplete, + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ @@ -431,9 +431,9 @@ func TestWorkspaceAgentListeningPorts(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) authToken := uuid.NewString() version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - ProvisionDryRun: echo.ProvisionComplete, - Provision: []*proto.Provision_Response{{ + Parse: echo.ParseComplete, + ProvisionPlan: echo.ProvisionComplete, + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ @@ -692,7 +692,7 @@ func TestWorkspaceAgentAppHealth(t *testing.T) { } version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ @@ -778,9 +778,9 @@ func TestWorkspaceAgentsGitAuth(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) authToken := uuid.NewString() version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - ProvisionDryRun: echo.ProvisionComplete, - Provision: []*proto.Provision_Response{{ + Parse: echo.ParseComplete, + ProvisionPlan: echo.ProvisionComplete, + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ @@ -823,9 +823,9 @@ func TestWorkspaceAgentsGitAuth(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) authToken := uuid.NewString() version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - ProvisionDryRun: echo.ProvisionComplete, - Provision: []*proto.Provision_Response{{ + Parse: echo.ParseComplete, + ProvisionPlan: echo.ProvisionComplete, + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ @@ -903,9 +903,9 @@ func TestWorkspaceAgentsGitAuth(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) authToken := uuid.NewString() version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - ProvisionDryRun: echo.ProvisionComplete, - Provision: []*proto.Provision_Response{{ + Parse: echo.ParseComplete, + ProvisionPlan: echo.ProvisionComplete, + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ diff --git a/coderd/workspaceapps_test.go b/coderd/workspaceapps_test.go index 55d76bca943cc..96cb864089d74 100644 --- a/coderd/workspaceapps_test.go +++ b/coderd/workspaceapps_test.go @@ -144,9 +144,9 @@ func createWorkspaceWithApps(t *testing.T, client *codersdk.Client, orgID uuid.U appURL := fmt.Sprintf("http://127.0.0.1:%d?%s", port, proxyTestAppQuery) version := coderdtest.CreateTemplateVersion(t, client, orgID, &echo.Responses{ - Parse: echo.ParseComplete, - ProvisionDryRun: echo.ProvisionComplete, - Provision: []*proto.Provision_Response{{ + Parse: echo.ParseComplete, + ProvisionPlan: echo.ProvisionComplete, + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ diff --git a/coderd/workspacebuilds_test.go b/coderd/workspacebuilds_test.go index 10245ce490bfc..6d3721dccc1fd 100644 --- a/coderd/workspacebuilds_test.go +++ b/coderd/workspacebuilds_test.go @@ -371,12 +371,12 @@ func TestPatchCancelWorkspaceBuild(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Log{ Log: &proto.Log{}, }, }}, - ProvisionDryRun: echo.ProvisionComplete, + ProvisionPlan: echo.ProvisionComplete, }) coderdtest.AwaitTemplateVersionJob(t, client, version.ID) template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID) @@ -412,7 +412,7 @@ func TestWorkspaceBuildResources(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ @@ -454,7 +454,7 @@ func TestWorkspaceBuildLogs(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Log{ Log: &proto.Log{ Level: proto.LogLevel_INFO, @@ -507,9 +507,9 @@ func TestWorkspaceBuildState(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) wantState := []byte("some kinda state") version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - ProvisionDryRun: echo.ProvisionComplete, - Provision: []*proto.Provision_Response{{ + Parse: echo.ParseComplete, + ProvisionPlan: echo.ProvisionComplete, + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ State: wantState, diff --git a/coderd/workspaceresourceauth_test.go b/coderd/workspaceresourceauth_test.go index 58d284e81ceb8..5e39aa02a977d 100644 --- a/coderd/workspaceresourceauth_test.go +++ b/coderd/workspaceresourceauth_test.go @@ -25,7 +25,7 @@ func TestPostWorkspaceAuthAzureInstanceIdentity(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ @@ -67,7 +67,7 @@ func TestPostWorkspaceAuthAWSInstanceIdentity(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ @@ -144,7 +144,7 @@ func TestPostWorkspaceAuthGoogleInstanceIdentity(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ diff --git a/coderd/workspaces_test.go b/coderd/workspaces_test.go index f0780a7cfc3fe..73a7ce19dd013 100644 --- a/coderd/workspaces_test.go +++ b/coderd/workspaces_test.go @@ -856,7 +856,7 @@ func TestPostWorkspaceBuild(t *testing.T) { client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true}) user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Provision: []*proto.Provision_Response{{}}, + ProvisionApply: []*proto.Provision_Response{{}}, }) template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID) coderdtest.AwaitTemplateVersionJob(t, client, version.ID) @@ -1304,9 +1304,9 @@ func TestWorkspaceWatcher(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) authToken := uuid.NewString() version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - ProvisionDryRun: echo.ProvisionComplete, - Provision: []*proto.Provision_Response{{ + Parse: echo.ParseComplete, + ProvisionPlan: echo.ProvisionComplete, + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ @@ -1406,7 +1406,7 @@ func TestWorkspaceResource(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ @@ -1474,7 +1474,7 @@ func TestWorkspaceResource(t *testing.T) { } version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ @@ -1531,7 +1531,7 @@ func TestWorkspaceResource(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ diff --git a/enterprise/coderd/workspaceagents_test.go b/enterprise/coderd/workspaceagents_test.go index 5965c702105ba..b103e8e2e4e41 100644 --- a/enterprise/coderd/workspaceagents_test.go +++ b/enterprise/coderd/workspaceagents_test.go @@ -69,7 +69,7 @@ func setupWorkspaceAgent(t *testing.T, client *codersdk.Client, user codersdk.Cr authToken := uuid.NewString() version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ diff --git a/enterprise/coderd/workspacequota_test.go b/enterprise/coderd/workspacequota_test.go index fb4f8f00b9dfd..450eeb35242e7 100644 --- a/enterprise/coderd/workspacequota_test.go +++ b/enterprise/coderd/workspacequota_test.go @@ -83,7 +83,7 @@ func TestWorkspaceQuota(t *testing.T) { authToken := uuid.NewString() version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ Parse: echo.ParseComplete, - Provision: []*proto.Provision_Response{{ + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ diff --git a/loadtest/agentconn/run_test.go b/loadtest/agentconn/run_test.go index e732e2484e1fb..5dfc5bb6c71a9 100644 --- a/loadtest/agentconn/run_test.go +++ b/loadtest/agentconn/run_test.go @@ -225,9 +225,9 @@ func setupRunnerTest(t *testing.T) (client *codersdk.Client, agentID uuid.UUID) authToken := uuid.NewString() version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - ProvisionDryRun: echo.ProvisionComplete, - Provision: []*proto.Provision_Response{{ + Parse: echo.ParseComplete, + ProvisionPlan: echo.ProvisionComplete, + ProvisionApply: []*proto.Provision_Response{{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: []*proto.Resource{{ diff --git a/loadtest/workspacebuild/run_test.go b/loadtest/workspacebuild/run_test.go index 770a609f4b159..b5dfb3f18687d 100644 --- a/loadtest/workspacebuild/run_test.go +++ b/loadtest/workspacebuild/run_test.go @@ -41,9 +41,9 @@ func Test_Runner(t *testing.T) { authToken2 := uuid.NewString() authToken3 := uuid.NewString() version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - ProvisionDryRun: echo.ProvisionComplete, - Provision: []*proto.Provision_Response{ + Parse: echo.ParseComplete, + ProvisionPlan: echo.ProvisionComplete, + ProvisionApply: []*proto.Provision_Response{ { Type: &proto.Provision_Response_Log{ Log: &proto.Log{ @@ -193,9 +193,9 @@ func Test_Runner(t *testing.T) { user := coderdtest.CreateFirstUser(t, client) version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ - Parse: echo.ParseComplete, - ProvisionDryRun: echo.ProvisionComplete, - Provision: []*proto.Provision_Response{ + Parse: echo.ParseComplete, + ProvisionPlan: echo.ProvisionComplete, + ProvisionApply: []*proto.Provision_Response{ { Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ diff --git a/provisioner/echo/serve.go b/provisioner/echo/serve.go index 934c715211675..6684b92c6ee94 100644 --- a/provisioner/echo/serve.go +++ b/provisioner/echo/serve.go @@ -116,13 +116,19 @@ func (e *echo) Provision(stream proto.DRPCProvisioner_ProvisionStream) error { if err != nil { return err } - request := msg.GetStart() - if request == nil { - // A cancel could occur here! + + var config *proto.Provision_Config + switch { + case msg.GetPlan() != nil: + config = msg.GetPlan().GetConfig() + case msg.GetApply() != nil: + config = msg.GetApply().GetConfig() + default: + // Probably a cancel return nil } - for _, param := range request.ParameterValues { + for _, param := range msg.GetPlan().GetParameterValues() { if param.Name == ParameterExecKey { toks := strings.Split(param.Value, "=") if len(toks) < 2 { @@ -139,11 +145,13 @@ func (e *echo) Provision(stream proto.DRPCProvisioner_ProvisionStream) error { } for index := 0; ; index++ { - extension := ".protobuf" - if request.DryRun { - extension = ".dry.protobuf" + var extension string + if msg.GetPlan() != nil { + extension = ".plan.protobuf" + } else { + extension = ".apply.protobuf" } - path := filepath.Join(request.Directory, fmt.Sprintf("%d.provision"+extension, index)) + path := filepath.Join(config.Directory, fmt.Sprintf("%d.provision"+extension, index)) _, err := e.filesystem.Stat(path) if err != nil { if index == 0 { @@ -175,9 +183,9 @@ func (*echo) Shutdown(_ context.Context, _ *proto.Empty) (*proto.Empty, error) { } type Responses struct { - Parse []*proto.Parse_Response - Provision []*proto.Provision_Response - ProvisionDryRun []*proto.Provision_Response + Parse []*proto.Parse_Response + ProvisionApply []*proto.Provision_Response + ProvisionPlan []*proto.Provision_Response } // Tar returns a tar archive of responses to provisioner operations. @@ -185,8 +193,8 @@ func Tar(responses *Responses) ([]byte, error) { if responses == nil { responses = &Responses{ParseComplete, ProvisionComplete, ProvisionComplete} } - if responses.ProvisionDryRun == nil { - responses.ProvisionDryRun = responses.Provision + if responses.ProvisionPlan == nil { + responses.ProvisionPlan = responses.ProvisionApply } var buffer bytes.Buffer @@ -208,13 +216,13 @@ func Tar(responses *Responses) ([]byte, error) { return nil, err } } - for index, response := range responses.Provision { + for index, response := range responses.ProvisionApply { data, err := protobuf.Marshal(response) if err != nil { return nil, err } err = writer.WriteHeader(&tar.Header{ - Name: fmt.Sprintf("%d.provision.protobuf", index), + Name: fmt.Sprintf("%d.provision.apply.protobuf", index), Size: int64(len(data)), }) if err != nil { @@ -225,13 +233,13 @@ func Tar(responses *Responses) ([]byte, error) { return nil, err } } - for index, response := range responses.ProvisionDryRun { + for index, response := range responses.ProvisionPlan { data, err := protobuf.Marshal(response) if err != nil { return nil, err } err = writer.WriteHeader(&tar.Header{ - Name: fmt.Sprintf("%d.provision.dry.protobuf", index), + Name: fmt.Sprintf("%d.provision.plan.protobuf", index), Size: int64(len(data)), }) if err != nil { diff --git a/provisioner/echo/serve_test.go b/provisioner/echo/serve_test.go index cad2755f2a027..f7f822c394474 100644 --- a/provisioner/echo/serve_test.go +++ b/provisioner/echo/serve_test.go @@ -92,15 +92,17 @@ func TestEcho(t *testing.T) { }, }} data, err := echo.Tar(&echo.Responses{ - Provision: responses, + ProvisionApply: responses, }) require.NoError(t, err) client, err := api.Provision(ctx) require.NoError(t, err) err = client.Send(&proto.Provision_Request{ - Type: &proto.Provision_Request_Start{ - Start: &proto.Provision_Start{ - Directory: unpackTar(t, fs, data), + Type: &proto.Provision_Request_Plan{ + Plan: &proto.Provision_Plan{ + Config: &proto.Provision_Config{ + Directory: unpackTar(t, fs, data), + }, }, }, }) diff --git a/provisioner/terraform/executor.go b/provisioner/terraform/executor.go index db1dde3819bee..c39a33faacc9d 100644 --- a/provisioner/terraform/executor.go +++ b/provisioner/terraform/executor.go @@ -7,6 +7,7 @@ import ( "encoding/json" "fmt" "io" + "io/ioutil" "os" "os/exec" "path/filepath" @@ -76,6 +77,10 @@ func (e executor) execWriteOutput(ctx, killCtx context.Context, args, env []stri // #nosec cmd := exec.CommandContext(killCtx, e.binaryPath, args...) cmd.Dir = e.workdir + if env == nil { + // We don't want to passthrough host env when unset. + env = []string{} + } cmd.Env = env // We want logs to be written in the correct order, so we wrap all logging @@ -238,10 +243,15 @@ func (e executor) plan(ctx, killCtx context.Context, env, vars []string, logr lo if err != nil { return nil, err } + planFileByt, err := os.ReadFile(planfilePath) + if err != nil { + return nil, err + } return &proto.Provision_Response{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{ Resources: resources, + Plan: planFileByt, }, }, }, nil @@ -292,21 +302,26 @@ func (e executor) graph(ctx, killCtx context.Context) (string, error) { } // revive:disable-next-line:flag-parameter -func (e executor) apply(ctx, killCtx context.Context, env, vars []string, logr logSink, destroy bool, +func (e executor) apply( + ctx, killCtx context.Context, plan []byte, env []string, logr logSink, ) (*proto.Provision_Response, error) { + planFile, err := ioutil.TempFile("", "coder-terrafrom-plan") + if err != nil { + return nil, xerrors.Errorf("create plan file: %w", err) + } + _, err = planFile.Write(plan) + if err != nil { + return nil, xerrors.Errorf("write plan file: %w", err) + } + defer os.Remove(planFile.Name()) + args := []string{ "apply", "-no-color", "-auto-approve", "-input=false", "-json", - "-refresh=true", - } - if destroy { - args = append(args, "-destroy") - } - for _, variable := range vars { - args = append(args, "-var", variable) + planFile.Name(), } outWriter, doneOut := provisionLogWriter(logr) @@ -318,7 +333,7 @@ func (e executor) apply(ctx, killCtx context.Context, env, vars []string, logr l <-doneErr }() - err := e.execWriteOutput(ctx, killCtx, args, env, outWriter, errWriter) + err = e.execWriteOutput(ctx, killCtx, args, env, outWriter, errWriter) if err != nil { return nil, xerrors.Errorf("terraform apply: %w", err) } diff --git a/provisioner/terraform/provision.go b/provisioner/terraform/provision.go index 713f8766d16ed..a267085126f76 100644 --- a/provisioner/terraform/provision.go +++ b/provisioner/terraform/provision.go @@ -23,9 +23,21 @@ func (s *server) Provision(stream proto.DRPCProvisioner_ProvisionStream) error { if request.GetCancel() != nil { return nil } - // We expect the first message is start! - if request.GetStart() == nil { + + var ( + applyRequest = request.GetApply() + planRequest = request.GetPlan() + ) + + var ( + config *proto.Provision_Config + ) + if applyRequest == nil && planRequest == nil { return nil + } else if applyRequest != nil { + config = applyRequest.Config + } else if planRequest != nil { + config = planRequest.Config } // Create a context for graceful cancellation bound to the stream @@ -73,17 +85,16 @@ func (s *server) Provision(stream proto.DRPCProvisioner_ProvisionStream) error { logger: s.logger.Named("execution_logs"), stream: stream, } - start := request.GetStart() - e := s.executor(start.Directory) + e := s.executor(config.Directory) if err = e.checkMinVersion(ctx); err != nil { return err } logTerraformEnvVars(sink) - statefilePath := filepath.Join(start.Directory, "terraform.tfstate") - if len(start.State) > 0 { - err = os.WriteFile(statefilePath, start.State, 0o600) + statefilePath := filepath.Join(config.Directory, "terraform.tfstate") + if len(config.State) > 0 { + err = os.WriteFile(statefilePath, config.State, 0o600) if err != nil { return xerrors.Errorf("write statefile %q: %w", statefilePath, err) } @@ -94,7 +105,7 @@ func (s *server) Provision(stream proto.DRPCProvisioner_ProvisionStream) error { // e.g. bad template param values and cannot be deleted. This is just for // contingency, in the future we will try harder to prevent workspaces being // broken this hard. - if start.Metadata.WorkspaceTransition == proto.WorkspaceTransition_DESTROY && len(start.State) == 0 { + if config.Metadata.WorkspaceTransition == proto.WorkspaceTransition_DESTROY && len(config.State) == 0 { _ = stream.Send(&proto.Provision_Response{ Type: &proto.Provision_Response_Log{ Log: &proto.Log{ @@ -127,24 +138,23 @@ func (s *server) Provision(stream proto.DRPCProvisioner_ProvisionStream) error { } s.logger.Debug(ctx, "ran initialization") - env, err := provisionEnv(start) - if err != nil { - return err - } - vars, err := provisionVars(start) + env, err := provisionEnv(config, request.GetPlan().GetParameterValues()) if err != nil { return err } + var resp *proto.Provision_Response - if start.DryRun { - resp, err = e.plan(ctx, killCtx, env, vars, sink, - start.Metadata.WorkspaceTransition == proto.WorkspaceTransition_DESTROY) - } else { - resp, err = e.apply(ctx, killCtx, env, vars, sink, - start.Metadata.WorkspaceTransition == proto.WorkspaceTransition_DESTROY) - } - if err != nil { - if start.DryRun { + if planRequest != nil { + vars, err := planVars(planRequest) + if err != nil { + return err + } + + resp, err = e.plan( + ctx, killCtx, env, vars, sink, + config.Metadata.WorkspaceTransition == proto.WorkspaceTransition_DESTROY, + ) + if err != nil { if ctx.Err() != nil { return stream.Send(&proto.Provision_Response{ Type: &proto.Provision_Response_Complete{ @@ -156,6 +166,13 @@ func (s *server) Provision(stream proto.DRPCProvisioner_ProvisionStream) error { } return xerrors.Errorf("plan terraform: %w", err) } + return stream.Send(resp) + } + // Must be apply + resp, err = e.apply( + ctx, killCtx, applyRequest.Plan, env, sink, + ) + if err != nil { errorMessage := err.Error() // Terraform can fail and apply and still need to store it's state. // In this case, we return Complete with an explicit error message. @@ -169,13 +186,12 @@ func (s *server) Provision(stream proto.DRPCProvisioner_ProvisionStream) error { }, }) } - return stream.Send(resp) } -func provisionVars(start *proto.Provision_Start) ([]string, error) { +func planVars(plan *proto.Provision_Plan) ([]string, error) { vars := []string{} - for _, param := range start.ParameterValues { + for _, param := range plan.ParameterValues { switch param.DestinationScheme { case proto.ParameterDestination_ENVIRONMENT_VARIABLE: continue @@ -188,21 +204,21 @@ func provisionVars(start *proto.Provision_Start) ([]string, error) { return vars, nil } -func provisionEnv(start *proto.Provision_Start) ([]string, error) { +func provisionEnv(config *proto.Provision_Config, params []*proto.ParameterValue) ([]string, error) { env := safeEnviron() env = append(env, - "CODER_AGENT_URL="+start.Metadata.CoderUrl, - "CODER_WORKSPACE_TRANSITION="+strings.ToLower(start.Metadata.WorkspaceTransition.String()), - "CODER_WORKSPACE_NAME="+start.Metadata.WorkspaceName, - "CODER_WORKSPACE_OWNER="+start.Metadata.WorkspaceOwner, - "CODER_WORKSPACE_OWNER_EMAIL="+start.Metadata.WorkspaceOwnerEmail, - "CODER_WORKSPACE_ID="+start.Metadata.WorkspaceId, - "CODER_WORKSPACE_OWNER_ID="+start.Metadata.WorkspaceOwnerId, + "CODER_AGENT_URL="+config.Metadata.CoderUrl, + "CODER_WORKSPACE_TRANSITION="+strings.ToLower(config.Metadata.WorkspaceTransition.String()), + "CODER_WORKSPACE_NAME="+config.Metadata.WorkspaceName, + "CODER_WORKSPACE_OWNER="+config.Metadata.WorkspaceOwner, + "CODER_WORKSPACE_OWNER_EMAIL="+config.Metadata.WorkspaceOwnerEmail, + "CODER_WORKSPACE_ID="+config.Metadata.WorkspaceId, + "CODER_WORKSPACE_OWNER_ID="+config.Metadata.WorkspaceOwnerId, ) for key, value := range provisionersdk.AgentScriptEnv() { env = append(env, key+"="+value) } - for _, param := range start.ParameterValues { + for _, param := range params { switch param.DestinationScheme { case proto.ParameterDestination_ENVIRONMENT_VARIABLE: env = append(env, fmt.Sprintf("%s=%s", param.Name, param.Value)) diff --git a/provisioner/terraform/provision_test.go b/provisioner/terraform/provision_test.go index afac79d6777ad..b1d26627ac4b8 100644 --- a/provisioner/terraform/provision_test.go +++ b/provisioner/terraform/provision_test.go @@ -63,6 +63,30 @@ func setupProvisioner(t *testing.T, opts *provisionerServeOptions) (context.Cont return ctx, api } +func readProvisionLog(t *testing.T, response proto.DRPCProvisioner_ProvisionClient) ( + string, + *proto.Provision_Complete, +) { + var ( + logBuf strings.Builder + c *proto.Provision_Complete + ) + for { + msg, err := response.Recv() + require.NoError(t, err) + + if log := msg.GetLog(); log != nil { + t.Log(log.Level.String(), log.Output) + logBuf.WriteString(log.Output) + } + if c = msg.GetComplete(); c != nil { + require.Empty(t, c.Error) + break + } + } + return logBuf.String(), c +} + func TestProvision_Cancel(t *testing.T) { t.Parallel() if runtime.GOOS == "windows" { @@ -113,16 +137,12 @@ func TestProvision_Cancel(t *testing.T) { response, err := api.Provision(ctx) require.NoError(t, err) err = response.Send(&proto.Provision_Request{ - Type: &proto.Provision_Request_Start{ - Start: &proto.Provision_Start{ - Directory: dir, - DryRun: false, - ParameterValues: []*proto.ParameterValue{{ - DestinationScheme: proto.ParameterDestination_PROVISIONER_VARIABLE, - Name: "A", - Value: "example", - }}, - Metadata: &proto.Provision_Metadata{}, + Type: &proto.Provision_Request_Apply{ + Apply: &proto.Provision_Apply{ + Config: &proto.Provision_Config{ + Directory: dir, + Metadata: &proto.Provision_Metadata{}, + }, }, }, }) @@ -175,7 +195,7 @@ func TestProvision(t *testing.T) { testCases := []struct { Name string Files map[string]string - Request *proto.Provision_Request + Request *proto.Provision_Plan // Response may be nil to not check the response. Response *proto.Provision_Response // If ErrorContains is not empty, then response.Recv() should return an @@ -183,7 +203,7 @@ func TestProvision(t *testing.T) { ErrorContains string // If ExpectLogContains is not empty, then the logs should contain it. ExpectLogContains string - DryRun bool + Apply bool }{ { Name: "single-variable", @@ -192,36 +212,26 @@ func TestProvision(t *testing.T) { description = "Testing!" }`, }, - Request: &proto.Provision_Request{ - Type: &proto.Provision_Request_Start{ - Start: &proto.Provision_Start{ - ParameterValues: []*proto.ParameterValue{{ - DestinationScheme: proto.ParameterDestination_PROVISIONER_VARIABLE, - Name: "A", - Value: "example", - }}, - }, - }, + Request: &proto.Provision_Plan{ + ParameterValues: []*proto.ParameterValue{{ + DestinationScheme: proto.ParameterDestination_PROVISIONER_VARIABLE, + Name: "A", + Value: "example", + }}, }, Response: &proto.Provision_Response{ Type: &proto.Provision_Response_Complete{ Complete: &proto.Provision_Complete{}, }, }, + Apply: true, }, { Name: "missing-variable", Files: map[string]string{ "main.tf": `variable "A" { - }`, - }, - Response: &proto.Provision_Response{ - Type: &proto.Provision_Response_Complete{ - Complete: &proto.Provision_Complete{ - Error: "terraform apply: exit status 1", - }, - }, - }, + }`}, + ErrorContains: "terraform plan:", ExpectLogContains: "No value for required variable", }, { @@ -232,7 +242,6 @@ func TestProvision(t *testing.T) { }, ErrorContains: "terraform plan:", ExpectLogContains: "No value for required variable", - DryRun: true, }, { Name: "single-resource-dry-run", @@ -249,7 +258,6 @@ func TestProvision(t *testing.T) { }, }, }, - DryRun: true, }, { Name: "single-resource", @@ -266,6 +274,7 @@ func TestProvision(t *testing.T) { }, }, }, + Apply: true, }, { Name: "bad-syntax-1", @@ -288,13 +297,10 @@ func TestProvision(t *testing.T) { Files: map[string]string{ "main.tf": `resource "null_resource" "A" {}`, }, - Request: &proto.Provision_Request{ - Type: &proto.Provision_Request_Start{ - Start: &proto.Provision_Start{ - State: nil, - Metadata: &proto.Provision_Metadata{ - WorkspaceTransition: proto.WorkspaceTransition_DESTROY, - }, + Request: &proto.Provision_Plan{ + Config: &proto.Provision_Config{ + Metadata: &proto.Provision_Metadata{ + WorkspaceTransition: proto.WorkspaceTransition_DESTROY, }, }, }, @@ -305,16 +311,12 @@ func TestProvision(t *testing.T) { Files: map[string]string{ "main.tf": "", }, - Request: &proto.Provision_Request{ - Type: &proto.Provision_Request_Start{ - Start: &proto.Provision_Start{ - ParameterValues: []*proto.ParameterValue{ - { - DestinationScheme: 88, - Name: "UNSUPPORTED", - Value: "sadface", - }, - }, + Request: &proto.Provision_Plan{ + ParameterValues: []*proto.ParameterValue{ + { + DestinationScheme: 88, + Name: "UNSUPPORTED", + Value: "sadface", }, }, }, @@ -333,79 +335,107 @@ func TestProvision(t *testing.T) { require.NoError(t, err) } - request := &proto.Provision_Request{ - Type: &proto.Provision_Request_Start{ - Start: &proto.Provision_Start{ - Directory: directory, - DryRun: testCase.DryRun, + planRequest := &proto.Provision_Request{ + Type: &proto.Provision_Request_Plan{ + Plan: &proto.Provision_Plan{ + Config: &proto.Provision_Config{ + Directory: directory, + }, }, }, } if testCase.Request != nil { - request.GetStart().ParameterValues = testCase.Request.GetStart().ParameterValues - request.GetStart().State = testCase.Request.GetStart().State - request.GetStart().DryRun = testCase.Request.GetStart().DryRun - request.GetStart().Metadata = testCase.Request.GetStart().Metadata + if planRequest.GetPlan().GetConfig() == nil { + planRequest.GetPlan().Config = &proto.Provision_Config{} + } + planRequest.GetPlan().ParameterValues = testCase.Request.ParameterValues + if testCase.Request.Config != nil { + planRequest.GetPlan().Config.State = testCase.Request.Config.State + planRequest.GetPlan().Config.Metadata = testCase.Request.Config.Metadata + } } - if request.GetStart().Metadata == nil { - request.GetStart().Metadata = &proto.Provision_Metadata{} + if planRequest.GetPlan().Config.Metadata == nil { + planRequest.GetPlan().Config.Metadata = &proto.Provision_Metadata{} } - response, err := api.Provision(ctx) - require.NoError(t, err) - err = response.Send(request) - require.NoError(t, err) + var ( + gotExpectedLog = testCase.ExpectLogContains == "" + ) - gotExpectedLog := testCase.ExpectLogContains == "" - for { - msg, err := response.Recv() - if msg != nil && msg.GetLog() != nil { - if testCase.ExpectLogContains != "" && strings.Contains(msg.GetLog().Output, testCase.ExpectLogContains) { - gotExpectedLog = true - } - - t.Logf("log: [%s] %s", msg.GetLog().Level, msg.GetLog().Output) - continue - } - if testCase.ErrorContains != "" { - require.ErrorContains(t, err, testCase.ErrorContains) - break - } + provision := func(req *proto.Provision_Request) *proto.Provision_Complete { + response, err := api.Provision(ctx) require.NoError(t, err) - - if msg.GetComplete() == nil { - continue - } - + err = response.Send(req) require.NoError(t, err) - // Remove randomly generated data. - for _, resource := range msg.GetComplete().Resources { - sort.Slice(resource.Agents, func(i, j int) bool { - return resource.Agents[i].Name < resource.Agents[j].Name - }) + var complete *proto.Provision_Complete - for _, agent := range resource.Agents { - agent.Id = "" - if agent.GetToken() == "" { - continue + for { + msg, err := response.Recv() + if msg != nil && msg.GetLog() != nil { + if testCase.ExpectLogContains != "" && strings.Contains(msg.GetLog().Output, testCase.ExpectLogContains) { + gotExpectedLog = true } - agent.Auth = &proto.Agent_Token{} - } - } - if testCase.Response != nil { - resourcesGot, err := json.Marshal(msg.GetComplete().Resources) + t.Logf("log: [%s] %s", msg.GetLog().Level, msg.GetLog().Output) + continue + } + if testCase.ErrorContains != "" { + require.ErrorContains(t, err, testCase.ErrorContains) + break + } require.NoError(t, err) - resourcesWant, err := json.Marshal(testCase.Response.GetComplete().Resources) + if complete = msg.GetComplete(); complete == nil { + continue + } + require.NoError(t, err) - require.Equal(t, testCase.Response.GetComplete().Error, msg.GetComplete().Error) + // Remove randomly generated data. + for _, resource := range msg.GetComplete().Resources { + sort.Slice(resource.Agents, func(i, j int) bool { + return resource.Agents[i].Name < resource.Agents[j].Name + }) + + for _, agent := range resource.Agents { + agent.Id = "" + if agent.GetToken() == "" { + continue + } + agent.Auth = &proto.Agent_Token{} + } + } + + if testCase.Response != nil { + resourcesGot, err := json.Marshal(msg.GetComplete().Resources) + require.NoError(t, err) + + resourcesWant, err := json.Marshal(testCase.Response.GetComplete().Resources) + require.NoError(t, err) - require.Equal(t, string(resourcesWant), string(resourcesGot)) + require.Equal(t, testCase.Response.GetComplete().Error, msg.GetComplete().Error) + + require.Equal(t, string(resourcesWant), string(resourcesGot)) + } + break } - break + + return complete + } + + planComplete := provision(planRequest) + + if testCase.Apply { + require.NotNil(t, planComplete.Plan) + provision(&proto.Provision_Request{ + Type: &proto.Provision_Request_Apply{ + Apply: &proto.Provision_Apply{ + Config: planRequest.GetPlan().GetConfig(), + Plan: planComplete.Plan, + }, + }, + }) } if !gotExpectedLog { @@ -430,11 +460,13 @@ func TestProvision_ExtraEnv(t *testing.T) { require.NoError(t, err) request := &proto.Provision_Request{ - Type: &proto.Provision_Request_Start{ - Start: &proto.Provision_Start{ - Directory: directory, - Metadata: &proto.Provision_Metadata{ - WorkspaceTransition: proto.WorkspaceTransition_START, + Type: &proto.Provision_Request_Plan{ + Plan: &proto.Provision_Plan{ + Config: &proto.Provision_Config{ + Directory: directory, + Metadata: &proto.Provision_Metadata{ + WorkspaceTransition: proto.WorkspaceTransition_START, + }, }, }, }, @@ -493,45 +525,43 @@ func TestProvision_SafeEnv(t *testing.T) { err := os.WriteFile(path, []byte(echoResource), 0o600) require.NoError(t, err) - request := &proto.Provision_Request{ - Type: &proto.Provision_Request_Start{ - Start: &proto.Provision_Start{ - Directory: directory, - Metadata: &proto.Provision_Metadata{ - WorkspaceTransition: proto.WorkspaceTransition_START, + response, err := api.Provision(ctx) + require.NoError(t, err) + err = response.Send(&proto.Provision_Request{ + Type: &proto.Provision_Request_Plan{ + Plan: &proto.Provision_Plan{ + Config: &proto.Provision_Config{ + Directory: directory, + Metadata: &proto.Provision_Metadata{ + WorkspaceTransition: proto.WorkspaceTransition_START, + }, }, }, }, - } - response, err := api.Provision(ctx) + }) require.NoError(t, err) - err = response.Send(request) + + _, complete := readProvisionLog(t, response) + + response, err = api.Provision(ctx) + require.NoError(t, err) + err = response.Send(&proto.Provision_Request{ + Type: &proto.Provision_Request_Apply{ + Apply: &proto.Provision_Apply{ + Config: &proto.Provision_Config{ + Directory: directory, + Metadata: &proto.Provision_Metadata{ + WorkspaceTransition: proto.WorkspaceTransition_START, + }, + }, + Plan: complete.GetPlan(), + }, + }, + }) require.NoError(t, err) - var ( - foundUserEnv = false - // Some CODER_ environment variables used by our Terraform provider - // must make it through. - foundCoderEnv = false - ) - for { - msg, err := response.Recv() - require.NoError(t, err) - if log := msg.GetLog(); log != nil { - t.Log(log.Level.String(), log.Output) - if strings.Contains(log.Output, passedValue) { - foundUserEnv = true - } - if strings.Contains(log.Output, "CODER_") { - foundCoderEnv = true - } - require.NotContains(t, log.Output, secretValue) - } - if c := msg.GetComplete(); c != nil { - require.Empty(t, c.Error) - break - } - } - require.True(t, foundUserEnv) - require.True(t, foundCoderEnv) + log, _ := readProvisionLog(t, response) + require.Contains(t, log, passedValue) + require.NotContains(t, log, secretValue) + require.Contains(t, log, "CODER_") } diff --git a/provisionerd/provisionerd.go b/provisionerd/provisionerd.go index a86476535f91b..6e0227696437d 100644 --- a/provisionerd/provisionerd.go +++ b/provisionerd/provisionerd.go @@ -322,16 +322,18 @@ func (p *Server) acquireJob(ctx context.Context) { p.activeJob = runner.New( ctx, job, - p, - p.opts.Logger, - p.opts.Filesystem, - p.opts.WorkDirectory, - provisioner, - p.opts.UpdateInterval, - p.opts.ForceCancelInterval, - p.opts.LogBufferInterval, - p.tracer, - p.opts.Metrics.Runner, + runner.Options{ + Updater: p, + Logger: p.opts.Logger, + Filesystem: p.opts.Filesystem, + WorkDirectory: p.opts.WorkDirectory, + Provisioner: provisioner, + UpdateInterval: p.opts.UpdateInterval, + ForceCancelInterval: p.opts.ForceCancelInterval, + LogDebounceInterval: p.opts.LogBufferInterval, + Tracer: p.tracer, + Metrics: p.opts.Metrics.Runner, + }, ) go p.activeJob.Run() diff --git a/provisionerd/provisionerd_test.go b/provisionerd/provisionerd_test.go index a65ae60c1150a..0a4e87b81f665 100644 --- a/provisionerd/provisionerd_test.go +++ b/provisionerd/provisionerd_test.go @@ -229,7 +229,7 @@ func TestProvisionerd(t *testing.T) { didComplete atomic.Bool didLog atomic.Bool didAcquireJob atomic.Bool - didDryRun atomic.Bool + didDryRun = atomic.NewBool(true) didReadme atomic.Bool completeChan = make(chan struct{}) completeOnce sync.Once @@ -299,8 +299,8 @@ func TestProvisionerd(t *testing.T) { provision: func(stream sdkproto.DRPCProvisioner_ProvisionStream) error { request, err := stream.Recv() require.NoError(t, err) - if request.GetStart().DryRun { - didDryRun.Store(true) + if request.GetApply() != nil { + didDryRun.Store(false) } err = stream.Send(&sdkproto.Provision_Response{ Type: &sdkproto.Provision_Response_Log{ diff --git a/provisionerd/runner/runner.go b/provisionerd/runner/runner.go index d32d5c8853162..81bb54e3fa894 100644 --- a/provisionerd/runner/runner.go +++ b/provisionerd/runner/runner.go @@ -86,19 +86,23 @@ type JobUpdater interface { CompleteJob(ctx context.Context, in *proto.CompletedJob) error } +type Options struct { + Updater JobUpdater + Logger slog.Logger + Filesystem afero.Fs + WorkDirectory string + Provisioner sdkproto.DRPCProvisionerClient + UpdateInterval time.Duration + ForceCancelInterval time.Duration + LogDebounceInterval time.Duration + Tracer trace.Tracer + Metrics Metrics +} + func New( ctx context.Context, job *proto.AcquiredJob, - updater JobUpdater, - logger slog.Logger, - filesystem afero.Fs, - workDirectory string, - provisioner sdkproto.DRPCProvisionerClient, - updateInterval time.Duration, - forceCancelInterval time.Duration, - logDebounceInterval time.Duration, - tracer trace.Tracer, - metrics Metrics, + opts Options, ) *Runner { m := new(sync.Mutex) @@ -107,17 +111,17 @@ func New( gracefulContext, cancelFunc := context.WithCancel(forceStopContext) return &Runner{ - tracer: tracer, - metrics: metrics, + tracer: opts.Tracer, + metrics: opts.Metrics, job: job, - sender: updater, - logger: logger.With(slog.F("job_id", job.JobId)), - filesystem: filesystem, - workDirectory: workDirectory, - provisioner: provisioner, - updateInterval: updateInterval, - forceCancelInterval: forceCancelInterval, - logBufferInterval: logDebounceInterval, + sender: opts.Updater, + logger: opts.Logger.With(slog.F("job_id", job.JobId)), + filesystem: opts.Filesystem, + workDirectory: opts.WorkDirectory, + provisioner: opts.Provisioner, + updateInterval: opts.UpdateInterval, + forceCancelInterval: opts.ForceCancelInterval, + logBufferInterval: opts.LogDebounceInterval, queuedLogs: make([]*proto.Log, 0), mutex: m, cond: sync.NewCond(m), @@ -667,12 +671,13 @@ func (r *Runner) runTemplateImportProvision(ctx context.Context, values []*sdkpr } }() err = stream.Send(&sdkproto.Provision_Request{ - Type: &sdkproto.Provision_Request_Start{ - Start: &sdkproto.Provision_Start{ - Directory: r.workDirectory, + Type: &sdkproto.Provision_Request_Plan{ + Plan: &sdkproto.Provision_Plan{ + Config: &sdkproto.Provision_Config{ + Directory: r.workDirectory, + Metadata: metadata, + }, ParameterValues: values, - DryRun: true, - Metadata: metadata, }, }, }) @@ -772,29 +777,11 @@ func (r *Runner) runTemplateDryRun(ctx context.Context) (*proto.CompletedJob, *p }, nil } -func (r *Runner) runWorkspaceBuild(ctx context.Context) (*proto.CompletedJob, *proto.FailedJob) { - ctx, span := r.startTrace(ctx, tracing.FuncName()) - defer span.End() - - var stage string - switch r.job.GetWorkspaceBuild().Metadata.WorkspaceTransition { - case sdkproto.WorkspaceTransition_START: - stage = "Starting workspace" - case sdkproto.WorkspaceTransition_STOP: - stage = "Stopping workspace" - case sdkproto.WorkspaceTransition_DESTROY: - stage = "Destroying workspace" - } - - r.queueLog(ctx, &proto.Log{ - Source: proto.LogSource_PROVISIONER_DAEMON, - Level: sdkproto.LogLevel_INFO, - Stage: stage, - CreatedAt: time.Now().UnixMilli(), - }) - - // use the notStopped so that if we attempt to gracefully cancel, the stream will still be available for us - // to send the cancel to the provisioner +func (r *Runner) buildWorkspace(ctx context.Context, stage string, req *sdkproto.Provision_Request) ( + *sdkproto.Provision_Complete, *proto.FailedJob, +) { + // use the notStopped so that if we attempt to gracefully cancel, the stream + // will still be available for us to send the cancel to the provisioner stream, err := r.provisioner.Provision(ctx) if err != nil { return nil, r.failedJobf("provision: %s", err) @@ -812,16 +799,8 @@ func (r *Runner) runWorkspaceBuild(ctx context.Context) (*proto.CompletedJob, *p }) } }() - err = stream.Send(&sdkproto.Provision_Request{ - Type: &sdkproto.Provision_Request_Start{ - Start: &sdkproto.Provision_Start{ - Directory: r.workDirectory, - ParameterValues: r.job.GetWorkspaceBuild().ParameterValues, - Metadata: r.job.GetWorkspaceBuild().Metadata, - State: r.job.GetWorkspaceBuild().State, - }, - }, - }) + + err = stream.Send(req) if err != nil { return nil, r.failedJobf("start provision: %s", err) } @@ -870,21 +849,76 @@ func (r *Runner) runWorkspaceBuild(ctx context.Context) (*proto.CompletedJob, *p slog.F("state_length", len(msgType.Complete.State)), ) // Stop looping! - return &proto.CompletedJob{ - JobId: r.job.JobId, - Type: &proto.CompletedJob_WorkspaceBuild_{ - WorkspaceBuild: &proto.CompletedJob_WorkspaceBuild{ - State: msgType.Complete.State, - Resources: msgType.Complete.Resources, - }, - }, - }, nil + return msgType.Complete, nil default: return nil, r.failedJobf("invalid message type %T received from provisioner", msg.Type) } } } +func (r *Runner) runWorkspaceBuild(ctx context.Context) (*proto.CompletedJob, *proto.FailedJob) { + ctx, span := r.startTrace(ctx, tracing.FuncName()) + defer span.End() + + var ( + applyStage string + ) + switch r.job.GetWorkspaceBuild().Metadata.WorkspaceTransition { + case sdkproto.WorkspaceTransition_START: + applyStage = "Starting workspace" + case sdkproto.WorkspaceTransition_STOP: + applyStage = "Stopping workspace" + case sdkproto.WorkspaceTransition_DESTROY: + applyStage = "Destroying workspace" + } + + r.queueLog(ctx, &proto.Log{ + Source: proto.LogSource_PROVISIONER_DAEMON, + Level: sdkproto.LogLevel_INFO, + Stage: applyStage, + CreatedAt: time.Now().UnixMilli(), + }) + config := &sdkproto.Provision_Config{ + Directory: r.workDirectory, + Metadata: r.job.GetWorkspaceBuild().Metadata, + State: r.job.GetWorkspaceBuild().State, + } + + completed, failed := r.buildWorkspace(ctx, "Planning infrastructure", &sdkproto.Provision_Request{ + Type: &sdkproto.Provision_Request_Plan{ + Plan: &sdkproto.Provision_Plan{ + Config: config, + ParameterValues: r.job.GetWorkspaceBuild().ParameterValues, + }, + }, + }) + if failed != nil { + return nil, failed + } + + completedApply, failed := r.buildWorkspace(ctx, applyStage, &sdkproto.Provision_Request{ + Type: &sdkproto.Provision_Request_Apply{ + Apply: &sdkproto.Provision_Apply{ + Config: config, + Plan: completed.GetPlan(), + }, + }, + }) + if failed != nil { + return nil, failed + } + + return &proto.CompletedJob{ + JobId: r.job.JobId, + Type: &proto.CompletedJob_WorkspaceBuild_{ + WorkspaceBuild: &proto.CompletedJob_WorkspaceBuild{ + State: completedApply.GetState(), + Resources: completedApply.GetResources(), + }, + }, + }, nil +} + func (r *Runner) failedJobf(format string, args ...interface{}) *proto.FailedJob { return &proto.FailedJob{ JobId: r.job.JobId, diff --git a/provisionersdk/proto/provisioner.pb.go b/provisionersdk/proto/provisioner.pb.go index 085fb1c3d5e9a..258ab419557d8 100644 --- a/provisionersdk/proto/provisioner.pb.go +++ b/provisionersdk/proto/provisioner.pb.go @@ -1092,6 +1092,7 @@ type Resource struct { Hide bool `protobuf:"varint,5,opt,name=hide,proto3" json:"hide,omitempty"` Icon string `protobuf:"bytes,6,opt,name=icon,proto3" json:"icon,omitempty"` InstanceType string `protobuf:"bytes,7,opt,name=instance_type,json=instanceType,proto3" json:"instance_type,omitempty"` + Cost int32 `protobuf:"varint,8,opt,name=cost,proto3" json:"cost,omitempty"` } func (x *Resource) Reset() { @@ -1175,6 +1176,13 @@ func (x *Resource) GetInstanceType() string { return "" } +func (x *Resource) GetCost() int32 { + if x != nil { + return x.Cost + } + return 0 +} + // Parse consumes source-code from a directory to produce inputs. type Parse struct { state protoimpl.MessageState @@ -1215,6 +1223,7 @@ func (*Parse) Descriptor() ([]byte, []int) { } // Provision consumes source-code from a directory to produce resources. +// Exactly one of Plan or Apply must be provided in a single session. type Provision struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1594,20 +1603,20 @@ func (x *Provision_Metadata) GetWorkspaceOwnerEmail() string { return "" } -type Provision_Start struct { +// Config represents execution configuration shared by both Plan and +// Apply commands. +type Provision_Config struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Directory string `protobuf:"bytes,1,opt,name=directory,proto3" json:"directory,omitempty"` - ParameterValues []*ParameterValue `protobuf:"bytes,2,rep,name=parameter_values,json=parameterValues,proto3" json:"parameter_values,omitempty"` - Metadata *Provision_Metadata `protobuf:"bytes,3,opt,name=metadata,proto3" json:"metadata,omitempty"` - State []byte `protobuf:"bytes,4,opt,name=state,proto3" json:"state,omitempty"` - DryRun bool `protobuf:"varint,5,opt,name=dry_run,json=dryRun,proto3" json:"dry_run,omitempty"` + Directory string `protobuf:"bytes,1,opt,name=directory,proto3" json:"directory,omitempty"` + State []byte `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"` + Metadata *Provision_Metadata `protobuf:"bytes,3,opt,name=metadata,proto3" json:"metadata,omitempty"` } -func (x *Provision_Start) Reset() { - *x = Provision_Start{} +func (x *Provision_Config) Reset() { + *x = Provision_Config{} if protoimpl.UnsafeEnabled { mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1615,13 +1624,13 @@ func (x *Provision_Start) Reset() { } } -func (x *Provision_Start) String() string { +func (x *Provision_Config) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Provision_Start) ProtoMessage() {} +func (*Provision_Config) ProtoMessage() {} -func (x *Provision_Start) ProtoReflect() protoreflect.Message { +func (x *Provision_Config) ProtoReflect() protoreflect.Message { mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1633,44 +1642,140 @@ func (x *Provision_Start) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Provision_Start.ProtoReflect.Descriptor instead. -func (*Provision_Start) Descriptor() ([]byte, []int) { +// Deprecated: Use Provision_Config.ProtoReflect.Descriptor instead. +func (*Provision_Config) Descriptor() ([]byte, []int) { return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{12, 1} } -func (x *Provision_Start) GetDirectory() string { +func (x *Provision_Config) GetDirectory() string { if x != nil { return x.Directory } return "" } -func (x *Provision_Start) GetParameterValues() []*ParameterValue { +func (x *Provision_Config) GetState() []byte { if x != nil { - return x.ParameterValues + return x.State } return nil } -func (x *Provision_Start) GetMetadata() *Provision_Metadata { +func (x *Provision_Config) GetMetadata() *Provision_Metadata { if x != nil { return x.Metadata } return nil } -func (x *Provision_Start) GetState() []byte { +type Provision_Plan struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Config *Provision_Config `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"` + ParameterValues []*ParameterValue `protobuf:"bytes,2,rep,name=parameter_values,json=parameterValues,proto3" json:"parameter_values,omitempty"` +} + +func (x *Provision_Plan) Reset() { + *x = Provision_Plan{} + if protoimpl.UnsafeEnabled { + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Provision_Plan) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Provision_Plan) ProtoMessage() {} + +func (x *Provision_Plan) ProtoReflect() protoreflect.Message { + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Provision_Plan.ProtoReflect.Descriptor instead. +func (*Provision_Plan) Descriptor() ([]byte, []int) { + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{12, 2} +} + +func (x *Provision_Plan) GetConfig() *Provision_Config { if x != nil { - return x.State + return x.Config } return nil } -func (x *Provision_Start) GetDryRun() bool { +func (x *Provision_Plan) GetParameterValues() []*ParameterValue { if x != nil { - return x.DryRun + return x.ParameterValues } - return false + return nil +} + +type Provision_Apply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Config *Provision_Config `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"` + Plan []byte `protobuf:"bytes,2,opt,name=plan,proto3" json:"plan,omitempty"` +} + +func (x *Provision_Apply) Reset() { + *x = Provision_Apply{} + if protoimpl.UnsafeEnabled { + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Provision_Apply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Provision_Apply) ProtoMessage() {} + +func (x *Provision_Apply) ProtoReflect() protoreflect.Message { + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Provision_Apply.ProtoReflect.Descriptor instead. +func (*Provision_Apply) Descriptor() ([]byte, []int) { + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{12, 3} +} + +func (x *Provision_Apply) GetConfig() *Provision_Config { + if x != nil { + return x.Config + } + return nil +} + +func (x *Provision_Apply) GetPlan() []byte { + if x != nil { + return x.Plan + } + return nil } type Provision_Cancel struct { @@ -1682,7 +1787,7 @@ type Provision_Cancel struct { func (x *Provision_Cancel) Reset() { *x = Provision_Cancel{} if protoimpl.UnsafeEnabled { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[20] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1695,7 +1800,7 @@ func (x *Provision_Cancel) String() string { func (*Provision_Cancel) ProtoMessage() {} func (x *Provision_Cancel) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[20] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1708,7 +1813,7 @@ func (x *Provision_Cancel) ProtoReflect() protoreflect.Message { // Deprecated: Use Provision_Cancel.ProtoReflect.Descriptor instead. func (*Provision_Cancel) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{12, 2} + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{12, 4} } type Provision_Request struct { @@ -1718,7 +1823,8 @@ type Provision_Request struct { // Types that are assignable to Type: // - // *Provision_Request_Start + // *Provision_Request_Plan + // *Provision_Request_Apply // *Provision_Request_Cancel Type isProvision_Request_Type `protobuf_oneof:"type"` } @@ -1726,7 +1832,7 @@ type Provision_Request struct { func (x *Provision_Request) Reset() { *x = Provision_Request{} if protoimpl.UnsafeEnabled { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[21] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1739,7 +1845,7 @@ func (x *Provision_Request) String() string { func (*Provision_Request) ProtoMessage() {} func (x *Provision_Request) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[21] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1752,7 +1858,7 @@ func (x *Provision_Request) ProtoReflect() protoreflect.Message { // Deprecated: Use Provision_Request.ProtoReflect.Descriptor instead. func (*Provision_Request) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{12, 3} + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{12, 5} } func (m *Provision_Request) GetType() isProvision_Request_Type { @@ -1762,9 +1868,16 @@ func (m *Provision_Request) GetType() isProvision_Request_Type { return nil } -func (x *Provision_Request) GetStart() *Provision_Start { - if x, ok := x.GetType().(*Provision_Request_Start); ok { - return x.Start +func (x *Provision_Request) GetPlan() *Provision_Plan { + if x, ok := x.GetType().(*Provision_Request_Plan); ok { + return x.Plan + } + return nil +} + +func (x *Provision_Request) GetApply() *Provision_Apply { + if x, ok := x.GetType().(*Provision_Request_Apply); ok { + return x.Apply } return nil } @@ -1780,15 +1893,21 @@ type isProvision_Request_Type interface { isProvision_Request_Type() } -type Provision_Request_Start struct { - Start *Provision_Start `protobuf:"bytes,1,opt,name=start,proto3,oneof"` +type Provision_Request_Plan struct { + Plan *Provision_Plan `protobuf:"bytes,1,opt,name=plan,proto3,oneof"` +} + +type Provision_Request_Apply struct { + Apply *Provision_Apply `protobuf:"bytes,2,opt,name=apply,proto3,oneof"` } type Provision_Request_Cancel struct { - Cancel *Provision_Cancel `protobuf:"bytes,2,opt,name=cancel,proto3,oneof"` + Cancel *Provision_Cancel `protobuf:"bytes,3,opt,name=cancel,proto3,oneof"` } -func (*Provision_Request_Start) isProvision_Request_Type() {} +func (*Provision_Request_Plan) isProvision_Request_Type() {} + +func (*Provision_Request_Apply) isProvision_Request_Type() {} func (*Provision_Request_Cancel) isProvision_Request_Type() {} @@ -1799,13 +1918,14 @@ type Provision_Complete struct { State []byte `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` + Plan []byte `protobuf:"bytes,4,opt,name=plan,proto3" json:"plan,omitempty"` Resources []*Resource `protobuf:"bytes,3,rep,name=resources,proto3" json:"resources,omitempty"` } func (x *Provision_Complete) Reset() { *x = Provision_Complete{} if protoimpl.UnsafeEnabled { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[22] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1818,7 +1938,7 @@ func (x *Provision_Complete) String() string { func (*Provision_Complete) ProtoMessage() {} func (x *Provision_Complete) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[22] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1831,7 +1951,7 @@ func (x *Provision_Complete) ProtoReflect() protoreflect.Message { // Deprecated: Use Provision_Complete.ProtoReflect.Descriptor instead. func (*Provision_Complete) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{12, 4} + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{12, 6} } func (x *Provision_Complete) GetState() []byte { @@ -1848,6 +1968,13 @@ func (x *Provision_Complete) GetError() string { return "" } +func (x *Provision_Complete) GetPlan() []byte { + if x != nil { + return x.Plan + } + return nil +} + func (x *Provision_Complete) GetResources() []*Resource { if x != nil { return x.Resources @@ -1870,7 +1997,7 @@ type Provision_Response struct { func (x *Provision_Response) Reset() { *x = Provision_Response{} if protoimpl.UnsafeEnabled { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[23] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1883,7 +2010,7 @@ func (x *Provision_Response) String() string { func (*Provision_Response) ProtoMessage() {} func (x *Provision_Response) ProtoReflect() protoreflect.Message { - mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[23] + mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[25] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1896,7 +2023,7 @@ func (x *Provision_Response) ProtoReflect() protoreflect.Message { // Deprecated: Use Provision_Response.ProtoReflect.Descriptor instead. func (*Provision_Response) Descriptor() ([]byte, []int) { - return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{12, 5} + return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{12, 7} } func (m *Provision_Response) GetType() isProvision_Response_Type { @@ -2074,7 +2201,7 @@ var file_provisionersdk_proto_provisioner_proto_rawDesc = []byte{ 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, - 0x68, 0x6f, 0x6c, 0x64, 0x22, 0xd2, 0x02, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x68, 0x6f, 0x6c, 0x64, 0x22, 0xe6, 0x02, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x06, 0x61, 0x67, 0x65, @@ -2088,114 +2215,128 @@ var file_provisionersdk_proto_provisioner_proto_rawDesc = []byte{ 0x04, 0x68, 0x69, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0c, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x1a, 0x69, - 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, - 0x12, 0x17, 0x0a, 0x07, 0x69, 0x73, 0x5f, 0x6e, 0x75, 0x6c, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x06, 0x69, 0x73, 0x4e, 0x75, 0x6c, 0x6c, 0x22, 0xfc, 0x01, 0x0a, 0x05, 0x50, 0x61, - 0x72, 0x73, 0x65, 0x1a, 0x27, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, - 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x1a, 0x55, 0x0a, 0x08, - 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x49, 0x0a, 0x11, 0x70, 0x61, 0x72, 0x61, - 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, - 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x52, 0x10, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, - 0x6d, 0x61, 0x73, 0x1a, 0x73, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x24, 0x0a, 0x03, 0x6c, 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, - 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x48, 0x00, - 0x52, 0x03, 0x6c, 0x6f, 0x67, 0x12, 0x39, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, - 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x70, - 0x6c, 0x65, 0x74, 0x65, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, - 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xae, 0x07, 0x0a, 0x09, 0x50, 0x72, 0x6f, - 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x1a, 0xd1, 0x02, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x5f, 0x75, 0x72, 0x6c, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x55, 0x72, 0x6c, - 0x12, 0x53, 0x0a, 0x14, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x74, 0x72, - 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, - 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x57, 0x6f, 0x72, - 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x13, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x77, - 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, - 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x77, 0x6f, 0x72, - 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x77, 0x6f, 0x72, 0x6b, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4f, - 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x32, 0x0a, 0x15, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x1a, 0xd9, 0x01, 0x0a, 0x05, 0x53, - 0x74, 0x61, 0x72, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, - 0x72, 0x79, 0x12, 0x46, 0x0a, 0x10, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, - 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0f, 0x70, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3b, 0x0a, 0x08, 0x6d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, - 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, - 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x17, 0x0a, - 0x07, 0x64, 0x72, 0x79, 0x5f, 0x72, 0x75, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, - 0x64, 0x72, 0x79, 0x52, 0x75, 0x6e, 0x1a, 0x08, 0x0a, 0x06, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, - 0x1a, 0x80, 0x01, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x05, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, - 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, - 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x12, 0x37, 0x0a, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, + 0x52, 0x0c, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x63, 0x6f, 0x73, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, + 0x73, 0x74, 0x1a, 0x69, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, + 0x69, 0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x65, 0x6e, 0x73, 0x69, + 0x74, 0x69, 0x76, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x73, 0x5f, 0x6e, 0x75, 0x6c, 0x6c, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x4e, 0x75, 0x6c, 0x6c, 0x22, 0xfc, 0x01, + 0x0a, 0x05, 0x50, 0x61, 0x72, 0x73, 0x65, 0x1a, 0x27, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, + 0x1a, 0x55, 0x0a, 0x08, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x49, 0x0a, 0x11, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, + 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x10, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, + 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x1a, 0x73, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x03, 0x6c, 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x4c, + 0x6f, 0x67, 0x48, 0x00, 0x52, 0x03, 0x6c, 0x6f, 0x67, 0x12, 0x39, 0x0a, 0x08, 0x63, 0x6f, 0x6d, + 0x70, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, + 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x2e, + 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x70, + 0x6c, 0x65, 0x74, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xf0, 0x08, 0x0a, + 0x09, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x1a, 0xd1, 0x02, 0x0a, 0x08, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6f, 0x64, 0x65, 0x72, + 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x64, 0x65, + 0x72, 0x55, 0x72, 0x6c, 0x12, 0x53, 0x0a, 0x14, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, + 0x65, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, + 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x77, 0x6f, 0x72, + 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0d, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x27, 0x0a, 0x0f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6f, 0x77, + 0x6e, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x77, 0x6f, 0x72, + 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x12, + 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, + 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x32, 0x0a, 0x15, 0x77, 0x6f, + 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x65, 0x6d, + 0x61, 0x69, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x1a, 0x79, + 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, + 0x63, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, 0x69, 0x72, + 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3b, 0x0a, 0x08, + 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, + 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, + 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x85, 0x01, 0x0a, 0x04, 0x50, 0x6c, + 0x61, 0x6e, 0x12, 0x35, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, - 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x61, 0x6e, 0x63, 0x65, - 0x6c, 0x48, 0x00, 0x52, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x42, 0x06, 0x0a, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x1a, 0x6b, 0x0a, 0x08, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x12, - 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, - 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x33, 0x0a, 0x09, 0x72, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, - 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, - 0x1a, 0x77, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x03, - 0x6c, 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x76, - 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x48, 0x00, 0x52, 0x03, 0x6c, - 0x6f, 0x67, 0x12, 0x3d, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, - 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6d, - 0x70, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, - 0x65, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x2a, 0x3f, 0x0a, 0x08, 0x4c, 0x6f, 0x67, - 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x09, 0x0a, 0x05, 0x54, 0x52, 0x41, 0x43, 0x45, 0x10, 0x00, - 0x12, 0x09, 0x0a, 0x05, 0x44, 0x45, 0x42, 0x55, 0x47, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x49, - 0x4e, 0x46, 0x4f, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x57, 0x41, 0x52, 0x4e, 0x10, 0x03, 0x12, - 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x04, 0x2a, 0x3b, 0x0a, 0x0f, 0x41, 0x70, - 0x70, 0x53, 0x68, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x09, 0x0a, - 0x05, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x41, 0x55, 0x54, 0x48, - 0x45, 0x4e, 0x54, 0x49, 0x43, 0x41, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x50, - 0x55, 0x42, 0x4c, 0x49, 0x43, 0x10, 0x02, 0x2a, 0x37, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6b, 0x73, - 0x70, 0x61, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x09, - 0x0a, 0x05, 0x53, 0x54, 0x41, 0x52, 0x54, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x54, 0x4f, - 0x50, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x45, 0x53, 0x54, 0x52, 0x4f, 0x59, 0x10, 0x02, - 0x32, 0xa3, 0x01, 0x0a, 0x0b, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, - 0x12, 0x42, 0x0a, 0x05, 0x50, 0x61, 0x72, 0x73, 0x65, 0x12, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x76, - 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x2e, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, - 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x30, 0x01, 0x12, 0x50, 0x0a, 0x09, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, - 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, - 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x28, 0x01, 0x30, 0x01, 0x42, 0x2d, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x72, - 0x2f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x73, 0x64, 0x6b, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x46, 0x0a, 0x10, 0x70, 0x61, 0x72, + 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, + 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x52, 0x0f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x1a, 0x52, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x12, 0x35, 0x0a, 0x06, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, + 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6c, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x04, 0x70, 0x6c, 0x61, 0x6e, 0x1a, 0x08, 0x0a, 0x06, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x1a, + 0xb3, 0x01, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x31, 0x0a, 0x04, 0x70, + 0x6c, 0x61, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x76, + 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x50, 0x6c, 0x61, 0x6e, 0x48, 0x00, 0x52, 0x04, 0x70, 0x6c, 0x61, 0x6e, 0x12, 0x34, + 0x0a, 0x05, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, + 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, + 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x48, 0x00, 0x52, 0x05, 0x61, + 0x70, 0x70, 0x6c, 0x79, 0x12, 0x37, 0x0a, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, + 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x61, 0x6e, + 0x63, 0x65, 0x6c, 0x48, 0x00, 0x52, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x42, 0x06, 0x0a, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x1a, 0x7f, 0x0a, 0x08, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, + 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x12, 0x0a, + 0x04, 0x70, 0x6c, 0x61, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x70, 0x6c, 0x61, + 0x6e, 0x12, 0x33, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, + 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x1a, 0x77, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x24, 0x0a, 0x03, 0x6c, 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x6f, + 0x67, 0x48, 0x00, 0x52, 0x03, 0x6c, 0x6f, 0x67, 0x12, 0x3d, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x70, + 0x6c, 0x65, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, + 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x00, 0x52, 0x08, 0x63, + 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x2a, + 0x3f, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x09, 0x0a, 0x05, 0x54, + 0x52, 0x41, 0x43, 0x45, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x44, 0x45, 0x42, 0x55, 0x47, 0x10, + 0x01, 0x12, 0x08, 0x0a, 0x04, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x57, + 0x41, 0x52, 0x4e, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x04, + 0x2a, 0x3b, 0x0a, 0x0f, 0x41, 0x70, 0x70, 0x53, 0x68, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x4c, 0x65, + 0x76, 0x65, 0x6c, 0x12, 0x09, 0x0a, 0x05, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x10, 0x00, 0x12, 0x11, + 0x0a, 0x0d, 0x41, 0x55, 0x54, 0x48, 0x45, 0x4e, 0x54, 0x49, 0x43, 0x41, 0x54, 0x45, 0x44, 0x10, + 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x10, 0x02, 0x2a, 0x37, 0x0a, + 0x13, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x54, 0x41, 0x52, 0x54, 0x10, 0x00, 0x12, + 0x08, 0x0a, 0x04, 0x53, 0x54, 0x4f, 0x50, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x45, 0x53, + 0x54, 0x52, 0x4f, 0x59, 0x10, 0x02, 0x32, 0xa3, 0x01, 0x0a, 0x0b, 0x50, 0x72, 0x6f, 0x76, 0x69, + 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x12, 0x42, 0x0a, 0x05, 0x50, 0x61, 0x72, 0x73, 0x65, 0x12, + 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, + 0x72, 0x73, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x72, + 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x2e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x50, 0x0a, 0x09, 0x50, 0x72, + 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, + 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, + 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x30, 0x01, 0x42, 0x2d, 0x5a, 0x2b, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x72, + 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, + 0x65, 0x72, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -2211,7 +2352,7 @@ func file_provisionersdk_proto_provisioner_proto_rawDescGZIP() []byte { } var file_provisionersdk_proto_provisioner_proto_enumTypes = make([]protoimpl.EnumInfo, 6) -var file_provisionersdk_proto_provisioner_proto_msgTypes = make([]protoimpl.MessageInfo, 24) +var file_provisionersdk_proto_provisioner_proto_msgTypes = make([]protoimpl.MessageInfo, 26) var file_provisionersdk_proto_provisioner_proto_goTypes = []interface{}{ (LogLevel)(0), // 0: provisioner.LogLevel (AppSharingLevel)(0), // 1: provisioner.AppSharingLevel @@ -2238,11 +2379,13 @@ var file_provisionersdk_proto_provisioner_proto_goTypes = []interface{}{ (*Parse_Complete)(nil), // 22: provisioner.Parse.Complete (*Parse_Response)(nil), // 23: provisioner.Parse.Response (*Provision_Metadata)(nil), // 24: provisioner.Provision.Metadata - (*Provision_Start)(nil), // 25: provisioner.Provision.Start - (*Provision_Cancel)(nil), // 26: provisioner.Provision.Cancel - (*Provision_Request)(nil), // 27: provisioner.Provision.Request - (*Provision_Complete)(nil), // 28: provisioner.Provision.Complete - (*Provision_Response)(nil), // 29: provisioner.Provision.Response + (*Provision_Config)(nil), // 25: provisioner.Provision.Config + (*Provision_Plan)(nil), // 26: provisioner.Provision.Plan + (*Provision_Apply)(nil), // 27: provisioner.Provision.Apply + (*Provision_Cancel)(nil), // 28: provisioner.Provision.Cancel + (*Provision_Request)(nil), // 29: provisioner.Provision.Request + (*Provision_Complete)(nil), // 30: provisioner.Provision.Complete + (*Provision_Response)(nil), // 31: provisioner.Provision.Response } var file_provisionersdk_proto_provisioner_proto_depIdxs = []int32{ 3, // 0: provisioner.ParameterSource.scheme:type_name -> provisioner.ParameterSource.Scheme @@ -2262,22 +2405,25 @@ var file_provisionersdk_proto_provisioner_proto_depIdxs = []int32{ 11, // 14: provisioner.Parse.Response.log:type_name -> provisioner.Log 22, // 15: provisioner.Parse.Response.complete:type_name -> provisioner.Parse.Complete 2, // 16: provisioner.Provision.Metadata.workspace_transition:type_name -> provisioner.WorkspaceTransition - 9, // 17: provisioner.Provision.Start.parameter_values:type_name -> provisioner.ParameterValue - 24, // 18: provisioner.Provision.Start.metadata:type_name -> provisioner.Provision.Metadata - 25, // 19: provisioner.Provision.Request.start:type_name -> provisioner.Provision.Start - 26, // 20: provisioner.Provision.Request.cancel:type_name -> provisioner.Provision.Cancel - 16, // 21: provisioner.Provision.Complete.resources:type_name -> provisioner.Resource - 11, // 22: provisioner.Provision.Response.log:type_name -> provisioner.Log - 28, // 23: provisioner.Provision.Response.complete:type_name -> provisioner.Provision.Complete - 21, // 24: provisioner.Provisioner.Parse:input_type -> provisioner.Parse.Request - 27, // 25: provisioner.Provisioner.Provision:input_type -> provisioner.Provision.Request - 23, // 26: provisioner.Provisioner.Parse:output_type -> provisioner.Parse.Response - 29, // 27: provisioner.Provisioner.Provision:output_type -> provisioner.Provision.Response - 26, // [26:28] is the sub-list for method output_type - 24, // [24:26] is the sub-list for method input_type - 24, // [24:24] is the sub-list for extension type_name - 24, // [24:24] is the sub-list for extension extendee - 0, // [0:24] is the sub-list for field type_name + 24, // 17: provisioner.Provision.Config.metadata:type_name -> provisioner.Provision.Metadata + 25, // 18: provisioner.Provision.Plan.config:type_name -> provisioner.Provision.Config + 9, // 19: provisioner.Provision.Plan.parameter_values:type_name -> provisioner.ParameterValue + 25, // 20: provisioner.Provision.Apply.config:type_name -> provisioner.Provision.Config + 26, // 21: provisioner.Provision.Request.plan:type_name -> provisioner.Provision.Plan + 27, // 22: provisioner.Provision.Request.apply:type_name -> provisioner.Provision.Apply + 28, // 23: provisioner.Provision.Request.cancel:type_name -> provisioner.Provision.Cancel + 16, // 24: provisioner.Provision.Complete.resources:type_name -> provisioner.Resource + 11, // 25: provisioner.Provision.Response.log:type_name -> provisioner.Log + 30, // 26: provisioner.Provision.Response.complete:type_name -> provisioner.Provision.Complete + 21, // 27: provisioner.Provisioner.Parse:input_type -> provisioner.Parse.Request + 29, // 28: provisioner.Provisioner.Provision:input_type -> provisioner.Provision.Request + 23, // 29: provisioner.Provisioner.Parse:output_type -> provisioner.Parse.Response + 31, // 30: provisioner.Provisioner.Provision:output_type -> provisioner.Provision.Response + 29, // [29:31] is the sub-list for method output_type + 27, // [27:29] is the sub-list for method input_type + 27, // [27:27] is the sub-list for extension type_name + 27, // [27:27] is the sub-list for extension extendee + 0, // [0:27] is the sub-list for field type_name } func init() { file_provisionersdk_proto_provisioner_proto_init() } @@ -2503,7 +2649,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Provision_Start); i { + switch v := v.(*Provision_Config); i { case 0: return &v.state case 1: @@ -2515,7 +2661,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Provision_Cancel); i { + switch v := v.(*Provision_Plan); i { case 0: return &v.state case 1: @@ -2527,7 +2673,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Provision_Request); i { + switch v := v.(*Provision_Apply); i { case 0: return &v.state case 1: @@ -2539,7 +2685,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Provision_Complete); i { + switch v := v.(*Provision_Cancel); i { case 0: return &v.state case 1: @@ -2551,6 +2697,30 @@ func file_provisionersdk_proto_provisioner_proto_init() { } } file_provisionersdk_proto_provisioner_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Provision_Request); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_provisionersdk_proto_provisioner_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Provision_Complete); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_provisionersdk_proto_provisioner_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Provision_Response); i { case 0: return &v.state @@ -2571,11 +2741,12 @@ func file_provisionersdk_proto_provisioner_proto_init() { (*Parse_Response_Log)(nil), (*Parse_Response_Complete)(nil), } - file_provisionersdk_proto_provisioner_proto_msgTypes[21].OneofWrappers = []interface{}{ - (*Provision_Request_Start)(nil), + file_provisionersdk_proto_provisioner_proto_msgTypes[23].OneofWrappers = []interface{}{ + (*Provision_Request_Plan)(nil), + (*Provision_Request_Apply)(nil), (*Provision_Request_Cancel)(nil), } - file_provisionersdk_proto_provisioner_proto_msgTypes[23].OneofWrappers = []interface{}{ + file_provisionersdk_proto_provisioner_proto_msgTypes[25].OneofWrappers = []interface{}{ (*Provision_Response_Log)(nil), (*Provision_Response_Complete)(nil), } @@ -2585,7 +2756,7 @@ func file_provisionersdk_proto_provisioner_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_provisionersdk_proto_provisioner_proto_rawDesc, NumEnums: 6, - NumMessages: 24, + NumMessages: 26, NumExtensions: 0, NumServices: 1, }, diff --git a/provisionersdk/proto/provisioner.proto b/provisionersdk/proto/provisioner.proto index 0f88705dd3e1b..468535402a27f 100644 --- a/provisionersdk/proto/provisioner.proto +++ b/provisionersdk/proto/provisioner.proto @@ -132,6 +132,7 @@ message Resource { bool hide = 5; string icon = 6; string instance_type = 7; + int32 cost = 8; } // Parse consumes source-code from a directory to produce inputs. @@ -157,6 +158,7 @@ enum WorkspaceTransition { } // Provision consumes source-code from a directory to produce resources. +// Exactly one of Plan or Apply must be provided in a single session. message Provision { message Metadata { string coder_url = 1; @@ -167,23 +169,37 @@ message Provision { string workspace_owner_id = 6; string workspace_owner_email = 7; } - message Start { + + // Config represents execution configuration shared by both Plan and + // Apply commands. + message Config { string directory = 1; - repeated ParameterValue parameter_values = 2; + bytes state = 2; Metadata metadata = 3; - bytes state = 4; - bool dry_run = 5; } + + message Plan { + Config config = 1; + repeated ParameterValue parameter_values = 2; + } + + message Apply { + Config config = 1; + bytes plan = 2; + } + message Cancel {} message Request { oneof type { - Start start = 1; - Cancel cancel = 2; + Plan plan = 1; + Apply apply = 2; + Cancel cancel = 3; } } message Complete { bytes state = 1; string error = 2; + bytes plan = 4; repeated Resource resources = 3; } message Response {