Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions cmd/lk/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,13 @@ func createAgent(ctx context.Context, cmd *cli.Command) error {
excludeFiles := []string{fmt.Sprintf("**/%s", config.LiveKitTOMLFile)}
resp, err := agentsClient.CreateAgent(buildContext, os.DirFS(workingDir), secrets, regions, excludeFiles, os.Stderr)
if err != nil {
if errors.Is(err, context.Canceled) {
// The client disconnected (Ctrl-C). The agent is registered and its build runs
// to completion on the server, so this is not a failure. The agent ID was not
// saved locally (resp is nil here), so point at `list` rather than `status`.
out.Status("Disconnected. The build continues on the server; run `lk agent list` to find it.")
return nil
}
if errors.Is(err, context.DeadlineExceeded) {
return fmt.Errorf("build timed out possibly due to large image size")
}
Expand Down Expand Up @@ -873,6 +880,12 @@ func deployAgent(ctx context.Context, cmd *cli.Command) error {

excludeFiles := []string{fmt.Sprintf("**/%s", config.LiveKitTOMLFile)}
if err := agentsClient.DeployAgentV2(buildContext, agentId, os.DirFS(workingDir), secrets, attrs, agentDeployment, excludeFiles, os.Stderr); err != nil {
if errors.Is(err, context.Canceled) {
// The client disconnected (Ctrl-C). Deploys are durable — the build runs to
// completion and deploys on the server regardless, so this is not a failure.
out.Status("Disconnected. The deploy continues on the server; run `lk agent status` to check.")
return nil
}
if twerr, ok := err.(twirp.Error); ok {
return fmt.Errorf("unable to deploy agent: %s", twerr.Msg())
}
Expand Down
Loading