pr-pull: fetch artifacts with no-resume strategy
This commit is contained in:
parent
9e4dfaf726
commit
c1ba9975b8
@ -5,6 +5,14 @@ require "utils/github"
|
||||
require "tmpdir"
|
||||
require "bintray"
|
||||
|
||||
class CurlNoResumeDownloadStrategy < CurlDownloadStrategy
|
||||
private
|
||||
|
||||
def _fetch(url:, resolved_url:)
|
||||
curl("--location", "--remote-time", "--create-dirs", "--output", temporary_path, resolved_url)
|
||||
end
|
||||
end
|
||||
|
||||
module Homebrew
|
||||
module_function
|
||||
|
||||
@ -192,7 +200,9 @@ module Homebrew
|
||||
if Homebrew.args.dry_run?
|
||||
puts "Upload bottles described by these JSON files to Bintray:\n #{Dir["*.json"].join("\n ")}"
|
||||
else
|
||||
bintray.upload_bottle_json Dir["*.json"], publish_package: !args.no_publish?
|
||||
bintray.upload_bottle_json Dir["*.json"],
|
||||
publish_package: !args.no_publish?,
|
||||
strategy: CurlNoResumeDownloadStrategy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -435,7 +435,8 @@ module GitHub
|
||||
scopes: CREATE_ISSUE_FORK_OR_PR_SCOPES)
|
||||
end
|
||||
|
||||
def fetch_artifact(user, repo, pr, dir, workflow_id: "tests.yml", artifact_name: "bottles")
|
||||
def fetch_artifact(user, repo, pr, dir,
|
||||
workflow_id: "tests.yml", artifact_name: "bottles", strategy: CurlDownloadStrategy)
|
||||
scopes = CREATE_ISSUE_FORK_OR_PR_SCOPES
|
||||
base_url = "#{API_URL}/repos/#{user}/#{repo}"
|
||||
pr_payload = open_api("#{base_url}/pulls/#{pr}", scopes: scopes)
|
||||
@ -496,7 +497,7 @@ module GitHub
|
||||
FileUtils.chdir dir do
|
||||
curl_args[:cache] = Pathname.new(dir)
|
||||
curl_args[:secrets] = [token]
|
||||
downloader = CurlDownloadStrategy.new(artifact_url, "artifact", pr, **curl_args)
|
||||
downloader = strategy.new(artifact_url, "artifact", pr, **curl_args)
|
||||
downloader.fetch
|
||||
downloader.stage
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user