-
Notifications
You must be signed in to change notification settings - Fork 11
Add entrypoint.sh to abstract around metadatad binary. #40
Conversation
jkohen
left a comment
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.
Thanks for doing this, Bryan.
70449da to
5aa2078
Compare
pkg/docker/Dockerfile-xenial
Outdated
| ARG version=0.0.13-5 | ||
| EXPOSE 8000 | ||
|
|
||
| ARG version=0.0.13-3 |
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.
Is this way out of date now?
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.
Yes.
pkg/docker/docker-entrypoint.sh
Outdated
| #!/bin/sh | ||
| set -e | ||
|
|
||
| # first arg is a flag. |
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.
Nit: capitalize "First".
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.
Done.
pkg/docker/docker-entrypoint.sh
Outdated
| set -e | ||
|
|
||
| # first arg is a flag. | ||
| if [ "${1:0:1}" = '-' ]; then |
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.
Is this a bash-ism? If so, should the shebang be #!/bin/bash instead?
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.
Done.
pkg/docker/docker-entrypoint.sh
Outdated
| set -e | ||
|
|
||
| # first arg is a flag. | ||
| if [ "${1:0:1}" = '-' ]; then |
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 if there isn't a first argument?
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'm not sure what you mean. Please see if the latest update addresses your concerns.
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 was worried that a missing $1 would cause it to error out when nounset is in effect, but that seems to be ignored for substring substitutions (i.e., echo "${1}" would produce a "1: unbound variable" error, but echo ${1:0:1} will happily print an empty string). So never mind.
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.
@bmoyles0117 Just noticed that this is a bash-ism, and you set the shell to /bin/sh. I got Bad substitution errors on this line in the latest container.
I've sent #161 to fix.
65b8b2c to
1b1c892
Compare
qingling128
left a comment
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.
LGTM.
pkg/docker/Dockerfile-xenial
Outdated
| && apt-get install -f -y \ | ||
| && rm -rf /var/lib/apt/lists/* \ | ||
| && rm -rf /stackdriver-metadata.deb | ||
| ADD entrypoint.sh /entrypoint.sh |
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.
This is a local file — let's use COPY.
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.
Done.
| # $ docker run -it {image:tag} /bin/bash | ||
| # | ||
| # Default behavior uses CMD defined in Dockerfile. | ||
| # $ docker run -it {image:tag} |
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.
This comment is not related to the following if, so let's add a blank line after 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.
Done.
pkg/docker/entrypoint.sh
Outdated
| set -- /opt/stackdriver/metadata/sbin/metadatad "$@" | ||
| fi | ||
|
|
||
| exec "$@" No newline at end of file |
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.
Let's keep the trailing newline...
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.
Please understand that I don't do this intentionally :)
pkg/docker/docker-entrypoint.sh
Outdated
| set -e | ||
|
|
||
| # first arg is a flag. | ||
| if [ "${1:0:1}" = '-' ]; then |
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 was worried that a missing $1 would cause it to error out when nounset is in effect, but that seems to be ignored for substring substitutions (i.e., echo "${1}" would produce a "1: unbound variable" error, but echo ${1:0:1} will happily print an empty string). So never mind.
igorpeshansky
left a comment
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.
LGTM ![]()
No description provided.