change cURL download behaviour for HOMEBREW_ARTIFACT_DOMAIN.
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
This commit is contained in:
parent
ad13524bcc
commit
bcfd20e1b9
@ -459,7 +459,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
|
||||
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("/")}/")
|
||||
end
|
||||
|
||||
output, _, _status = curl_output(
|
||||
|
@ -131,15 +131,13 @@ describe CurlDownloadStrategy do
|
||||
let(:artifact_domain) { "https://mirror.example.com/oci" }
|
||||
|
||||
context "with an asset hosted under example.com" do
|
||||
let(:status) { instance_double(Process::Status, success?: true, exitstatus: 0) }
|
||||
|
||||
it "prefixes the URL unchanged" do
|
||||
it "leaves the URL unchanged" do
|
||||
expect(strategy).to receive(:system_command).with(
|
||||
/curl/,
|
||||
hash_including(args: array_including_cons("#{artifact_domain}/#{url}")),
|
||||
hash_including(args: array_including_cons(url)),
|
||||
)
|
||||
.at_least(:once)
|
||||
.and_return(SystemCommand::Result.new(["curl"], [""], status, secrets: []))
|
||||
.and_return(instance_double(SystemCommand::Result, success?: true, stdout: "", assert_success!: nil))
|
||||
|
||||
strategy.fetch
|
||||
end
|
||||
|
@ -1938,7 +1938,7 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just
|
||||
*Default:* `native`.
|
||||
|
||||
- `HOMEBREW_ARTIFACT_DOMAIN`
|
||||
<br>Prefix all download URLs, including those for bottles, with this value. For example, `HOMEBREW_ARTIFACT_DOMAIN=http://localhost:8080` will cause a formula with the URL `https://example.com/foo.tar.gz` to instead download from `http://localhost:8080/https://example.com/foo.tar.gz`. Bottle URLs however, have their domain replaced with this prefix. This results in e.g. `https://ghcr.io/v2/homebrew/core/gettext/manifests/0.21` to instead be downloaded from `http://localhost:8080/v2/homebrew/core/gettext/manifests/0.21`
|
||||
<br>Download bottle assets from with this value. For example, `HOMEBREW_ARTIFACT_DOMAIN=http://localhost:8080/mirror` will cause bottle metadata hosted at `https://ghcr.io/v2/homebrew/core/example/manifests/0.1` to instead download from `http://localhost:8080/mirror/v2/homebrew/core/example/manifests/0.1`. Other URLs such as those from Casks are *not* affected by this feature. It is intended to be used with container image mirrors/caches. For caching of arbitrary assets, see `http_proxy`.
|
||||
|
||||
- `HOMEBREW_AUTO_UPDATE_SECS`
|
||||
<br>Run `brew update` once every `HOMEBREW_AUTO_UPDATE_SECS` seconds before some commands, e.g. `brew install`, `brew upgrade` and `brew tap`. Alternatively, disable auto-update entirely with HOMEBREW_NO_AUTO_UPDATE.
|
||||
|
Loading…
x
Reference in New Issue
Block a user