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 v0.4.1 in kubernetes/test-infra #6443

Merged
merged 10 commits into from
Jan 30, 2018

Conversation

ixdy
Copy link
Member

@ixdy ixdy commented Jan 25, 2018

It does seem like the new release of dep does a better job of removing unused libraries.

In this PR, I enabled the new prune options (I turned off pruning non-go files, because Bazel).

I then ran dep ensure followed by hack/update-bazel.sh - I didn't run any of @fejta's other dep scripts in hack/. It seems like it removed some dependencies that the scripts missed, but potentially added some it had removed?

Amazingly, bazel build ... && bazel test ... still works.

fixes #5488

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. 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. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 25, 2018
@fejta
Copy link
Contributor

fejta commented Jan 25, 2018

IMO we should simplify update-deps.sh (remove the prune command, and the drop-dep calls) and still use it.

@ixdy
Copy link
Member Author

ixdy commented Jan 25, 2018

For fun, I ran hack/prune-libraries.sh --fix and added a commit with its results:

$ hack/prune-libraries.sh --fix
Unused libraries:
  DEAD: //vendor/google.golang.org/appengine/urlfetch:go_default_library
  DEAD: //vendor/google.golang.org/appengine/internal/urlfetch:go_default_library
  DEAD: //vendor/google.golang.org/appengine:go_default_library
  DEAD: //vendor/google.golang.org/appengine/internal/modules:go_default_library
  DEAD: //vendor/google.golang.org/appengine/internal/app_identity:go_default_library
  DEAD: //vendor/google.golang.org/appengine/internal:go_default_library
  DEAD: //vendor/google.golang.org/appengine/internal/remote_api:go_default_library
  DEAD: //vendor/google.golang.org/appengine/internal/log:go_default_library
  DEAD: //vendor/google.golang.org/appengine/internal/datastore:go_default_library
  DEAD: //vendor/google.golang.org/appengine/internal/base:go_default_library
  DEAD: //vendor/golang.org/x/text/internal/ucd:go_default_library
  DEAD: //vendor/golang.org/x/text/internal/triegen:go_default_library
  DEAD: //vendor/golang.org/x/text/internal/gen:go_default_library
  DEAD: //vendor/golang.org/x/text/unicode/cldr:go_default_library
  DEAD: //vendor/github.com/spf13/cobra/cobra/cmd:go_default_library
  DEAD: //vendor/github.com/petar/GoLLRB/llrb:go_default_library
Cleaning up unused dependencies...
INFO: Empty results
All remaining go libraries are alive

@ixdy
Copy link
Member Author

ixdy commented Jan 25, 2018

And I pushed one more commit which simplifies hack/update-deps.sh.

real    0m50.324s
user    0m15.784s
sys     0m5.880s

We probably need some way to ensure that the right version of dep is being used.

@stevekuznetsov
Copy link
Contributor

Simple solution would be to put the script in a presubmit and validate no changes occur?

@BenTheElder
Copy link
Member

/meow box

@krzyzacy
Copy link
Member

/joke

@k8s-ci-robot
Copy link
Contributor

@krzyzacy: My wife is on a tropical fruit diet, the house is full of stuff. It is enough to make a mango crazy.

In response to this:

/joke

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@BenTheElder
Copy link
Member

/meow boxes

@k8s-ci-robot
Copy link
Contributor

@BenTheElder: cat image

In response to this:

/meow boxes

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Contributor

@fejta fejta left a comment

Choose a reason for hiding this comment

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

/lgtm
/hold

We should consider integrating prune-libraries.sh into update-bazel.sh

hack/update-bazel.sh
drop-dep vendor/golang.org/x/text/language vendor/golang.org/x/text/internal
Copy link
Contributor

Choose a reason for hiding this comment

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

So amazing! Drop the drop-dep method?

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 26, 2018
@ixdy
Copy link
Member Author

ixdy commented Jan 26, 2018

I was able to vendor dep and get it to run under bazel run, if we want to ensure that hack/update-deps.sh is consistent for everyone.

@ixdy
Copy link
Member Author

ixdy commented Jan 26, 2018

Rebased and added dep to vendor/, along with teaching hack/prune-libraries.sh how to ignore vendored commands like this.

@ixdy ixdy changed the title Use new prune options in dep 0.4.1 Use dep v0.4.1 in kubernetes/test-infra Jan 26, 2018
@BenTheElder
Copy link
Member

fixes #5488

@ixdy
Copy link
Member Author

ixdy commented Jan 26, 2018

I guess we don't actually have any presubmits checking this, yet. We should figure out how to do that... I'm not sure how to query bazel from inside a test running under bazel, though.

@ixdy
Copy link
Member Author

ixdy commented Jan 26, 2018

I have a somewhat clever way of making dep work well under bazel run, similar to the approach gazelle used. Will open a PR against repo-infra. (Still not sure about making the verify-deps script run well under bazel.)

@stevekuznetsov
Copy link
Contributor

So are we generally expecting PR reviewers to notice a huge diff in vendor/ and enforce that?

@stevekuznetsov
Copy link
Contributor

/meow space

@k8s-ci-robot
Copy link
Contributor

@stevekuznetsov: cat image

In response to this:

/meow space

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@BenTheElder
Copy link
Member

Any updates on this? imho we should get this finished and in and follow-up with a presubmit later.

@ixdy
Copy link
Member Author

ixdy commented Jan 29, 2018

waiting on final approval for kubernetes/repo-infra#60.

@BenTheElder
Copy link
Member

Seems I was only looking for confirmation on nits. Maybe we should merge than and nits can be addressed later?

@ixdy
Copy link
Member Author

ixdy commented Jan 29, 2018

OK, this PR is officially ginormous.

I've added several additional commits:

  • added a dependency on kubernetes/repo-infra for workspace_binary, which means you can now bazel run //:dep -- and get the right version
  • updated the docs around dependencies to mention version, how to use bazel run, and the need to run hack/update-deps.sh too
  • created a simple prow job (copied from verify-config) which runs hack/verify-deps.sh, but only when anything deps-related has changed

PTAL

@BenTheElder
Copy link
Member

OK, this PR is officially ginormous.

We need a new size label? 😂

@k8s-ci-robot
Copy link
Contributor

@BenTheElder: dog image

In response to this:

scripts, bazel, dep config, presubmit LGTM, vendor/ == 🤷‍♂️

/lgtm
/hold
/shrug
/meow space
/woof
/joke

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot
Copy link
Contributor

@BenTheElder: Do you want a brief explanation of what an acorn is? In a nutshell, it's an oak tree.

In response to this:

scripts, bazel, dep config, presubmit LGTM, vendor/ == 🤷‍♂️

/lgtm
/hold
/shrug
/meow space
/woof
/joke

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the ¯\_(ツ)_/¯ ¯\\\_(ツ)_/¯ label Jan 30, 2018
Copy link
Member

@BenTheElder BenTheElder left a comment

Choose a reason for hiding this comment

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

scripts, bazel, dep config, presubmit LGTM. vendor/ == 🤷‍♂️

/lgtm
/hold
/shrug
/meow space
/woof
/joke

@k8s-ci-robot
Copy link
Contributor

@BenTheElder: cat image

In response to this:

scripts, bazel, dep config, presubmit LGTM, vendor/ == 🤷‍♂️

/lgtm
/hold
/shrug
/meow space
/woof
/joke

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BenTheElder, fejta, ixdy

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:
  • OWNERS [BenTheElder,fejta,ixdy]

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@BenTheElder
Copy link
Member

better yet since this is all about vendor and sandboxing:
/meow boxes

@k8s-ci-robot
Copy link
Contributor

@BenTheElder: cat image

In response to this:

better yet since this is all about vendor and sandboxing:
/meow boxes

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ixdy
Copy link
Member Author

ixdy commented Jan 30, 2018

ok, I'm reasonably sure this works.

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 30, 2018
@ixdy
Copy link
Member Author

ixdy commented Jan 30, 2018

I'll note that the verify job I added here is only running hack/verify-deps.sh, which doesn't call dep, just the hack/prune-libraries.sh script. I'm not sure if we want to add a dep ensure step to this check, much like the kubernetes/kubernetes verify-deps.sh check.

@k8s-ci-robot k8s-ci-robot merged commit f03c297 into kubernetes:master Jan 30, 2018
@k8s-ci-robot
Copy link
Contributor

@ixdy: I updated Prow config for you!

In response to this:

It does seem like the new release of dep does a better job of removing unused libraries.

In this PR, I enabled the new prune options (I turned off pruning non-go files, because Bazel).

I then ran dep ensure followed by hack/update-bazel.sh - I didn't run any of @fejta's other dep scripts in hack/. It seems like it removed some dependencies that the scripts missed, but potentially added some it had removed?

Amazingly, bazel build ... && bazel test ... still works.

fixes #5488

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ixdy
Copy link
Member Author

ixdy commented Jan 30, 2018

The verify job appears to be basically doing the right thing - it at least verifies that you've run hack/prune-libraries.sh, hopefully through hack/update-deps.sh.

@ixdy ixdy deleted the godep-prune-options branch May 15, 2018 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. 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.

When dep supports excluding vendored tests, remove checking for them
6 participants