-
Notifications
You must be signed in to change notification settings - Fork 246
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
Add vendor-check script, Makefile target and CI step #581
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.
Looks good! A few changes are necessary.
Also, it would be nice to validate that the script actually returns a non-zero answer if contents of vendor
are changed. Now it shows warning: no common commits
because it checks against the wrong repo.
.validate-vendor.sh
Outdated
echo | ||
} >&2 | ||
false | ||
else |
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.
Seems like indentation went funky in this file, let's fix that.
.validate-vendor.sh
Outdated
set -e -o pipefail | ||
|
||
if [ -z "$VALIDATE_UPSTREAM" ]; then | ||
VALIDATE_REPO='https://github.com/golang/dep.git' |
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 should be the status-go
repo, right?
.validate-vendor.sh
Outdated
|
||
if [ -z "$VALIDATE_UPSTREAM" ]; then | ||
VALIDATE_REPO='https://github.com/golang/dep.git' | ||
VALIDATE_BRANCH='master' |
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.
We use develop
as a target branch.
@azer looks good now! |
@mandrigin Thanks for the feedback, I've made the fixes requested, also tested it on a branch with additions into
|
@azer Looks good! I'll ask one peer of mine to review it too. |
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.
Only one question, rest LGTM.
ci/validate-vendor.sh
Outdated
# for our repo and makes sure that it was done in a valid way. | ||
# | ||
# This file is a slightly modified copy of https://github.com/golang/dep/blob/master/hack/validate-vendor.bash | ||
# The only change made was checking if `dep` was available and installing it if necessary. |
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.
Isn't this check done with dep-install
in Makefile
?
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.
Yup, just deleted it
ci/validate-vendor.sh
Outdated
|
||
if [ -z "$VALIDATE_UPSTREAM" ]; then | ||
VALIDATE_REPO='https://github.com/status-im/status-go' | ||
VALIDATE_BRANCH='develop' |
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.
Shouldn't branch be taken from env and only default to develop
? We merge almost every branch to develop
but it should change soon.
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.
👍
fi | ||
|
||
IFS=$'\n' | ||
files=( $(validate_diff --diff-filter=ACMR --name-only -- 'Gopkg.toml' 'Gopkg.lock' 'vendor/' || true) ) |
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 the if
statement above won't be executed, validate_diff
won't be defined, right?
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, if statement will always be executed unless we define VALIDATE_UPSTREAM
before calling this script.
ci/validate-vendor.sh
Outdated
|
||
set -e -o pipefail | ||
|
||
if [ -z "$VALIDATE_UPSTREAM" ]; 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 hate bash for their super hard to remember expression. Can you please add a comment // if $VALIDATE_UPSTREAM is null or empty string do bla bla bla...
?
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, I've added some more comments
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.
Hmm, do we even need this option?
ci/validate-vendor.sh
Outdated
files=( $(validate_diff --diff-filter=ACMR --name-only -- 'Gopkg.toml' 'Gopkg.lock' 'vendor/' || true) ) | ||
unset IFS | ||
|
||
if [ ${#files[@]} -gt 0 ]; 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 have no idea what ${#files[@]}
does (getting a number of files?). Can you please add 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.
Splits the content of files
variable by whitespaces and gets the number of the lines. Just added a comment for it.
ci/validate-vendor.sh
Outdated
echo | ||
} >&2 | ||
false | ||
else |
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.
Formatting? Shouldn't this else
be aligned with if [ "$diffs" ]; 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.
Fixed 👍
I know it's copied from |
@adambabik defaulted branch to "develop", added some comments & fixed tabbing 👍 |
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 @azer. LGTM
@azer thanks for your contribution 🎉 |
It adds
vendor-check
target, copying the validation script in dep repository.Closes #556
CC @mandrigin