-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 kube::util::find-binary to find kubectl #1844
Conversation
035b1d0
to
29e025d
Compare
hack/ci/e2e-k8s.sh
Outdated
# This is run from k/k root, so shellcheck shouldn't expect to be able to | ||
# follow hack/lib/util.sh. | ||
# shellcheck disable=SC1091 | ||
kubectl_path="$(source hack/lib/util.sh; kube::util::find-binary '.test')" |
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.
# TODO: remove this, it was fixed in 1.13+ | ||
mkdir -p '_output/bin/' | ||
cp 'bazel-bin/test/e2e/e2e.test' '_output/bin/' | ||
PATH="$(dirname "$(find "${PWD}/bazel-bin/" -name kubectl -type f)"):${PATH}" |
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 isn't this sufficient? most of the kube::util::find-binary
logic is for the makefile output.
is there a non-executable file in bazel-bin named kubectl
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.
I suspect it would work fine to use find right now but I'm not very familiar with how we use the bazel cache and future changes (e.g. cross building in the same CI pool) might subtly cause issues. kube::util::find-binary
is more complex but it does a reasonable job. I don't feel too strongly either way. Yet another option is to use cluster/kubectl.sh like other CI jobs.
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.
Pushed a fourth option that doesn't depend on kube::util::find-binary
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 can't cross build in bazel still because of CGO, we have never run cross build in CI.
locally might be unfortunate though ...
hack/ci/e2e-k8s.sh
Outdated
@@ -1,4 +1,4 @@ | |||
#!/bin/sh | |||
#!/bin/bash |
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 was intentionally written in posix sh since the logic is simple.
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.
Switched in order to source hack/lib/util.sh. Thought process: bash is fairly universal nowadays, used in most places in k/*, and all other shell scripts in this directory use bash. It can still be simple even if it's bash :)
747fb3a
to
f19df36
Compare
/retest |
4d55270
to
f19df36
Compare
To centralize binary selection in k/k. Also drop the e2e.test copying which is no longer needed according to the comment.
@@ -67,16 +67,16 @@ build_with_bazel() { | |||
# make sure we have e2e requirements | |||
bazel build //cmd/kubectl //test/e2e:e2e.test //vendor/github.com/onsi/ginkgo/ginkgo | |||
|
|||
kubectl_path="$(bazel aquery 'mnemonic("GoLink", //cmd/kubectl)' \ | |||
| grep '^ Outputs: \[.*\]$' \ | |||
| sed 's/^ Outputs: \[\(.*\)\]$/\1/')" |
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.
neat ...
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: BenTheElder, mikedanese The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
To centralize binary selection in k/k. Also drop the e2e.test copying
which is no longer needed according to the comment.