[fix] support codeload github archive urls for artifactory (#710)#712
Open
edenfunf wants to merge 1 commit intomicrosoft:mainfrom
Open
[fix] support codeload github archive urls for artifactory (#710)#712edenfunf wants to merge 1 commit intomicrosoft:mainfrom
edenfunf wants to merge 1 commit intomicrosoft:mainfrom
Conversation
When an Artifactory instance's upstream is configured as
codeload.github.com (the workaround for private repos where github.com
issues cross-host redirects that Artifactory cannot follow),
build_artifactory_archive_url() now also generates codeload-style paths:
/{owner}/{repo}/zip/refs/heads/{ref}
/{owner}/{repo}/zip/refs/tags/{ref}
These are appended to the existing tuple so the caller's try-in-order
loop probes both styles; existing github.com and GitLab behavior is
unchanged.
Fixes microsoft#710
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add support for
codeload.github.com-style archive URLs in Artifactory archive URL generation.Why
Issue #710 reports that organizations using JFrog Artifactory as a proxy for private GitHub repositories need to configure the Artifactory upstream to
codeload.github.cominstead ofgithub.com. This is because Artifactory cannot follow the cross-host redirect that GitHub issues for private repo archives (which carries a short-lived token tocodeload.github.comthat Artifactory drops). When the upstream iscodeload.github.com, the required archive path pattern is:APM currently only generates
github.com-style paths (/archive/refs/heads/{ref}.zip), so downloads via a codeload-upstreamed Artifactory always fail.How
build_artifactory_archive_url()already returns a tuple of URLs to try in order — the downloader iterates through them and stops on the first 200. I added the two codeload-style paths at the end of the tuple, preserving existing GitHub and GitLab behavior entirely.Changed files:
src/apm_cli/utils/github_host.py— adds codeload paths to the returned tuple and updates the docstringtests/unit/test_artifactory_support.py— four new regression tests; one existing assertion updated to reflect the new URL count (3 → 5)Test
github.comarchive URL behavior remains unchanged (test_github_archive_urls_unchanged)test_gitlab_archive_urls_unchanged)test_codeload_upstream_heads_reftest_codeload_upstream_tags_ref