-
Notifications
You must be signed in to change notification settings - Fork 68
Add ShellCheck Action #454
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
base: main
Are you sure you want to change the base?
Conversation
docker/linux/debian/entrypoint.sh
Outdated
fi | ||
exec gosu envoybuild "$@" | ||
|
||
gosu envoybuild "$@" |
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 think this should be exec
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.
Right, that was my only question on this change. I'm worried the thing after exec
does not get executed. ShellCheck warns about it.
We'd need either remove the cleanup section, or suppress the warning, but I think the warning is legit.
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.
fair point - probs best to move it to something like
cleanup() {
if [[ -f /cleanup.sh ]]; then
. /cleanup.sh
fi
}
trap cleanup EXIT
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.
It doesn't work. exec
replaces the current process entirely, including any cleanup trap.
#!/bin/bash
set -eo pipefail
cleanup() {
echo "b.sh has returned. Exiting a.sh."
}
trap cleanup EXIT
echo "This is a.sh. Invoking b.sh next..."
exec ./b.sh
^^ cleanup() is never called.
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.
argh - thats annoying - something like this could probably work
gosu envoybuild "$@" &
pid=$!
wait $pid
status=$?
if [ -f /cleanup.sh ]; then
. /cleanup.sh
fi
exit $status
but tbh - im happy if we just remove the cleanup for now - i dont think i was using it anywhere given it wasnt working
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.
What's your intention with exec
? AFAICT gosu
already performs an exec
:
Once the user/group is processed, we switch to that user, then we exec the specified process and gosu itself is no longer resident or involved in the process lifecycle at all.
Taken from its README.
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.
keeping the proc as pid 1
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.
and ensuring the signals are properly handled - pretty sure you should exec gosu in an entrypoint
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.
Right. I'll remove the cleanup for now.
b993713
to
2b634b4
Compare
.github/workflows/lint.yml
Outdated
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository |
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.
can we do least indent for arrays in yaml files please
sort of related .. we have envoy.code.check - which can run is python and can run in ci etc - it has both yamllint and shellcheck
i reckon lets land this (with cleaned up yaml) and i can switch to the envoy one after
Signed-off-by: Jonh Wendell <[email protected]>
2b634b4
to
d9be6d6
Compare
No description provided.