Skip to content
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

CurlGitHubPackagesDownloadStrategy: Fix third-party taps #11025

Merged
merged 1 commit into from Apr 4, 2021

Conversation

sjackman
Copy link
Member

@sjackman sjackman commented Apr 4, 2021

Fix CurlGitHubPackagesDownloadStrategy for third party taps.

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

@sjackman sjackman added the bug Reproducible Homebrew/brew bug label Apr 4, 2021
@sjackman sjackman self-assigned this Apr 4, 2021
@BrewTestBot
Copy link
Member

Review period will end on 2021-04-06 at 00:00:00 UTC.

@BrewTestBot BrewTestBot added the waiting for feedback Merging is blocked until sufficient time has passed for review label Apr 4, 2021
@sjackman sjackman added the critical Critical change which should be shipped as soon as possible. label Apr 4, 2021
@BrewTestBot
Copy link
Member

Review period skipped due to critical label.

@BrewTestBot BrewTestBot removed the waiting for feedback Merging is blocked until sufficient time has passed for review label Apr 4, 2021
BrewTestBot
BrewTestBot previously approved these changes Apr 4, 2021
BrewTestBot
BrewTestBot previously approved these changes Apr 4, 2021
@sjackman sjackman changed the title CurlGitHubPackagesDownloadStrategy: Fix 3rd party CurlGitHubPackagesDownloadStrategy: Fix third-party taps Apr 4, 2021
@sjackman sjackman enabled auto-merge April 4, 2021 08:26
Fix CurlGitHubPackagesDownloadStrategy for third party taps.
@sjackman sjackman merged commit 77a53d6 into Homebrew:master Apr 4, 2021
@sjackman sjackman deleted the sj/ghcr-third-party-tap branch April 4, 2021 09:15
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some cleanup requests.

@@ -306,9 +306,7 @@ def initialize(formula, spec)

filename = Filename.create(formula, tag, spec.rebuild).bintray

# TODO: this will need adjusted when if we use GitHub Packages by default
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please re-add this comment.

Copy link
Member Author

@sjackman sjackman Apr 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does it need to be adjusted when we use GitHub Contain Registry by default in Homebrew/core?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the Bintray logic will need to be removed and this will need to be the default path.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    path, resolved_basename = if spec.root_url.match?(GitHubPackages::URL_REGEX)
      ["#{@name}/blobs/sha256:#{checksum}", filename]
    else
      filename
    end

Logic specific to Bintray will need to be removed, but this particular code is not specific to Bintray. It will need to remain as is to support third-party tap that use a root_url to store files on a normal non-GHCR HTTPS server.

# TODO: this will need adjusted when if we use GitHub Packages by default
path, resolved_basename = if (bottle_domain = Homebrew::EnvConfig.bottle_domain.presence) &&
bottle_domain.start_with?(GitHubPackages::URL_PREFIX)
path, resolved_basename = if spec.root_url.match?(GitHubPackages::URL_REGEX)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why match? instead of start_with? The latter is much faster.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To permit root_url "docker://ghcr.io/brewsci/bio"

GitHubPackages.root_url(tap.user, tap.repo).to_s
else
"#{Homebrew::EnvConfig.bottle_domain}/#{Utils::Bottles::Bintray.repository(tap)}"
end
else
@root_url = var
@root_url = if var.to_s.start_with? "docker://"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The root_url should never start with docker://. When is it set to that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Brewsci/bio I set root_url "docker://ghcr.io/brewsci/bio". It also supports other Docker / OCI / ORAS container registries such as docker://hub.docker.com and docker://quay.io.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sjackman Ok. Can this logic get moved to github_packages.rb? Ideally this would just be part of the root_url method.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure that I followed, but I took a stab at it in PR #11037

@github-actions github-actions bot added the outdated PR was locked due to age label May 6, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Reproducible Homebrew/brew bug critical Critical change which should be shipped as soon as possible. outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants