File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,6 +37,9 @@ func newSandboxExecPipe() *cobra.Command {
3737 return fmt .Errorf ("failed to resolve token: %w" , err )
3838 }
3939
40+ orgID , err := cmd .Flags ().GetString ("org" )
41+ cobra .CheckErr (err )
42+
4043 sandboxID , err := cmd .Flags ().GetString ("sandbox-id" )
4144 cobra .CheckErr (err )
4245
@@ -60,6 +63,9 @@ func newSandboxExecPipe() *cobra.Command {
6063 client := api .NewComputeClient ()
6164 stream := client .ExecPipe (ctx )
6265 stream .RequestHeader ().Set ("Authorization" , "Bearer " + token )
66+ if orgID != "" {
67+ stream .RequestHeader ().Set ("x-depot-org" , orgID )
68+ }
6369
6470 // Send init message with the command.
6571 if err := stream .Send (& civ1.ExecuteCommandPipeRequest {
Original file line number Diff line number Diff line change @@ -38,6 +38,9 @@ func newSandboxExec() *cobra.Command {
3838 return fmt .Errorf ("failed to resolve token: %w" , err )
3939 }
4040
41+ orgID , err := cmd .Flags ().GetString ("org" )
42+ cobra .CheckErr (err )
43+
4144 sandboxID , err := cmd .Flags ().GetString ("sandbox-id" )
4245 cobra .CheckErr (err )
4346
@@ -57,14 +60,14 @@ func newSandboxExec() *cobra.Command {
5760
5861 client := api .NewComputeClient ()
5962
60- stream , err := client .RemoteExec (ctx , api .WithAuthentication (connect .NewRequest (& civ1.ExecuteCommandRequest {
63+ stream , err := client .RemoteExec (ctx , api .WithAuthenticationAndOrg (connect .NewRequest (& civ1.ExecuteCommandRequest {
6164 SandboxId : sandboxID ,
6265 SessionId : sessionID ,
6366 Command : & civ1.Command {
6467 CommandArray : args ,
6568 TimeoutMs : int32 (timeout ),
6669 },
67- }), token ))
70+ }), token , orgID ))
6871 if err != nil {
6972 // nolint:wrapcheck
7073 return err
Original file line number Diff line number Diff line change @@ -35,6 +35,9 @@ func newSandboxPty() *cobra.Command {
3535 return fmt .Errorf ("failed to resolve token: %w" , err )
3636 }
3737
38+ orgID , err := cmd .Flags ().GetString ("org" )
39+ cobra .CheckErr (err )
40+
3841 sandboxID , err := cmd .Flags ().GetString ("sandbox-id" )
3942 cobra .CheckErr (err )
4043
@@ -66,6 +69,7 @@ func newSandboxPty() *cobra.Command {
6669
6770 return pty .Run (ctx , pty.SessionOptions {
6871 Token : token ,
72+ OrgID : orgID ,
6973 SandboxID : sandboxID ,
7074 SessionID : sessionID ,
7175 Cwd : cwd ,
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ Subcommands:
1919 }
2020
2121 cmd .PersistentFlags ().String ("token" , "" , "Depot API token" )
22+ cmd .PersistentFlags ().String ("org" , "" , "Organization ID (required when user is a member of multiple organizations)" )
2223
2324 cmd .AddCommand (newSandboxExec ())
2425 cmd .AddCommand (newSandboxPty ())
You can’t perform that action at this time.
0 commit comments