-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Run tests on arm64 as well #600
Conversation
fe2b82b
to
21a2ff9
Compare
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 cool stuff!
I don't have much expertise in Bazel, so Unfortunately I cannot comment on what would be the best approach to build and test based on the environment. (Strange, I feel like this kind of feature should be a basic component in any testing frameworks.) But as long as it works, this is a great progress.
cloudbuild.yaml
Outdated
docker tag bazel/base:base_root_arm64_debian9 gcr.io/$PROJECT_ID/base:latest-arm64 | ||
docker tag bazel/base:base_root_arm64_debian9 gcr.io/$PROJECT_ID/base:nonroot-arm64 | ||
docker tag bazel/base:debug_root_arm64_debian9 gcr.io/$PROJECT_ID/base:debug-arm64 | ||
docker tag bazel/base:debug_root_arm64_debian9 gcr.io/$PROJECT_ID/base:debug-nonroot-arm64 |
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.
docker tag bazel/base:base_root_arm64_debian9 gcr.io/$PROJECT_ID/base:latest-arm64 | |
docker tag bazel/base:base_root_arm64_debian9 gcr.io/$PROJECT_ID/base:nonroot-arm64 | |
docker tag bazel/base:debug_root_arm64_debian9 gcr.io/$PROJECT_ID/base:debug-arm64 | |
docker tag bazel/base:debug_root_arm64_debian9 gcr.io/$PROJECT_ID/base:debug-nonroot-arm64 | |
docker tag bazel/base:base_root_arm64_debian9 gcr.io/$PROJECT_ID/base:latest-arm64 | |
docker tag bazel/base:base_nonroot_arm64_debian9 gcr.io/$PROJECT_ID/base:nonroot-arm64 | |
docker tag bazel/base:debug_root_arm64_debian9 gcr.io/$PROJECT_ID/base:debug-arm64 | |
docker tag bazel/base:debug_nonroot_arm64_debian9 gcr.io/$PROJECT_ID/base:debug-nonroot-arm64 |
And likewise, eventually we should also tag these in -debian9
.
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.
Good catch! re: -debian9
I think we need a better strategy for scripting the variants, but totally agree. This is quite tedious to keep straight as-is 😅
docker tag bazel/base:base_root_amd64_debian9 gcr.io/$PROJECT_ID/base:${COMMIT_SHA} | ||
docker tag bazel/base:base_root_amd64_debian9 gcr.io/$PROJECT_ID/base:latest-amd64 | ||
docker tag bazel/base:base_root_amd64_debian9 gcr.io/$PROJECT_ID/base-debian9:${COMMIT_SHA} | ||
docker tag bazel/base:base_root_amd64_debian9 gcr.io/$PROJECT_ID/base-debian9:latest |
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.
Ideally and eventually, I think this should be a manifest list. We've maintained that base
and base-debian9
are basically identical. (And same for -debian10
.) But I guess you're adding manifest lists only to base
as a start?
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.
Yeah, I wanted to plumb through the main things for each first. I think we need a bigger discussion around how we (likely) script these variations to cut down on the boilerplate (and sorts of errors I had above)
I pushed a commit with the couple edits called out. I added the |
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 to me.
name = "debug_" + user + "_" + arch + distro_suffix, | ||
architecture = arch, | ||
base = ":base_" + user + "_" + arch + distro_suffix, | ||
directory = "/", |
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.
Maybe directory
is unnecessary, as it's default is /
?
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 think this is just an indentation thing, I didn't change this.
container_test( | ||
name = "openssl_" + arch + distro_suffix + "_test", | ||
configs = ["testdata/certs.yaml"], | ||
image = ":base_root_" + arch + distro_suffix, |
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.
Is it meaningful to parameterize user (here and tests below) given that we're in a loop, or it is not worth?
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 could look at doing this more, it wasn't clear to me if/which of these tests might do something privileged, so I tried to avoid creeping the scope too much.
The one thing I did make a point to do was make the pure-go test use static, which I believe previously had zero direct test coverage.
@chanseokoh if it's alright I am going to punt on further churn here (since both are pre-existing limitations, and I want to maintain sanity rebasing the other changes), but I agree with the cleanups / experiments you suggest. I can try to follow up with these on top of the fuller chain of changes 🙏 |
Note: there are some other funny warts I haven't addressed, like plumbing root/nonroot through all the variants (I don't think //cc or python2.7 have it, but python3 does). |
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.
Sounds good! Thanks for the awesome work.
Enable travis builds of arm64 in addition to amd64, and extend the multi-arch support to include everything under
//base
, including thecontainer_test
rules.This required quite a few changes across a number of repos. Thanks to @nkubala for the quick turnaround on PRs to the structure test repo, and the 1.9.1 release. The one outstanding PR is to pull the 1.9.1 release into rules_docker here: bazelbuild/rules_docker#1639.
Unfortunately, Bazel's support for filtering targets by architecture is still pretty weak. I tried a half dozen options from constraints (
restricted_to
) to config settings (select
) and at best I could make the targets on mismatched platforms emit an error, but Bazel doesn't yet support filtering them (and the issue is >3 years old).The workaround I was able to find is similar to how Google runs integration testing internally, which is to tag the tests as
tags = ["manual"]
and then to run specific targets, however, I also included the architecture the test is expected to run on, e.g.tags = ["manual", "amd64"]
. Then in Travis I usebazel query
to pull out all of the appropriate tests for each architecture and run them explicitly. This required me to tag all of the existing tests (that haven't moved) asamd64
explicitly, but as we move these to loops overARCHITECTURES
we would use the appropriate architecture and thearm64
support should "just work" 🤞We shouldn't merge this until I'm able to rebase on the merged rules_docker PR, but I'd appreciate it if folks would take a look and leave any other comments they might have. 🙏