MCPcopy Index your code
hub / github.com/coder/coder / CompleteJob

Method CompleteJob

provisionerd/provisionerd.go:605–628  ·  view source on GitHub ↗
(ctx context.Context, in *proto.CompletedJob)

Source from the content-addressed store, hash-verified

603}
604
605func (p *Server) CompleteJob(ctx context.Context, in *proto.CompletedJob) error {
606 // If the moduleFiles exceed the max message size, we need to upload them separately.
607 if ti, ok := in.Type.(*proto.CompletedJob_TemplateImport_); ok {
608 messageSize := protobuf.Size(in)
609 if messageSize > drpcsdk.MaxMessageSize &&
610 messageSize-len(ti.TemplateImport.ModuleFiles) < drpcsdk.MaxMessageSize {
611 // Hashing the module files to reference them in the CompletedJob message.
612 moduleFilesHash := sha256.Sum256(ti.TemplateImport.ModuleFiles)
613
614 moduleFiles := ti.TemplateImport.ModuleFiles
615 ti.TemplateImport.ModuleFiles = []byte{} // Clear the files in the final message
616 ti.TemplateImport.ModuleFilesHash = moduleFilesHash[:]
617 err := p.UploadModuleFiles(ctx, moduleFiles)
618 if err != nil {
619 return err
620 }
621 }
622 }
623
624 _, err := clientDoWithRetries(ctx, p.client, func(ctx context.Context, client proto.DRPCProvisionerDaemonClient) (*proto.Empty, error) {
625 return client.CompleteJob(ctx, in)
626 })
627 return err
628}
629
630// isClosed returns whether the API is closed or not.
631func (p *Server) isClosed() bool {

Callers

nothing calls this directly

Calls 4

UploadModuleFilesMethod · 0.95
clientDoWithRetriesFunction · 0.85
SizeMethod · 0.80
CompleteJobMethod · 0.65

Tested by

no test coverage detected