-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
custom download strategy no longer works after commit fbf474a3fd107b636eb397b0aa247f7e03f2dc72 #15169
Comments
Without a built in GitHub release asset download strategy, it's very likely that this will continue to break. There are already a number of custom GitHub download strategies, I wonder if this is something that would make sense to check in upstream (ie., in homebrew)? |
@jrouly We don't support installing from private repositories and wouldn't use it ourselves so: no, we're not good candidates for maintainers for this code. |
I think I have already said this a few years ago when this broke in a similar way: We need to deprecate this way of allowing custom download strategies and replace it with a simpler API with less surface area. It's way too brittle in the current state since only the |
I'm having this same issue. I am also using the private release download strategy very similar to the one linked above. I was able to fix this by adding this override to my def resolve_url_basename_time_file_size(url, timeout: nil)
[download_url, "", Time.now, 0, false]
end Any advice on how to fix this on my end in a more robust way? |
I think adding def resolved_basename
@filename
end instead should work. |
Thank you for the reply. Unfortunately this did not work for me. Looks like parsed_output = curl_head(url.to_s, timeout: timeout) |
We ran into this as well. The change suggested by @Brunope resolved the issue for us as well. It sounds like private repository support won't come in homebrew core. @MikeMcQuaid do you have any guidance on how the community better manages this in the future in order to avoid these codebase conflicts? Homebrew is a great package manager for opensource packages, which is why other organizations (perhaps startups like mine) rely on an existing and known tool for distributing internal packages. The way it sounds like we're all accomplishing this is adding per-tap custom download strategies that each org needs to update every time there is a download strategy base class change. |
Is it accurate to say that the stance of the Homebrew project is:
|
I stumbled upon the same issue, and Inheriting from |
Note that Either that, or make the API public and then add unit tests to make sure we don't break it again. |
So the breaking change here is that the HEAD operation now fails if not found rather than ignore and continue? |
We were able to workaround this by overriding the def resolve_url_basename_time_file_size(url, timeout: nil)
url = download_url
super
end We specifically are using this gist for our private strategy. |
Seeing similar recent breakage with our internal Artifactory downloads |
Okay, so for private GitHub releases, it should be possible to do this without any custom download strategy by specifying the headers in the formula and using the API URL directly, e.g. url "https://api.github.com/repos/Homebrew/homebrew-portable-ruby/releases/assets/103219629",
headers: [
"Accept: application/octet-stream",
"Authorization: bearer #{ENV["HOMEBREW_GITHUB_API_TOKEN"]}"
] Of course you'll likely have to specify |
Sorry, I don't understand this. What do you mean by "standard URL"? https://github.com/ORG_NAME/REPO_NAME/archive/refs/tags/v1.tar.gz works, after following the redirect. |
So why does the custom download strategy need to fetch the asset ID in the first place if the URL works as is? |
It doesn't! 😁 (At least the custom strategy I'm using doesn't do that, it uses the url directly). I'll give your solution a try. Thanks! |
The one linked to in the issue does this, I guess it's not needed anymore. The |
Your URL is a repository archive (tarball) URL though, not a release asset URL, so there may still be a difference. |
Ahh yes, but I can confirm that your code above does work, when using the archive URL (Which is a link to the asset from the release page). I no longer need a custom strategy, thanks! |
Brew changed how CurlDownloadStrategy works in a recent commit which broke our custom download strategy. Ref. Homebrew/brew#15169
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
brew doctor
outputVerification
brew doctor
output" above saysYour system is ready to brew.
and am still able to reproduce my issue.brew update
twice and am still able to reproduce my issue.brew install wget
. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.brew config
outputWhat were you trying to do (and why)?
I try to "brew install" a private repo, with a custom download strategy configured.
The download strategy is taken from https://dev.to/jhot/homebrew-and-private-github-repositories-1dfh.
The strategy used is GitHubPrivateRepositoryReleaseDownloadStrategy.
If I roll back the commit, referenced by fbf474a, it works.
What happened (include all command output)?
What did you expect to happen?
❯ brew reinstall handelsblattgroup/tap/kundetools
==> Fetching handelsblattgroup/tap/kundetools
==> Downloading https://github.com/handelsblattgroup/kunde2go-tools/releases/download/v3.0.0/kunde2go-tools_Darwin_x86_64.tar.gz
Already downloaded: /Users/xxx/Library/Caches/Homebrew/downloads/7e981c9e344d9fd5524ce1dc953191b2beceb8efba5c8283a53c1a0e4fbc4856--kunde2go-tools_Darwin_x86_64.tar.gz
==> Reinstalling handelsblattgroup/tap/kundetools
==> Caveats
zsh completions have been installed to:
/usr/local/share/zsh/site-functions
==> Summary
🍺 /usr/local/Cellar/kundetools/3.0.0: 6 files, 13.6MB, built in 4 seconds
==> Running
brew cleanup kundetools
...Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see
man brew
).`Step-by-step reproduction instructions (by running
brew
commands)The text was updated successfully, but these errors were encountered: