-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
optimize image tag script #911
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.
Hello, thanks for your contribution.
The head might be required in the future and the comment was indented that way on purpose, which means I would rather not like to have these changes merged.
tools/image-tag
Outdated
|
||
# If this is a tag, use it, otherwise branch-hash |
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 indentation was on purpose, please leave 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.
why need it? The comment in bash script seems no one to read.
tools/image-tag
Outdated
@@ -5,9 +5,9 @@ set -o nounset | |||
set -o pipefail | |||
|
|||
WIP=$(git diff --quiet || echo '-WIP') | |||
BRANCH=$(git rev-parse --abbrev-ref HEAD | sed s#/#-#g) | |||
SHA=$(git rev-parse --short=7 HEAD | head -c7) |
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.
When 7 chars are not enough to be unique, git automatically uses more. We are forcing to 7 here, as we are doing for grafana/grafana as well.
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.
Get it. Add comment here is better i think.
Still perfer to add quota for sed.
Signed-off-by: Xiang Dai <764524258@qq.com>
Signed-off-by: Xiang Dai <764524258@qq.com>
bf9516b
to
a39b154
Compare
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!
From
man git rev-parse
andman head
, no need to runhead
again.Also,
sed
should better add quota.Signed-off-by: Xiang Dai 764524258@qq.com