@@ -22,6 +22,7 @@ import (
2222 client2 "github.com/loft-sh/devpod/pkg/client"
2323 "github.com/loft-sh/devpod/pkg/client/clientimplementation"
2424 "github.com/loft-sh/devpod/pkg/config"
25+ "github.com/loft-sh/devpod/pkg/devcontainer"
2526 dpFlags "github.com/loft-sh/devpod/pkg/flags"
2627 "github.com/loft-sh/devpod/pkg/gpg"
2728 "github.com/loft-sh/devpod/pkg/port"
@@ -665,21 +666,38 @@ func (cmd *SSHCmd) setupGPGAgent(
665666//
666667// WARN: This is considered experimental for the time being!
667668func (cmd * SSHCmd ) jumpLocalProxyContainer (ctx context.Context , devPodConfig * config.Config , client client2.WorkspaceClient , log log.Logger , exec func (ctx context.Context , command string , sshClient * ssh.Client ) error ) error {
668- _ , workspaceInfo , err := client .AgentInfo (provider.CLIOptions {Proxy : true })
669+ encodedWorkspaceInfo , _ , err := client .AgentInfo (provider.CLIOptions {Proxy : true })
669670 if err != nil {
670671 return fmt .Errorf ("prepare workspace info: %w" , err )
671672 }
672-
673- workspaceDir , err := agent .CreateAgentWorkspaceDir (workspaceInfo .Agent .DataPath , workspaceInfo .Workspace .Context , workspaceInfo .Workspace .ID )
673+ shouldExit , workspaceInfo , err := agent .WorkspaceInfo (encodedWorkspaceInfo , log )
674674 if err != nil {
675- return fmt .Errorf ("create agent workspace dir: %w" , err )
675+ return err
676+ } else if shouldExit {
677+ return nil
676678 }
677- workspaceInfo . Origin = workspaceDir
679+
678680 runner , err := workspace .CreateRunner (workspaceInfo , log )
679681 if err != nil {
680682 return err
681683 }
682684
685+ containerDetails , err := runner .Find (ctx )
686+ if err != nil {
687+ return err
688+ }
689+
690+ if containerDetails == nil || containerDetails .State .Status != "running" {
691+ log .Info ("Workspace isn't running, starting up..." )
692+ _ , err := runner .Up (ctx , devcontainer.UpOptions {
693+ CLIOptions : workspaceInfo .CLIOptions ,
694+ NoBuild : true }, workspaceInfo .InjectTimeout )
695+ if err != nil {
696+ return err
697+ }
698+ log .Info ("Successfully started workspace" )
699+ }
700+
683701 // create readers
684702 stdoutReader , stdoutWriter , err := os .Pipe ()
685703 if err != nil {
0 commit comments