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

Update blackbox tests to use rules_pkg instead of built-ins for pkg_tar #9046

Closed
wants to merge 13 commits into from

Conversation

aiuto
Copy link
Contributor

@aiuto aiuto commented Aug 1, 2019

We add rules_pkg to the generated WORKSPACE for integration tests.

A better solution may be to figure out why we need tar for the repo tests. If we can eliminate that, a lot of problems go away., but that job belongs to the external deps team.

WIP: Alas, things fail because starlark is getting rid of the outputs attribute, and the test runs with the incompatible changes on. We have to fix that in rules_pkg and use version 0.2.1 of that

WIP: This solution is super brittle because we have to repeat repo urls and sha256 identically in many places. #8986. Since I have a few weeks before I have to do this, perhaps we can come up with a better design for #8986 now and work towards that. @philwo: do you want me to propose one or do you want to take a stab at it.

We add rules_pkg to the default WORKSPACE and then try to use that.
Alas, things fail because starlark is getting rid of the outputs
attribute, and the test runs with the incompatible changes on.

A better solution may be to figure out why we need tar for
the repo tests. If we can eliminate that, a lot of problems
go away.
@aiuto aiuto added team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. WIP labels Aug 1, 2019
@aiuto aiuto requested a review from philwo August 1, 2019 16:06
@philwo
Copy link
Member

philwo commented Aug 27, 2019

Sorry, I won't have time for this, happy to review a working PR, but can't do anything else :/

aiuto added 3 commits March 11, 2020 09:11
//src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace:GitRepositoryBlackBoxTest FAILED in 50.5s
//src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace:WorkspaceBlackBoxTest FAILED in 68.7s

The entire test scheme is wonky, in that it depends on pkg_tar in the first place.
Something is going wrong with the indirect loading of the rules via
RepoWithRuleWritingTextGenerator
@philwo
Copy link
Member

philwo commented Mar 17, 2020

I saw this error in your tests:

ERROR: An error occurred during the fetch of repository 'rules_pkg':
   java.io.IOException: Error downloading [https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.2.5/rules_pkg-0.2.5.tar.gz, https://github.com/bazelbuild/rules_pkg/releases/download/0.2.5/rules_pkg-0.2.5.tar.gz] to /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/ec321eb2cc2d0f8f91b676b6d4c66c29/sandbox/linux-sandbox/3184/execroot/io_bazel/_tmp/69f12340b17380b035a0a8ebbbfbe1ac/root6921373952495163105/a98fd7f2a261cbcdaf147d0d0ed54db5/external/rules_pkg/rules_pkg-0.2.5.tar.gz: Unknown host: github.com
ERROR: no such package '@rules_pkg//': java.io.IOException: Error downloading [https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.2.5/rules_pkg-0.2.5.tar.gz, https://github.com/bazelbuild/rules_pkg/releases/download/0.2.5/rules_pkg-0.2.5.tar.gz] to /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/ec321eb2cc2d0f8f91b676b6d4c66c29/sandbox/linux-sandbox/3184/execroot/io_bazel/_tmp/69f12340b17380b035a0a8ebbbfbe1ac/root6921373952495163105/a98fd7f2a261cbcdaf147d0d0ed54db5/external/rules_pkg/rules_pkg-0.2.5.tar.gz: Unknown 

We run tests without network access by default now and override repositories used by integration tests to be the same as the repos from the "outer" Bazel. Relevant changes that explain what's going on here:

You probably just have to add rules_pkg to this list to fix the test failures: https://github.com/bazelbuild/bazel/blob/master/src/test/java/com/google/devtools/build/lib/blackbox/bazel/DefaultToolsSetup.java#L30

Also we have to make sure that the version of rules_pkg in Bazel's WORKSPACE file and the one specified in the test's WORKSPACE file is the same. So we should bump rules_pkg in Bazel's WORKSPACE also to 0.2.5 and add a comment where to keep the two in sync.

@aiuto
Copy link
Contributor Author

aiuto commented Mar 17, 2020

https://github.com/bazelbuild/bazel/blob/master/src/test/java/com/google/devtools/build/lib/blackbox/bazel/DefaultToolsSetup.java#L30

Thanks. I missed that one.

Also we have to make sure that the version of rules_pkg in Bazel's WORKSPACE file and the one specified in the test's WORKSPACE file is the same. So we should bump rules_pkg in Bazel's WORKSPACE also to 0.2.5 and add a comment where to keep the two in sync.

That is a nice to have, but not actually needed. Since we only use pkg_tar to package bazel, and for anything else, this integration test could use any version of it. That points to some of the strangeness here. It makes a tarball, but then never uses it. I have mail out to the original author to confirm my suspicion that pkg_tar was just a convenient way to have a rule that writes content based on another rule and have it done at workspace time.

@aiuto aiuto removed the WIP label Apr 22, 2020
@aiuto
Copy link
Contributor Author

aiuto commented Apr 22, 2020

Damm. Broken possibly because of #9029. Need to come back to this next month.

@aiuto aiuto changed the title WIP: Update blackbox tests to use rules_pkg instead of built-ins for pkg_tar Update blackbox tests to use rules_pkg instead of built-ins for pkg_tar Apr 22, 2020
@aiuto aiuto added the WIP label Apr 23, 2020
@aiuto
Copy link
Contributor Author

aiuto commented Apr 23, 2020

https://github.com/bazelbuild/bazel/blob/master/src/test/java/com/google/devtools/build/lib/blackbox/bazel/DefaultToolsSetup.java#L30

Thanks. I missed that one.

Also we have to make sure that the version of rules_pkg in Bazel's WORKSPACE file and the one specified in the test's WORKSPACE file is the same. So we should bump rules_pkg in Bazel's WORKSPACE also to 0.2.5 and add a comment where to keep the two in sync.

That is a nice to have, but not actually needed. Since we only use pkg_tar to package bazel, and for anything else, this integration test could use any version of it. That points to some of the strangeness here. It makes a tarball, but then never uses it. I have mail out to the original author to confirm my suspicion that pkg_tar was just a convenient way to have a rule that writes content based on another rule and have it done at workspace time.

Oh. My bad. I didn't read your comment about forcing repositories to be the outer ones. So yes. I do have to update all of Bazel. PR #11191 will do that first.

@philwo philwo added the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Jun 15, 2020
@aiuto
Copy link
Contributor Author

aiuto commented Sep 24, 2020

I'm rethinking this. These tests should not have to depend on @rules_pkg. They should be rewritten to be self contained.

@aiuto aiuto marked this pull request as draft November 10, 2020 16:36
@aiuto aiuto removed the request for review from philwo November 10, 2020 16:36
@aiuto aiuto removed the WIP label Nov 10, 2020
@aiuto
Copy link
Contributor Author

aiuto commented Feb 9, 2021

This PR won't work any more.

@aiuto aiuto closed this Feb 9, 2021
@philwo philwo removed the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants