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

change cURL download behaviour for HOMEBREW_ARTIFACT_DOMAIN. #13258

Merged
merged 1 commit into from
Jun 14, 2022
Merged

change cURL download behaviour for HOMEBREW_ARTIFACT_DOMAIN. #13258

merged 1 commit into from
Jun 14, 2022

Conversation

UiP9AV6Y
Copy link

@UiP9AV6Y UiP9AV6Y commented May 7, 2022

instead of prefixing and/or replacing data in URLs, the
HOMEBREW_ARTIFACT_DOMAIN environment variable only replaces
the bottle base URL. this causes URLs from Casks and other assets
to be no longer affected by this feature.

closes #13226
closes #13222
obsoletes #13227

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

@MikeMcQuaid
Copy link
Member

@UiP9AV6Y Thanks for the PR! It's broken some tests that need fixed.

How do HOMEBREW_ARTIFACT_DOMAIN and HOMEBREW_BOTTLE_DOMAIN differ in terms of functionality after this change?

@UiP9AV6Y
Copy link
Author

@UiP9AV6Y Thanks for the PR! It's broken some tests that need fixed.

yes, i have added test cases for this feature, which
i had to figure out how to mock properly. should be fixed now

How do HOMEBREW_ARTIFACT_DOMAIN and HOMEBREW_BOTTLE_DOMAIN differ in terms of functionality after this change?

HOMEBREW_BOTTLE_DOMAIN is deprecated

@MikeMcQuaid
Copy link
Member

HOMEBREW_BOTTLE_DOMAIN is deprecated

This was reverted again in #11793.

@MikeMcQuaid
Copy link
Member

yes, i have added test cases for this feature, which
i had to figure out how to mock properly. should be fixed now

Seems to be, thanks!

@UiP9AV6Y
Copy link
Author

HOMEBREW_BOTTLE_DOMAIN is deprecated

This was reverted again in #11793.

not sure how i have missed that tbh. i also did not find it in the manpage on the homepage itself when i was looking.

anyway, since HOMEBREW_BOTTLE_DOMAIN is still supported, this PR is therefor obsolete. instead i will open a new PR to address the lack of support for HOMEBREW_DOCKER_REGISTRY_BASIC_AUTH_TOKEN and HOMEBREW_DOCKER_REGISTRY_TOKEN when using HOMEBREW_BOTTLE_DOMAIN b/c right now it is only used in combination with HOMEBREW_ARTIFACT_DOMAIN

sorry for the noise

@UiP9AV6Y UiP9AV6Y closed this May 22, 2022
@@ -459,7 +459,7 @@ def resolve_url_basename_time_file_size(url, timeout: nil)
return @resolved_info_cache[url] if @resolved_info_cache.include?(url)

if (domain = Homebrew::EnvConfig.artifact_domain)
url = url.sub(%r{^(https?://#{GitHubPackages::URL_DOMAIN}/)?}o, "#{domain.chomp("/")}/")
url = url.sub(%r{^https?://#{GitHubPackages::URL_DOMAIN}/}o, "#{domain.chomp("/")}/")
Copy link
Member

Choose a reason for hiding this comment

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

It seems like this may still be a desirable change? Thoughts?

Copy link
Author

Choose a reason for hiding this comment

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

not really if i understand the codebase correctly. while this logic is implemented in a Curl base class, which is used by a variety of ther download stategies, it really only affects GitHubPackages::URL_DOMAIN, which is where the GithubPackages download stategy comes into play; and that can be influence with the HOMEBREW_BOTTLE_DOMAIN variable.

going forward with this change would essentially make HOMEBREW_BOTTLE_DOMAIN and HOMEBREW_ARTIFACT_DOMAIN somewhat equal (albeight being implemented differently)

with #13313 on the horizon, even authentication can be
supported for both scenarios.

Copy link

Choose a reason for hiding this comment

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

So missed that this was not merged for the 3.5.x release. My issue didn't have anything to do with Authentication and it was the fact that the Packages URL was incorrectly prefixing Cask URLs. So that change that @MikeMcQuaid you call out is key for that to work and I think was a bug that creeped in on the original work. I can't see any value on having a positive regex match on "https" and trigger a replace. I have tested w 3.5.1 and the cask download issue persists.

Can we get this PR re-reviewed for merge? The auth change won't obsolete this one. I know the JFrog team is also watching this one as well.

Copy link
Member

Choose a reason for hiding this comment

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

Can we get this PR re-reviewed for merge? The auth change won't obsolete this one. I know the JFrog team is also watching this one as well.

@byjrack The PR author closed the PR. If they want to reopen it they are welcome. It may make more sense for you to make your own PR, though.

Copy link

Choose a reason for hiding this comment

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

Yeah I had my original PR, but it was missing the tests so I will get my local env cleaned up and see about reopening my original one with this fix, the doc update, and the tests.

@UiP9AV6Y
Copy link
Author

How do HOMEBREW_ARTIFACT_DOMAIN and HOMEBREW_BOTTLE_DOMAIN differ in terms of functionality after this change?

setting HOMEBREW_BOTTLE_DOMAIN causes
brew to download bottles from a classical
filebased server instead of a container
registry. my intention was to setup a
container mirror for ghcr.io-hosted
bottles

@UiP9AV6Y UiP9AV6Y reopened this Jun 11, 2022
instead of prefixing and/or replacing data in URLs, the
*HOMEBREW_ARTIFACT_DOMAIN* environment variable only replaces
the bottle base URL. this causes URLs from Casks and other assets
to be no longer affected by this feature.

closes #13226
closes #13222
closes #13227
@byjrack
Copy link

byjrack commented Jun 13, 2022

@UiP9AV6Y thanks for reopening the PR. Looks like the check it failed was due to a rate limiter on the API and not code related so you may need to close/open again to re-trigger the checks.

@MikeMcQuaid MikeMcQuaid merged commit 0a053d0 into Homebrew:master Jun 14, 2022
@MikeMcQuaid
Copy link
Member

Thanks @UiP9AV6Y and @byjrack!

@github-actions github-actions bot added the outdated PR was locked due to age label Jul 15, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
3 participants