Skip to content

Commit

Permalink
Revert "tiltfile: add stdin_mode='pty' to local_resouce() (#6382)"
Browse files Browse the repository at this point in the history
This reverts commit 20ab76b.

Signed-off-by: Nick Santos <nick.santos@docker.com>
  • Loading branch information
nicks committed May 31, 2024
1 parent 41db252 commit a5e4db4
Show file tree
Hide file tree
Showing 12 changed files with 285 additions and 365 deletions.
6 changes: 1 addition & 5 deletions internal/tiltfile/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1132,9 +1132,7 @@ def local_resource(name: str,
readiness_probe: Probe = None,
dir: str = "",
serve_dir: str = "",
labels: List[str] = [],
stdin_mode: str = "",
serve_stdin_mode: str = "") -> None:
labels: List[str] = []) -> None:
"""Configures one or more commands to run on the *host* machine (not in a remote cluster).
By default, Tilt performs an update on local resources on ``tilt up`` and whenever any of their ``deps`` change.
Expand Down Expand Up @@ -1177,8 +1175,6 @@ def local_resource(name: str,
dir: Working directory for ``cmd``. Defaults to the Tiltfile directory.
serve_dir: Working directory for ``serve_cmd``. Defaults to the Tiltfile directory.
labels: used to group resources in the Web UI, (e.g. you want all frontend services displayed together, while test and backend services are displayed separately). A label must start and end with an alphanumeric character, can include ``_``, ``-``, and ``.``, and must be 63 characters or less. For an example, see `Resource Grouping <tiltfile_concepts.html#resource-groups>`_.
stdin_mode: Stdin mode for ``cmd``. Set to 'pty' to attach a pseudo terminal.
serve_stdin_mode: Stdin mode for ``serve_cmd``. Set to 'pty' to attach a pseudo terminal.
"""
pass

Expand Down
7 changes: 3 additions & 4 deletions internal/tiltfile/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func (s *tiltfileState) dockerBuild(thread *starlark.Thread, fn *starlark.Builti
return nil, err
}

entrypointCmd, err := value.ValueToUnixCmd(thread, entrypoint, nil, nil, value.StdinMode{})
entrypointCmd, err := value.ValueToUnixCmd(thread, entrypoint, nil, nil)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -342,7 +342,7 @@ func (s *tiltfileState) customBuild(thread *starlark.Thread, fn *starlark.Builti
return nil, err
}

entrypointCmd, err := value.ValueToUnixCmd(thread, entrypoint, nil, nil, value.StdinMode{})
entrypointCmd, err := value.ValueToUnixCmd(thread, entrypoint, nil, nil)
if err != nil {
return nil, err
}
Expand All @@ -360,8 +360,7 @@ func (s *tiltfileState) customBuild(thread *starlark.Thread, fn *starlark.Builti
commandBat = commandBatVal
}

command, err := value.ValueGroupToCmdHelper(thread,
commandVal, commandBat, dir, env, value.StdinMode{})
command, err := value.ValueGroupToCmdHelper(thread, commandVal, commandBat, dir, env)
if err != nil {
return nil, fmt.Errorf("Argument 2 (command): %v", err)
} else if command.Empty() {
Expand Down
4 changes: 1 addition & 3 deletions internal/tiltfile/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ func (s *tiltfileState) local(thread *starlark.Thread, fn *starlark.Builtin, arg
return nil, err
}

cmd, err := value.ValueGroupToCmdHelper(thread,
commandValue, commandBatValue, commandDirValue,
commandEnv, value.StdinMode{})
cmd, err := value.ValueGroupToCmdHelper(thread, commandValue, commandBatValue, commandDirValue, commandEnv)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/tiltfile/k8s_custom_deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ func (s *tiltfileState) k8sCustomDeploy(thread *starlark.Thread, fn *starlark.Bu
return nil, err
}

applyCmd, err := value.ValueGroupToCmdHelper(thread, applyCmdVal, applyCmdBatVal, applyCmdDirVal, applyCmdEnv, value.StdinMode{})
applyCmd, err := value.ValueGroupToCmdHelper(thread, applyCmdVal, applyCmdBatVal, applyCmdDirVal, applyCmdEnv)
if err != nil {
return nil, errors.Wrap(err, "apply_cmd")
} else if applyCmd.Empty() {
return nil, fmt.Errorf("k8s_custom_deploy: apply_cmd cannot be empty")
}

deleteCmd, err := value.ValueGroupToCmdHelper(thread, deleteCmdVal, deleteCmdBatVal, deleteCmdDirVal, deleteCmdEnv, value.StdinMode{})
deleteCmd, err := value.ValueGroupToCmdHelper(thread, deleteCmdVal, deleteCmdBatVal, deleteCmdDirVal, deleteCmdEnv)
if err != nil {
return nil, errors.Wrap(err, "delete_cmd")
} else if deleteCmd.Empty() {
Expand Down
2 changes: 1 addition & 1 deletion internal/tiltfile/live_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func (s *tiltfileState) liveUpdateRun(thread *starlark.Thread, fn *starlark.Buil
return nil, err
}

command, err := value.ValueToUnixCmd(thread, commandVal, nil, nil, value.StdinMode{})
command, err := value.ValueToUnixCmd(thread, commandVal, nil, nil)
if err != nil {
return nil, err
}
Expand Down
11 changes: 2 additions & 9 deletions internal/tiltfile/local_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func (s *tiltfileState) localResource(thread *starlark.Thread, fn *starlark.Buil
var allowParallel bool
var links links.LinkList
var labels value.LabelSet
var updateStdinMode, serveStdinMode value.StdinMode
autoInit := true
if fn.Name() == testN {
// If we're initializing a test, by default parallelism is on
Expand All @@ -79,8 +78,6 @@ func (s *tiltfileState) localResource(thread *starlark.Thread, fn *starlark.Buil
"readiness_probe?", &readinessProbe,
"dir?", &updateCmdDirVal,
"serve_dir?", &serveCmdDirVal,
"stdin_mode??", &updateStdinMode,
"serve_stdin_mode??", &serveStdinMode,
); err != nil {
return nil, err
}
Expand All @@ -95,15 +92,11 @@ func (s *tiltfileState) localResource(thread *starlark.Thread, fn *starlark.Buil
return nil, err
}

updateCmd, err := value.ValueGroupToCmdHelper(thread,
updateCmdVal, updateCmdBatVal, updateCmdDirVal, updateEnv,
updateStdinMode)
updateCmd, err := value.ValueGroupToCmdHelper(thread, updateCmdVal, updateCmdBatVal, updateCmdDirVal, updateEnv)
if err != nil {
return nil, err
}
serveCmd, err := value.ValueGroupToCmdHelper(thread,
serveCmdVal, serveCmdBatVal, serveCmdDirVal, serveEnv,
serveStdinMode)
serveCmd, err := value.ValueGroupToCmdHelper(thread, serveCmdVal, serveCmdBatVal, serveCmdDirVal, serveEnv)
if err != nil {
return nil, err
}
Expand Down
Loading

0 comments on commit a5e4db4

Please sign in to comment.