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

coursier: prefer the primary_url over mirrors #743

Merged
merged 1 commit into from
Sep 9, 2022

Conversation

dhalperi
Copy link
Contributor

@dhalperi dhalperi commented Sep 8, 2022

This is for #349 and tangentially for #723.

Users are often confused by (expected) 404s when using multiple Maven repositories. These 404s can be safely ignored (Bazel's repository fetching logic gracefully tries all mirrors), but they are chatty and there is as of yet no way to silence them.

See also: bazelbuild/bazel#13394

While we cannot solve the issue, we can reduce its impact by ordering the URLs: http_file is documented to try them in order:
https://bazel.build/rules/lib/repo/http#http_file-urls

Copy link
Contributor Author

@dhalperi dhalperi left a comment

Choose a reason for hiding this comment

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

FYI, I am assuming there will be tests to update, and that will help me figure out a new test to write as well.

@@ -1043,6 +1043,10 @@ def _coursier_fetch_impl(repository_ctx):
primary_artifact_path = infer_artifact_path_from_primary_and_repos(primary_url, repository_urls)

mirror_urls = [url + "/" + primary_artifact_path for url in repository_urls]
if primary_url in mirror_urls:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It wasn't obvious to me that this is guaranteed to be the case, but I also didn't see how it couldn't be.

Copy link
Contributor Author

@dhalperi dhalperi Sep 8, 2022

Choose a reason for hiding this comment

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

Ahh, auth makes it not true. <-- never mind this was wrong.

@dhalperi dhalperi force-pushed the order-mirrors branch 2 times, most recently from 1421102 to 6f96a40 Compare September 8, 2022 06:46
@@ -2175,34 +2175,34 @@
"url": "https://repo1.maven.org/maven2/com/microsoft/azure/adal4j/1.6.0/adal4j-1.6.0.jar"
},
{
"coord": "com.nimbusds:lang-tag:1.6",
"coord": "com.nimbusds:lang-tag:1.7",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

FYI repinning just did this upgrade to 1.7. I can add another version set to fix if preferred.

This is for bazelbuild#349
and tangentially for bazelbuild#723.

Users are often confused by (expected) 404s when using multiple Maven
repositories. These 404s can be safely ignored (Bazel's repository fetching
logic gracefully tries all mirrors), but they are chatty and there is as of yet
no way to silence them.

See also: bazelbuild/bazel#13394

While we cannot solve the issue, we can reduce its impact by ordering the URLs:
`http_file` is documented to try them in order:
https://bazel.build/rules/lib/repo/http#http_file-urls
@jin
Copy link
Member

jin commented Sep 9, 2022

Nice!

@shs96c shs96c merged commit d6884e6 into bazelbuild:master Sep 9, 2022
@dhalperi dhalperi deleted the order-mirrors branch September 12, 2022 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants