Merge pull request #13258 from UiP9AV6Y/bugfix_artifact_domain_bottles
change cURL download behaviour for HOMEBREW_ARTIFACT_DOMAIN.
This commit is contained in:
commit
0a053d091e
@ -459,7 +459,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
|
|||||||
return @resolved_info_cache[url] if @resolved_info_cache.include?(url)
|
return @resolved_info_cache[url] if @resolved_info_cache.include?(url)
|
||||||
|
|
||||||
if (domain = Homebrew::EnvConfig.artifact_domain)
|
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
|
end
|
||||||
|
|
||||||
output, _, _status = curl_output(
|
output, _, _status = curl_output(
|
||||||
|
|||||||
@ -131,15 +131,13 @@ describe CurlDownloadStrategy do
|
|||||||
let(:artifact_domain) { "https://mirror.example.com/oci" }
|
let(:artifact_domain) { "https://mirror.example.com/oci" }
|
||||||
|
|
||||||
context "with an asset hosted under example.com" do
|
context "with an asset hosted under example.com" do
|
||||||
let(:status) { instance_double(Process::Status, success?: true, exitstatus: 0) }
|
it "leaves the URL unchanged" do
|
||||||
|
|
||||||
it "prefixes the URL unchanged" do
|
|
||||||
expect(strategy).to receive(:system_command).with(
|
expect(strategy).to receive(:system_command).with(
|
||||||
/curl/,
|
/curl/,
|
||||||
hash_including(args: array_including_cons("#{artifact_domain}/#{url}")),
|
hash_including(args: array_including_cons(url)),
|
||||||
)
|
)
|
||||||
.at_least(:once)
|
.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
|
strategy.fetch
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1938,7 +1938,7 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just
|
|||||||
*Default:* `native`.
|
*Default:* `native`.
|
||||||
|
|
||||||
- `HOMEBREW_ARTIFACT_DOMAIN`
|
- `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`
|
- `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.
|
<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