Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Prev Previous commit
Next Next commit
fix
  • Loading branch information
deansheather committed May 27, 2022
commit 4078fd112e0286fab9d1ea0e83768c9d3d9a10d7
1 change: 1 addition & 0 deletions cli/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ func create() *cobra.Command {
// Run a plan with the given parameters to check correctness
after := time.Now()
planJob, err := client.CreateTemplateVersionPlan(cmd.Context(), templateVersion.ID, codersdk.CreateTemplateVersionPlanRequest{
WorkspaceName: workspaceName,
ParameterValues: parameters,
})
if err != nil {
Expand Down
4 changes: 3 additions & 1 deletion coderd/provisionerdaemons.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ type workspaceProvisionJob struct {
// The input for a "template_version_plan" job.
type templateVersionPlanJob struct {
TemplateVersionID uuid.UUID `json:"template_version_id"`
WorkspaceName string `json:"workspace_name"`
ParameterValues []database.ParameterValue `json:"parameter_values"`
}

Expand Down Expand Up @@ -287,7 +288,8 @@ func (server *provisionerdServer) AcquireJob(ctx context.Context, _ *proto.Empty
TemplatePlan: &proto.AcquiredJob_TemplatePlan{
ParameterValues: protoParameters,
Metadata: &sdkproto.Provision_Metadata{
CoderUrl: server.AccessURL.String(),
CoderUrl: server.AccessURL.String(),
WorkspaceName: input.WorkspaceName,
},
},
}
Expand Down
1 change: 1 addition & 0 deletions coderd/templateversions.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ func (api *API) createTemplateVersionPlan(rw http.ResponseWriter, r *http.Reques
// Marshal template version plan job with the parameters from the request.
input, err := json.Marshal(templateVersionPlanJob{
TemplateVersionID: templateVersion.ID,
WorkspaceName: req.WorkspaceName,
ParameterValues: parameterValues,
})
if err != nil {
Expand Down
13 changes: 4 additions & 9 deletions coderd/templateversions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,16 +505,11 @@ func TestTemplateVersionPlan(t *testing.T) {
defer close(logsDone)

logCount := 0
for {
select {
case _, ok := <-logs:
if !ok {
assert.GreaterOrEqual(t, logCount, 1, "unexpected log count")
return
}
logCount++
}
for range logs {
logCount++
}
assert.GreaterOrEqual(t, logCount, 1, "unexpected log count")
return
}()

// Wait for the job to complete
Expand Down
1 change: 1 addition & 0 deletions codersdk/templateversions.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ func (c *Client) TemplateVersionLogsAfter(ctx context.Context, version uuid.UUID
// CreateTemplateVersionPlanRequest defines the request parameters for
// CreateTemplateVersionPlan.
type CreateTemplateVersionPlanRequest struct {
WorkspaceName string
ParameterValues []CreateParameterRequest
}

Expand Down