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

Method createDevcontainer

agent/agent.go:1434–1464  ·  view source on GitHub ↗
(
	ctx context.Context,
	aAPI proto.DRPCAgentClient28,
	dc codersdk.WorkspaceAgentDevcontainer,
	script codersdk.WorkspaceAgentScript,
)

Source from the content-addressed store, hash-verified

1432}
1433
1434func (a *agent) createDevcontainer(
1435 ctx context.Context,
1436 aAPI proto.DRPCAgentClient28,
1437 dc codersdk.WorkspaceAgentDevcontainer,
1438 script codersdk.WorkspaceAgentScript,
1439) (err error) {
1440 var (
1441 exitCode = int32(0)
1442 startTime = a.clock.Now()
1443 status = proto.Timing_OK
1444 )
1445 if err = a.containerAPI.CreateDevcontainer(dc.WorkspaceFolder, dc.ConfigPath); err != nil {
1446 exitCode = 1
1447 status = proto.Timing_EXIT_FAILURE
1448 }
1449 endTime := a.clock.Now()
1450
1451 if _, scriptErr := aAPI.ScriptCompleted(ctx, &proto.WorkspaceAgentScriptCompletedRequest{
1452 Timing: &proto.Timing{
1453 ScriptId: script.ID[:],
1454 Start: timestamppb.New(startTime),
1455 End: timestamppb.New(endTime),
1456 ExitCode: exitCode,
1457 Stage: proto.Timing_START,
1458 Status: status,
1459 },
1460 }); scriptErr != nil {
1461 a.logger.Warn(ctx, "reporting script completed failed", slog.Error(scriptErr))
1462 }
1463 return err
1464}
1465
1466// createOrUpdateNetwork waits for the manifest to be set using manifestOK, then creates or updates
1467// the tailnet using the information in the manifest

Callers 1

handleManifestMethod · 0.95

Calls 4

CreateDevcontainerMethod · 0.80
ScriptCompletedMethod · 0.65
NewMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected