Skip to content
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

Use dep for repo-infra deps #54

Merged
merged 5 commits into from
Jan 10, 2018
Merged

Use dep for repo-infra deps #54

merged 5 commits into from
Jan 10, 2018

Conversation

cblecker
Copy link
Member

Also fixes path for github.com/bazelbuild/buildtools/build

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 24, 2017
@cblecker
Copy link
Member Author

/assign @ixdy

# exists; there is a specific test_suite rule that breaks importing
rm -f ${REPOINFRA_ROOT}/vendor/github.com/bazelbuild/buildtools/BUILD.bazel

GOBIN="${TMP_GOPATH}/bin" go install "./kazel"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one is a bit weird, since in theory the scripts under verify/ in repo-infra should be usable in other repos.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right. wasn't thinking about that -- only thinking about in the context of local. will fix.

0.8 \
"${TMP_GOPATH}"

touch "${REPOINFRA_ROOT}/vendor/BUILD"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI this isn't really needed for repo-infra (since we don't use the srcs rules here), but it makes sense if this script is used elsewhere, so I'm fine leaving it.


# manually remove BUILD file for github.com/bazelbuild/buildtools/BUILD.bazel if it
# exists; there is a specific test_suite rule that breaks importing
rm -f ${REPOINFRA_ROOT}/vendor/github.com/bazelbuild/buildtools/BUILD.bazel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ugh, mixing go vendoring + bazel is the worst. :(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it's worth just.. find/deleting all BUILD/BUILD.bazel files in vendor/. @BenTheElder had suggested this before in test-infra, but I wasn't sure if there was possibly other rules in those files that would be useful in the context of go vendoring (when we strip tests and other files).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This SGTM except that it would stink to need to regenerate all of these every update run, lots of update runs shouldn't touch vendor/ at all 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BenTheElder We could perhaps use kube::util::has_changes_against_upstream_branch to check if there has been changes in vendor/ against upstream, and only trigger if there has. This is used for verifying core godeps only if there has been changes (or forced in CI)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleting all existing BUILD files can be dangerous, since there might be genrules or other customizations we need.

I filed bazelbuild/bazel-gazelle#63 upstream to figure out a better long-term fix for this issue.

@cblecker
Copy link
Member Author

@ixdy PTAL

@thockin
Copy link
Member

thockin commented Jan 2, 2018

I am waiting for this, or something like it, for kubernetes/kubernetes#57600

"${TMP_GOPATH}/bin/gazelle" fix \
-build_file_name=BUILD,BUILD.bazel \
-external=vendored \
-proto=legacy \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this line here. it's been removed from test-infra as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove

- gometalinter --install
- go install ./...

script:
- verify/verify-boilerplate.sh --rootdir="$GOPATH/src/k8s.io/repo-infra" -v
- verify/verify-go-src.sh --rootdir "$GOPATH/src/k8s.io/repo-infra" -v
- buildifier -mode=check $(find . -name BUILD -o -name '*.bzl' -type f)
- buildifier -mode=check $(find . -name BUILD -o -name '*.bzl' -type f -not -wholename '*/vendor/*')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we skipping vendor?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caught the following error when building with vendor (https://travis-ci.org/kubernetes/repo-infra/builds/320873011):

$ buildifier -mode=check $(find . -name BUILD -o -name '*.bzl' -type f)
./vendor/github.com/bazelbuild/buildtools/build/build_defs.bzl # reformat 
The command "buildifier -mode=check $(find . -name BUILD -o -name '*.bzl' -type f)" exited with 4.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha, that's amazing.

(I will maybe go send them a PR to fix that. :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, per bazelbuild/buildtools#109, we should probably only be running buildifier on BUILD files, not *.bzl files, though this is fine as-is.

@ixdy
Copy link
Member

ixdy commented Jan 10, 2018

I have a few lingering questions but otherwise LGTM. Sorry for delay.

@cblecker
Copy link
Member Author

@ixdy updated

@ixdy
Copy link
Member

ixdy commented Jan 10, 2018

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 10, 2018
@ixdy ixdy merged commit 2a736b4 into kubernetes:master Jan 10, 2018
@ixdy
Copy link
Member

ixdy commented Jan 10, 2018

(we should maybe switch from travis to prow and setup tide here)

@cblecker cblecker deleted the deps branch January 10, 2018 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants