-
Notifications
You must be signed in to change notification settings - Fork 8.1k
makefile, test and scripts updates to use go toolchain instead of bazel. #2220
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
Conversation
Moved the local k8s apiserver testing env from circleci scripts.
For go build/test, use the local k8s for unit tests - not only avoids poluting the source tree, but it was dangerous to run unit test against a user real k8s config. Envoy is also tested from the output directory instead of source tree.
The circleci scripts were excluding those tests. Doug's script will automate generation - this PR doesn't include the bazel generate and copy since it's going away.
Doug's change for standalone generation should generate all files, this PR doesn't add back the bazel gen.
The GOPATH is mapped on the same location in the container, and the build runs as the current user.
The bazel part (with the user's real cluster linked and used by unit tests) will go away when we stop using bazel.
First use KUBECONFIG, then the kube/platform/config which might be a safe config. Last use the users' .kube/config - with a warning.
Codecov Report
@@ Coverage Diff @@
## master #2220 +/- ##
==========================================
- Coverage 78.24% 78.05% -0.19%
==========================================
Files 205 206 +1
Lines 18342 18251 -91
==========================================
- Hits 14351 14246 -105
- Misses 3242 3258 +16
+ Partials 749 747 -2
Continue to review full report at Codecov.
|
This is only needed for the transition.
Bazel is failing again for me with an obscure message - the build files are written blindly, it appears prow still works.
export OUT=${TOP}/out | ||
|
||
# components used in the test (starting with circleci for consistency, eventually ci will use this) | ||
export K8S_VER=v1.7.4 |
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 is very old. 1.9 just got released.
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.
Using same version that circleci is using, and I believe it's the min. version of k8s we support.
We can run test envs with 1.9 as well.
} | ||
|
||
return f | ||
return k8s.Kubeconfig("/../../../../../pilot/platform/kube/config") |
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.
Where's the file being symlinked?
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.
In the old bazel - I'm not changing anything, I assume scripts will do it.
For go/make: it is no longer used. Once bazel is out I'll also remove this line, and only use
KUBECONFIG and the localhost/standalone apiserver conf for unit tests, and whatever the new
testing framework uses for integration ( most tests can be run in multiple environments ).
@@ -1,11 +1,11 @@ | |||
// Code generated by protoc-gen-gogo. DO NOT EDIT. | |||
// source: bazel-out/local-fastbuild/genfiles/mixer/tools/codegen/pkg/interfacegen/testdata/apa_tmpl.proto | |||
// source: bazel-out/k8-fastbuild/genfiles/mixer/tools/codegen/pkg/interfacegen/testdata/apa_tmpl.proto |
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.
Unnecessary change?
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.
Automated scripts... Will try to remove it, but once Doug has his PR in I assume all those will
be replaced.
Looks reasonable. I'd like to keep a check on the bash scripting that will be happening with the Makefile approach. I think what you have here for spinning up local apiserver is OK, but if there's a third party project that can do that (even if it's minikube), I'd prefer that. Also, I see a lot of |
On the shell script: it's replicating what circleci has been doing for now, but eventually this will be migrated into the new test framework, as one of the environments. For 'unit test' having the etcd/apiserver is a reasonable option, but the goal is to be able to run |
/retest |
--tls-cert-file ${CERTDIR}/apiserver.crt \ | ||
--tls-private-key-file ${CERTDIR}/apiserver.key \ | ||
--service-cluster-ip-range 10.99.0.0/16 \ | ||
--port 8080 -v 2 --insecure-bind-address 0.0.0.0 \ |
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.
Define 8080 and ranges as constants before the command?
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.
The port - yes, I'm planning to do this - current code is cut&pasted from circleci, but for running on
local machine it probably needs more customization. However not top priority, after it works we can
fine tune it... (and better yet - this can be moved into the new test framework !)
Need to keep bazel default until everythign else is in.
/retest |
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.
In general, this looks reasonable to me. Most important thing is to get it all passing, then we can come back and clean up.
Makefile
Outdated
go install istio.io/istio/pilot/cmd/sidecar-initializer | ||
|
||
.PHONY: mixs | ||
mixs: vendor |
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'm not clear where this belongs, but at some point we need to add a generate
target that can call go generate istio.io/istio/...
before it does a full build.
echo "updating autogen files..." | ||
bin/regenerate_files.py | ||
#echo "updating autogen files..." | ||
#bin/regenerate_files.py |
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.
as above, we need something to do proper generation somewhere. i don't have strong informed opinions on where, however.
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 don't know if people are more likely to install the pre-submit hook (I forget sometimes), or to
run make / test.
But it's clear make will need to have the target - so maybe we can start with having it in the makefile.
# Predefined: | ||
# - minikube: will start a regular minikube in a VM | ||
# | ||
function lunch() { |
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.
was this written around midday 😜 ?
s/lunch/launch (here and in the 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.
No, 8 years of android ( envsetup and lunch are the first 2 commands android devs type every day).
https://source.android.com/setup/building
@@ -177,7 +177,8 @@ spec: | |||
` | |||
) | |||
|
|||
func TestServer(t *testing.T) { | |||
//https://github.com/istio/istio/issues/2300 | |||
func xTestServer(t *testing.T) { |
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.
there is an outstanding PR to fix this. Should we merge that first and then drop this change?
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.
Either way - if it gets merged before I finish (likely), I'll drop.
And finally prow is happy !!! Still missing (separate PRs):
|
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: douglas-reid The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue. |
Multiple changes to improve build and testing with the go toolchain.
presubmit changes to use go tools.
stop using the k8s config linked from the user home to some dir that gets picked by bazel.
It is pretty dangerous and flaky - unit tests are actually run against whatever cluster the
developer has set, may affect a live cluster. It also pollutes the source tree and is not standard
go. Refactored the files using config to use a common method.
script equivalent with the circleci local unit test env, consisting of etcd+apiserver.
checkin few missing files, pending Dougz full move to make/shell generation for automation.
Current circleci build simply excludes the tests.