pr-pull, pr-upload: add --warn-on-upload-failure
This commit is contained in:
parent
bd59b66c25
commit
204e56d01e
@ -50,12 +50,15 @@ class Bintray
|
|||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def publish(repo:, package:, version:, file_count:)
|
def publish(repo:, package:, version:, file_count:, warn_on_error: false)
|
||||||
url = "#{API_URL}/content/#{@bintray_org}/#{repo}/#{package}/#{version}/publish"
|
url = "#{API_URL}/content/#{@bintray_org}/#{repo}/#{package}/#{version}/publish"
|
||||||
result = open_api url, "--request", "POST", "--fail"
|
result = open_api url, "--request", "POST", "--fail"
|
||||||
json = JSON.parse(result.stdout)
|
json = JSON.parse(result.stdout)
|
||||||
if file_count.present? && json["files"] != file_count
|
if file_count.present? && json["files"] != file_count
|
||||||
raise "Bottle publish failed: expected #{file_count} bottles, but published #{json["files"]} instead."
|
message = "Bottle publish failed: expected #{file_count} bottles, but published #{json["files"]} instead."
|
||||||
|
raise message unless warn_on_error
|
||||||
|
|
||||||
|
opoo message
|
||||||
end
|
end
|
||||||
|
|
||||||
odebug "Published #{json["files"]} bottles"
|
odebug "Published #{json["files"]} bottles"
|
||||||
@ -143,7 +146,7 @@ class Bintray
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def upload_bottle_json(json_files, publish_package: false)
|
def upload_bottle_json(json_files, publish_package: false, warn_on_error: false)
|
||||||
bottles_hash = json_files.reduce({}) do |hash, json_file|
|
bottles_hash = json_files.reduce({}) do |hash, json_file|
|
||||||
hash.deep_merge(JSON.parse(IO.read(json_file)))
|
hash.deep_merge(JSON.parse(IO.read(json_file)))
|
||||||
end
|
end
|
||||||
@ -161,14 +164,19 @@ class Bintray
|
|||||||
|
|
||||||
odebug "Checking remote file #{@bintray_org}/#{bintray_repo}/#{filename}"
|
odebug "Checking remote file #{@bintray_org}/#{bintray_repo}/#{filename}"
|
||||||
if file_published? repo: bintray_repo, remote_file: filename
|
if file_published? repo: bintray_repo, remote_file: filename
|
||||||
raise Error, <<~EOS
|
already_published = "#{filename} is already published."
|
||||||
#{filename} is already published.
|
failed_message = <<~EOS
|
||||||
|
#{already_published}
|
||||||
Please remove it manually from:
|
Please remove it manually from:
|
||||||
https://bintray.com/#{@bintray_org}/#{bintray_repo}/#{bintray_package}/view#files
|
https://bintray.com/#{@bintray_org}/#{bintray_repo}/#{bintray_package}/view#files
|
||||||
Or run:
|
Or run:
|
||||||
curl -X DELETE -u $HOMEBREW_BINTRAY_USER:$HOMEBREW_BINTRAY_KEY \\
|
curl -X DELETE -u $HOMEBREW_BINTRAY_USER:$HOMEBREW_BINTRAY_KEY \\
|
||||||
https://api.bintray.com/content/#{@bintray_org}/#{bintray_repo}/#{filename}
|
https://api.bintray.com/content/#{@bintray_org}/#{bintray_repo}/#{filename}
|
||||||
EOS
|
EOS
|
||||||
|
raise Error, failed_message unless warn_on_error
|
||||||
|
|
||||||
|
opoo already_published
|
||||||
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
if !formula_packaged[formula_name] && !package_exists?(repo: bintray_repo, package: bintray_package)
|
if !formula_packaged[formula_name] && !package_exists?(repo: bintray_repo, package: bintray_package)
|
||||||
@ -189,7 +197,11 @@ class Bintray
|
|||||||
|
|
||||||
bottle_count = bottle_hash["bottle"]["tags"].length
|
bottle_count = bottle_hash["bottle"]["tags"].length
|
||||||
odebug "Publishing #{@bintray_org}/#{bintray_repo}/#{bintray_package}/#{version}"
|
odebug "Publishing #{@bintray_org}/#{bintray_repo}/#{bintray_package}/#{version}"
|
||||||
publish repo: bintray_repo, package: bintray_package, version: version, file_count: bottle_count
|
publish(repo: bintray_repo,
|
||||||
|
package: bintray_package,
|
||||||
|
version: version,
|
||||||
|
file_count: bottle_count,
|
||||||
|
warn_on_error: warn_on_error)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -33,6 +33,9 @@ module Homebrew
|
|||||||
switch "--resolve",
|
switch "--resolve",
|
||||||
description: "When a patch fails to apply, leave in progress and allow user to resolve, "\
|
description: "When a patch fails to apply, leave in progress and allow user to resolve, "\
|
||||||
"instead of aborting."
|
"instead of aborting."
|
||||||
|
switch "--warn-on-upload-failure",
|
||||||
|
description: "Warn instead of raising an error if the bottle upload fails. "\
|
||||||
|
"Useful for repairing bottle uploads that previously failed."
|
||||||
flag "--workflow=",
|
flag "--workflow=",
|
||||||
description: "Retrieve artifacts from the specified workflow (default: `tests.yml`)."
|
description: "Retrieve artifacts from the specified workflow (default: `tests.yml`)."
|
||||||
flag "--artifact=",
|
flag "--artifact=",
|
||||||
@ -258,6 +261,7 @@ module Homebrew
|
|||||||
upload_args << "--verbose" if Homebrew.args.verbose?
|
upload_args << "--verbose" if Homebrew.args.verbose?
|
||||||
upload_args << "--no-publish" if args.no_publish?
|
upload_args << "--no-publish" if args.no_publish?
|
||||||
upload_args << "--dry-run" if args.dry_run?
|
upload_args << "--dry-run" if args.dry_run?
|
||||||
|
upload_args << "--warn-on-upload-failure" if args.warn_on_upload_failure?
|
||||||
upload_args << "--root_url=#{args.root_url}" if args.root_url
|
upload_args << "--root_url=#{args.root_url}" if args.root_url
|
||||||
upload_args << "--bintray-org=#{bintray_org}"
|
upload_args << "--bintray-org=#{bintray_org}"
|
||||||
safe_system HOMEBREW_BREW_FILE, *upload_args
|
safe_system HOMEBREW_BREW_FILE, *upload_args
|
||||||
|
@ -17,6 +17,9 @@ module Homebrew
|
|||||||
description: "Apply the bottle commit and upload the bottles, but don't publish them."
|
description: "Apply the bottle commit and upload the bottles, but don't publish them."
|
||||||
switch "-n", "--dry-run",
|
switch "-n", "--dry-run",
|
||||||
description: "Print what would be done rather than doing it."
|
description: "Print what would be done rather than doing it."
|
||||||
|
switch "--warn-on-upload-failure",
|
||||||
|
description: "Warn instead of raising an error if the bottle upload fails. "\
|
||||||
|
"Useful for repairing bottle uploads that previously failed."
|
||||||
flag "--bintray-org=",
|
flag "--bintray-org=",
|
||||||
description: "Upload to the specified Bintray organisation (default: `homebrew`)."
|
description: "Upload to the specified Bintray organisation (default: `homebrew`)."
|
||||||
flag "--root-url=",
|
flag "--root-url=",
|
||||||
@ -48,7 +51,9 @@ module Homebrew
|
|||||||
if args.dry_run?
|
if 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?,
|
||||||
|
warn_on_error: args.warn_on_upload_failure?)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -903,6 +903,8 @@ repository.
|
|||||||
Do not warn if pulling to a branch besides master (useful for testing).
|
Do not warn if pulling to a branch besides master (useful for testing).
|
||||||
* `--resolve`:
|
* `--resolve`:
|
||||||
When a patch fails to apply, leave in progress and allow user to resolve, instead of aborting.
|
When a patch fails to apply, leave in progress and allow user to resolve, instead of aborting.
|
||||||
|
* `--warn-on-upload-failure`:
|
||||||
|
Warn instead of raising an error if the bottle upload fails. Useful for repairing bottle uploads that previously failed.
|
||||||
* `--workflow`:
|
* `--workflow`:
|
||||||
Retrieve artifacts from the specified workflow (default: `tests.yml`).
|
Retrieve artifacts from the specified workflow (default: `tests.yml`).
|
||||||
* `--artifact`:
|
* `--artifact`:
|
||||||
@ -924,6 +926,8 @@ Apply the bottle commit and publish bottles to Bintray.
|
|||||||
Apply the bottle commit and upload the bottles, but don't publish them.
|
Apply the bottle commit and upload the bottles, but don't publish them.
|
||||||
* `-n`, `--dry-run`:
|
* `-n`, `--dry-run`:
|
||||||
Print what would be done rather than doing it.
|
Print what would be done rather than doing it.
|
||||||
|
* `--warn-on-upload-failure`:
|
||||||
|
Warn instead of raising an error if the bottle upload fails. Useful for repairing bottle uploads that previously failed.
|
||||||
* `--bintray-org`:
|
* `--bintray-org`:
|
||||||
Upload to the specified Bintray organisation (default: `homebrew`).
|
Upload to the specified Bintray organisation (default: `homebrew`).
|
||||||
* `--root-url`:
|
* `--root-url`:
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
.\" generated with Ronn/v0.7.3
|
.\" generated with Ronn/v0.7.3
|
||||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||||
.
|
.
|
||||||
.TH "BREW\-CASK" "1" "June 2020" "Homebrew" "brew-cask"
|
.TH "BREW\-CASK" "1" "July 2020" "Homebrew" "brew-cask"
|
||||||
.
|
.
|
||||||
.SH "NAME"
|
.SH "NAME"
|
||||||
\fBbrew\-cask\fR \- a friendly binary installer for macOS
|
\fBbrew\-cask\fR \- a friendly binary installer for macOS
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
.\" generated with Ronn/v0.7.3
|
.\" generated with Ronn/v0.7.3
|
||||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||||
.
|
.
|
||||||
.TH "BREW" "1" "June 2020" "Homebrew" "brew"
|
.TH "BREW" "1" "July 2020" "Homebrew" "brew"
|
||||||
.
|
.
|
||||||
.SH "NAME"
|
.SH "NAME"
|
||||||
\fBbrew\fR \- The Missing Package Manager for macOS
|
\fBbrew\fR \- The Missing Package Manager for macOS
|
||||||
@ -1176,6 +1176,10 @@ Do not warn if pulling to a branch besides master (useful for testing)\.
|
|||||||
When a patch fails to apply, leave in progress and allow user to resolve, instead of aborting\.
|
When a patch fails to apply, leave in progress and allow user to resolve, instead of aborting\.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
|
\fB\-\-warn\-on\-upload\-failure\fR
|
||||||
|
Warn instead of raising an error if the bottle upload fails\. Useful for repairing bottle uploads that previously failed\.
|
||||||
|
.
|
||||||
|
.TP
|
||||||
\fB\-\-workflow\fR
|
\fB\-\-workflow\fR
|
||||||
Retrieve artifacts from the specified workflow (default: \fBtests\.yml\fR)\.
|
Retrieve artifacts from the specified workflow (default: \fBtests\.yml\fR)\.
|
||||||
.
|
.
|
||||||
@ -1211,6 +1215,10 @@ Apply the bottle commit and upload the bottles, but don\'t publish them\.
|
|||||||
Print what would be done rather than doing it\.
|
Print what would be done rather than doing it\.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
|
\fB\-\-warn\-on\-upload\-failure\fR
|
||||||
|
Warn instead of raising an error if the bottle upload fails\. Useful for repairing bottle uploads that previously failed\.
|
||||||
|
.
|
||||||
|
.TP
|
||||||
\fB\-\-bintray\-org\fR
|
\fB\-\-bintray\-org\fR
|
||||||
Upload to the specified Bintray organisation (default: \fBhomebrew\fR)\.
|
Upload to the specified Bintray organisation (default: \fBhomebrew\fR)\.
|
||||||
.
|
.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user