Skip to content

feat: Add UI for awaiting agent connections #578

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Mar 29, 2022
Merged
Prev Previous commit
Next Next commit
Fix logs post-cancel
  • Loading branch information
kylecarbs committed Mar 27, 2022
commit 6bff97372f375eb5bd7d01379ba699823b8e0aa9
13 changes: 5 additions & 8 deletions coderd/provisionerdaemons.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,6 @@ func (server *provisionerdServer) UpdateJob(ctx context.Context, request *proto.
if job.WorkerID.UUID.String() != server.ID.String() {
return nil, xerrors.New("you don't own this job")
}
if job.CanceledAt.Valid {
// Allows for graceful cancelation on the backend!
return &proto.UpdateJobResponse{
Canceled: true,
}, nil
}
err = server.Database.UpdateProvisionerJobByID(ctx, database.UpdateProvisionerJobByIDParams{
ID: parsedID,
UpdatedAt: database.Now(),
Expand Down Expand Up @@ -399,11 +393,14 @@ func (server *provisionerdServer) UpdateJob(ctx context.Context, request *proto.
}

return &proto.UpdateJobResponse{
Canceled: job.CanceledAt.Valid,
ParameterValues: protoParameters,
}, nil
}

return &proto.UpdateJobResponse{}, nil
return &proto.UpdateJobResponse{
Canceled: job.CanceledAt.Valid,
}, nil
Comment on lines +403 to +405
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😨 this is a big function. I see it's mostly boiler plate fields, but still

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ~140 lines, not that bad!

}

func (server *provisionerdServer) FailJob(ctx context.Context, failJob *proto.FailedJob) (*proto.Empty, error) {
Expand Down Expand Up @@ -444,7 +441,7 @@ func (server *provisionerdServer) FailJob(ctx context.Context, failJob *proto.Fa
return nil, xerrors.Errorf("unmarshal workspace provision input: %w", err)
}
err = server.Database.UpdateWorkspaceBuildByID(ctx, database.UpdateWorkspaceBuildByIDParams{
ID: jobID,
ID: input.WorkspaceBuildID,
UpdatedAt: database.Now(),
ProvisionerState: jobType.WorkspaceBuild.State,
})
Expand Down
3 changes: 1 addition & 2 deletions provisioner/terraform/provision.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ func (t *terraform) Provision(stream proto.DRPCProvisioner_ProvisionStream) erro
if err != nil {
return
}

logLevel, err := convertTerraformLogLevel(log.Level)
if err != nil {
// Not a big deal, but we should handle this at some point!
Expand Down Expand Up @@ -201,7 +200,7 @@ func (t *terraform) Provision(stream proto.DRPCProvisioner_ProvisionStream) erro
case <-stream.Context().Done():
return
case <-shutdown.Done():
_ = cmd.Process.Signal(os.Kill)
_ = cmd.Process.Signal(os.Interrupt)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice of you to be less aggressive 😄. I'm sure that PID will appreciate it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hahahahah that it will

}
}()
cmd.Stdout = writer
Expand Down