From 0ec1f04e635276a530ce58c04702146a0f59f82c Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 2 Apr 2021 16:47:56 +0100 Subject: [PATCH] GitHub Packages CI upload fixes - Add `--no-commit` option to `brew pr-pull` and pass to `brew pr-upload` - Use `skopeo` from `PATH` if available (as it takes a while to build on CI) --- Library/Homebrew/dev-cmd/pr-pull.rb | 7 +++++-- Library/Homebrew/github_packages.rb | 6 +++++- completions/bash/brew | 1 + completions/fish/brew.fish | 5 +++-- completions/zsh/_brew | 5 +++-- docs/Manpage.md | 6 ++++-- manpages/brew.1 | 10 +++++++--- 7 files changed, 28 insertions(+), 12 deletions(-) diff --git a/Library/Homebrew/dev-cmd/pr-pull.rb b/Library/Homebrew/dev-cmd/pr-pull.rb index 345cc2c885e79..29d120955b2a7 100644 --- a/Library/Homebrew/dev-cmd/pr-pull.rb +++ b/Library/Homebrew/dev-cmd/pr-pull.rb @@ -22,10 +22,12 @@ def pr_pull_args EOS switch "--no-publish", description: "Download the bottles, apply the bottle commit and "\ - "upload the bottles to Bintray, but don't publish them." + "upload the bottles, but don't publish them." switch "--no-upload", description: "Download the bottles and apply the bottle commit, "\ - "but don't upload to Bintray or GitHub Releases." + "but don't upload." + switch "--no-commit", + description: "Do not generate a new commit before uploading." switch "-n", "--dry-run", description: "Print what would be done rather than doing it." switch "--clean", @@ -431,6 +433,7 @@ def pr_pull upload_args = ["pr-upload"] upload_args << "--debug" if args.debug? upload_args << "--verbose" if args.verbose? + upload_args << "--no-commit" if args.no_commit? upload_args << "--no-publish" if args.no_publish? upload_args << "--dry-run" if args.dry_run? upload_args << "--keep-old" if args.keep_old? diff --git a/Library/Homebrew/github_packages.rb b/Library/Homebrew/github_packages.rb index 886734bda36db..fbd85c18de060 100644 --- a/Library/Homebrew/github_packages.rb +++ b/Library/Homebrew/github_packages.rb @@ -51,7 +51,11 @@ def upload_bottles(bottles_hash, dry_run:) raise UsageError, "HOMEBREW_GITHUB_PACKAGES_USER is unset." if user.blank? raise UsageError, "HOMEBREW_GITHUB_PACKAGES_TOKEN is unset." if token.blank? - skopeo = HOMEBREW_PREFIX/"bin/skopeo" + skopeo = [ + which("skopeo"), + which("skopeo", ENV["HOMEBREW_PATH"]), + HOMEBREW_PREFIX/"bin/skopeo", + ].compact.first unless skopeo.exist? ohai "Installing `skopeo` for upload..." safe_system HOMEBREW_BREW_FILE, "install", "--formula", "skopeo" diff --git a/completions/bash/brew b/completions/bash/brew index 58eed9bd5a4ad..f782ed8a83623 100644 --- a/completions/bash/brew +++ b/completions/bash/brew @@ -1464,6 +1464,7 @@ _brew_pr_pull() { --ignore-missing-artifacts --keep-old --message + --no-commit --no-publish --no-upload --quiet diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index 35e18589f063b..fe5131a1f6d44 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -1058,8 +1058,9 @@ __fish_brew_complete_arg 'pr-pull' -l help -d 'Show this message' __fish_brew_complete_arg 'pr-pull' -l ignore-missing-artifacts -d 'Comma-separated list of workflows which can be ignored if they have not been run' __fish_brew_complete_arg 'pr-pull' -l keep-old -d 'If the formula specifies a rebuild version, attempt to preserve its value in the generated DSL' __fish_brew_complete_arg 'pr-pull' -l message -d 'Message to include when autosquashing revision bumps, deletions, and rebuilds' -__fish_brew_complete_arg 'pr-pull' -l no-publish -d 'Download the bottles, apply the bottle commit and upload the bottles to Bintray, but don\'t publish them' -__fish_brew_complete_arg 'pr-pull' -l no-upload -d 'Download the bottles and apply the bottle commit, but don\'t upload to Bintray or GitHub Releases' +__fish_brew_complete_arg 'pr-pull' -l no-commit -d 'Do not generate a new commit before uploading' +__fish_brew_complete_arg 'pr-pull' -l no-publish -d 'Download the bottles, apply the bottle commit and upload the bottles, but don\'t publish them' +__fish_brew_complete_arg 'pr-pull' -l no-upload -d 'Download the bottles and apply the bottle commit, but don\'t upload' __fish_brew_complete_arg 'pr-pull' -l quiet -d 'Make some output more quiet' __fish_brew_complete_arg 'pr-pull' -l resolve -d 'When a patch fails to apply, leave in progress and allow user to resolve, instead of aborting' __fish_brew_complete_arg 'pr-pull' -l root-url -d 'Use the specified URL as the root of the bottle\'s URL instead of Homebrew\'s default' diff --git a/completions/zsh/_brew b/completions/zsh/_brew index 75822a7bf94f0..30e5658dd0524 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -1301,8 +1301,9 @@ _brew_pr_pull() { '--ignore-missing-artifacts[Comma-separated list of workflows which can be ignored if they have not been run]' \ '--keep-old[If the formula specifies a rebuild version, attempt to preserve its value in the generated DSL]' \ '--message[Message to include when autosquashing revision bumps, deletions, and rebuilds]' \ - '--no-publish[Download the bottles, apply the bottle commit and upload the bottles to Bintray, but don'\''t publish them]' \ - '--no-upload[Download the bottles and apply the bottle commit, but don'\''t upload to Bintray or GitHub Releases]' \ + '--no-commit[Do not generate a new commit before uploading]' \ + '--no-publish[Download the bottles, apply the bottle commit and upload the bottles, but don'\''t publish them]' \ + '--no-upload[Download the bottles and apply the bottle commit, but don'\''t upload]' \ '--quiet[Make some output more quiet]' \ '--resolve[When a patch fails to apply, leave in progress and allow user to resolve, instead of aborting]' \ '--root-url[Use the specified URL as the root of the bottle'\''s URL instead of Homebrew'\''s default]' \ diff --git a/docs/Manpage.md b/docs/Manpage.md index 5f219589c2c14..be1eae2f0a6f3 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -1168,9 +1168,11 @@ pull request with artifacts generated by GitHub Actions. Requires write access to the repository. * `--no-publish`: - Download the bottles, apply the bottle commit and upload the bottles to Bintray, but don't publish them. + Download the bottles, apply the bottle commit and upload the bottles, but don't publish them. * `--no-upload`: - Download the bottles and apply the bottle commit, but don't upload to Bintray or GitHub Releases. + Download the bottles and apply the bottle commit, but don't upload. +* `--no-commit`: + Do not generate a new commit before uploading. * `-n`, `--dry-run`: Print what would be done rather than doing it. * `--clean`: diff --git a/manpages/brew.1 b/manpages/brew.1 index 1d55a3c820242..ad3047178bdb9 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BREW" "1" "March 2021" "Homebrew" "brew" +.TH "BREW" "1" "April 2021" "Homebrew" "brew" . .SH "NAME" \fBbrew\fR \- The Missing Package Manager for macOS (or Linux) @@ -1622,11 +1622,15 @@ Download and publish bottles, and apply the bottle commit from a pull request wi . .TP \fB\-\-no\-publish\fR -Download the bottles, apply the bottle commit and upload the bottles to Bintray, but don\'t publish them\. +Download the bottles, apply the bottle commit and upload the bottles, but don\'t publish them\. . .TP \fB\-\-no\-upload\fR -Download the bottles and apply the bottle commit, but don\'t upload to Bintray or GitHub Releases\. +Download the bottles and apply the bottle commit, but don\'t upload\. +. +.TP +\fB\-\-no\-commit\fR +Do not generate a new commit before uploading\. . .TP \fB\-n\fR, \fB\-\-dry\-run\fR