New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
github_packages: support --keep-old #11093
Conversation
Review period will end on 2021-04-12 at 15:41:15 UTC. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work 👏🏻
Review period skipped due to |
Are you sure this won't break workflows in linuxbrew-core? |
What does |
Yes, I think that's what happens. |
I could do this so that it ignores diff --git a/Library/Homebrew/github_packages.rb b/Library/Homebrew/github_packages.rb
index ad8839ca2..deb576d26 100644
--- a/Library/Homebrew/github_packages.rb
+++ b/Library/Homebrew/github_packages.rb
@@ -226,21 +226,22 @@ class GitHubPackages
image_tag = GitHubPackages.image_version_rebuild(version_rebuild)
image_uri = "#{GitHubPackages.root_url(org, repo, DOCKER_PREFIX)}/#{image_name}:#{image_tag}"
- unless keep_old
- puts
- inspect_args = ["inspect", image_uri.to_s]
- if dry_run
- puts "#{skopeo} #{inspect_args.join(" ")} --creds=#{user}:$HOMEBREW_GITHUB_PACKAGES_TOKEN"
- else
- inspect_args << "--creds=#{user}:#{token}"
- inspect_result = system_command(skopeo, print_stderr: false, args: inspect_args)
- if inspect_result.status.success?
- if warn_on_error
- opoo "#{image_uri} already exists, skipping upload!"
- return
- else
- odie "#{image_uri} already exists!"
- end
+ puts
+ inspect_args = ["inspect", image_uri.to_s]
+ if dry_run
+ puts "#{skopeo} #{inspect_args.join(" ")} --creds=#{user}:$HOMEBREW_GITHUB_PACKAGES_TOKEN"
+ else
+ inspect_args << "--creds=#{user}:#{token}"
+ inspect_result = system_command(skopeo, print_stderr: false, args: inspect_args)
+ if keep_old
+ # Tag doesn't exist so ignore --keep-old
+ keep_old = false unless inspect_result.status.success?
+ elsif inspect_result.status.success?
+ if warn_on_error
+ opoo "#{image_uri} already exists, skipping upload!"
+ return
+ else
+ odie "#{image_uri} already exists!"
end
end
end |
Guess that will do. |
@Bo98 that works for me too 👍🏻 |
puts | ||
args = ["copy", "--all", image_uri.to_s, "oci:#{root}"] | ||
if dry_run | ||
puts "#{skopeo} #{args.join(" ")} --src-creds=#{user}:$HOMEBREW_GITHUB_PACKAGES_TOKEN" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not saying we should but: could moving this skopeo with or without dry run logic into a method (as it's used three times now)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The different args, even ones like print_stderr
, make it a bit tricky.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine with me 👍🏻
Added code to |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?We need this to support any sort of workflow for adding bottles to an existing tag, including
brew dispatch-build-bottle
.