-
Notifications
You must be signed in to change notification settings - Fork 0
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
Refactor entrypoint.sh 1.0 #47
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the design and the objectives. Let's talk in our sync on what we want to achieve in the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rename source.sh
to constants.sh
.
Good idea to make it flexible to refactor large entrypoint into smaller scripts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like mfig to review as well before you merge it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one question about set -ex
. After that's resolved, feel free to merge!
BTW, if you haven't already done so, I suggest installing shellcheck
(and an editor plugin like the ShellCheck
VSCode extension by Timon Wong) to help write robust shell scripts. It has countless warnings in main.sh
(mainly because entrypoint.sh
was written without such an an extension), but shellcheck
can be very useful when developing a script from scratch.
set -x | ||
set +e | ||
set -ex |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These do not mean the same thing. Do you really want set -ex
? That's the same as set -e
and set -x
. set -e
will silently terminate the script if any commands return a nonzero exit code. Has this script been audited to ensure that all exit codes are handled carefully to guarantee no unexpected termination?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well I'm curious that why it was set +e at first place. We should stop further execution when any inside command returns non-zero status.
By set +e, we might be supressing the issues directly/indirectly affecting the containers.
Also I think @michaelfig you have raised a good point about verification of exitcode handling and I think "set -ex" might help to identify/fix such problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you'd like to take on this work of auditing and handling the exit codes, I recommend doing it in a separate PR after this one lands (using set +e
in this current PR and only enabling set -ex
in the new one).
The main reason I'd like this separated is that the current PR should be a pure refactor (i.e. easy to review and uncontroversial to land) and not a behaviour change.
Description
Ths PR lays the base for refactoring entrypoint. In this PR, we have moved out exported variables in a separate script which will be sourced in the main script.
We will now send a zip containing scripts which will be extracted on the server and executed there. The deployment change is done in this PR.
Actual diff of the entrypoint script can be checked here