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 "tmpdir"
|
||||||
require "bintray"
|
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 Homebrew
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
@ -192,7 +200,9 @@ module Homebrew
|
|||||||
if Homebrew.args.dry_run?
|
if Homebrew.args.dry_run?
|
||||||
puts "Upload bottles described by these JSON files to Bintray:\n #{Dir["*.json"].join("\n ")}"
|
puts "Upload bottles described by these JSON files to Bintray:\n #{Dir["*.json"].join("\n ")}"
|
||||||
else
|
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
|
end
|
||||||
end
|
end
|
||||||
|
@ -435,7 +435,8 @@ module GitHub
|
|||||||
scopes: CREATE_ISSUE_FORK_OR_PR_SCOPES)
|
scopes: CREATE_ISSUE_FORK_OR_PR_SCOPES)
|
||||||
end
|
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
|
scopes = CREATE_ISSUE_FORK_OR_PR_SCOPES
|
||||||
base_url = "#{API_URL}/repos/#{user}/#{repo}"
|
base_url = "#{API_URL}/repos/#{user}/#{repo}"
|
||||||
pr_payload = open_api("#{base_url}/pulls/#{pr}", scopes: scopes)
|
pr_payload = open_api("#{base_url}/pulls/#{pr}", scopes: scopes)
|
||||||
@ -496,7 +497,7 @@ module GitHub
|
|||||||
FileUtils.chdir dir do
|
FileUtils.chdir dir do
|
||||||
curl_args[:cache] = Pathname.new(dir)
|
curl_args[:cache] = Pathname.new(dir)
|
||||||
curl_args[:secrets] = [token]
|
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.fetch
|
||||||
downloader.stage
|
downloader.stage
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user