-
Notifications
You must be signed in to change notification settings - Fork 155
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
Exit code of restart_process is wrong #92
Comments
cc @maiamcc do you remember the history behind this? i thought we had baked in a special version of entr that returned the right exit code, but i'm probably misremembering |
Oh ugh :-/ good catch @jani123. We don't have a special version of entr for the exit code-- @nicks you might be remembering that we baked in a version of entr with the I (foolishly) didn't verify the exit code behavior because for a Pod, any process exit is enough to alert Tilt that something weird is going on. Are you running into this bad behavior on Jobs/other shortlived k8s objects? Or on pods? Can you tell me a little more about the behavior you're seeing? |
Yes, batch jobs are the things that is the problem atm. So, the most easiest example use case would be that we have N8N put up with the Tilt. We are developing new nodes for our products to N8N, so of'course live sync would be nice to have when you make changes to nodes. Helm chart is pretty much the one you get from helm create except few environment variables and database initialization. Database initialization batch job is the problem. If we have a bug like sql syntax error in it(for an example I made exit 1), it will show green like this:
Here is the tilt file we use:
Here is the batch job yaml for helm chart
Job description of the work
dev-entrypoint.sh is just a script to execute n8n or database create(docker build restart needs entrypoint so we need some hackery to do multiple things):
And the create-db.sh is as follows:
I hope this is enough, but let me know if I'm missing something! :) |
@jani123 thanks for raising this--should be fixed. If you |
Yes, this works great! Thanks :) |
Introduction
Restart process wrapper returns exit code zero even if software exits with any other. That affects on Tilt UI side so that service seems ok(green) even though it is not. Problem lies on used entr cli command, that seem to be returning its own exit status, instead of the status code from software it runs.
Example
Lets have a script that fails on star
And then we run restart process wrapper
The last line 0 is exit status of restart process wrapper, and in this case it should be 1 instead of 0.
This can be tracked to be fault(or feature depending on the view) of entr cli tool:
Here we have same failing script but the entr is only returns zeroes.
How to almost fix this
One can use Kubernetes liveness properties in case there is multiple component starting up and they depend on eachother, but the most annoying part of this is that Tilt user interface lies about everything being ok even though it is not. We have 15 to 20 components in our software that is started up/developed and if one of them fails, you don't get any indication about it.
Likely fix
My bet would be to get rid of the entr tool, since this is likely feature of the tool. It shouldn't be that hard to make golang code to run application and restart it when some files changes. What do you think? Unfortunately this is way too big of the job for now for me to do pull request since I have schedule of my own.
The text was updated successfully, but these errors were encountered: