-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scuba Runs the Entrypoint Before Every Command #114
Comments
Also from today's discussion, for posterity:
Command-style or single application images -- Here, the Some examples of this type of image:
A hook -- Here, the The advent of multi-line aliases (scripts), led to this interesting problem: How should Scuba treat the For single application images, the current behavior (prepending the entrypoint to each line of the script) actually makes sense. For example:
image: jreinhart/echo
aliases:
doit:
script:
- line one
- line two
- line three Output:
These boutique images seem to be the minority; Scuba is much more interested in "normal" images, where the given arguments are expected to be run as a command. For these normal images, the current behavior is very wrong. An entrypoint that starts a daemon would do so for every line of the script. It is unfortunately impossible to detect at runtime what type of image entrypoint is being used. So Scuba is at a bit of an impasse. While the current behavior is more usually wrong than right, it is the current behavior; to change it requires a major version bump according to semver. (Sidenote: I'd like to drop support for Python 2.6 anyway, so maybe now is the time!) With all that said, here is my proposal:
|
This is a breaking change. Fixes #114
This is a breaking change. Fixes #114
This is a breaking change. Fixes #114
**This is a breaking change.** The previous logic was generally incorrect. For a multi-line script, Scuba would prepend each line with the entrypoint. This sort of makes sense, except the script is run within *one* `docker run` invocation. Many image entrypoints are wrappers which set up things in the container, and then execute the user command which is passed as arguments to the entrypoint (e.g. `exec "@"`). Thus, it isn't right to execute the entrypoint multiple times in the same container. This changes the behavior of Scuba to instead invoke the entrypoint, passing it the path of the scuba-generated script to be executed. In this way, the entrypoint is only run once. N.B. This means that Scuba no longer works with images which wrap a single command (e.g. an "application" image which sets some CLI application as the entrypoint). If this use case is needed in the future, an additional YAML option (e.g. `entrypoint_each_line`) could be added to restore the old behavior. Fixes #114
Currently, Scuba adds the entrypoint to the beginning of every command in the generated
command.sh
script. This can cause unexpected behavior with entrypoints that are only supposed to run once. After a discussion with @JonathonReinhart, it seems best to have the defined entrypoint call the scuba-generatedcommand.sh
script, and not have the entrypoint inserted before every command in the script.Currently the call chain is:
After the resolution of this issue, it will be:
The text was updated successfully, but these errors were encountered: