-
Notifications
You must be signed in to change notification settings - Fork 123
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
Add support for Netrc for Downloader #88
Conversation
@swift-ci test |
@swift-ci test |
1 similar comment
@swift-ci test |
@swift-ci smoke-test |
Mirrored in spm: swiftlang/swift-package-manager#2833. |
@swift-ci please test |
@sstadelman would you be able to resolve the conflict? |
@MaxDesiatov conflict resolved. |
@swift-ci please test |
@swift-ci please smoke test |
@swift-ci please test |
The Linux build is failing:
|
@swift-ci please test |
@swift-ci please test |
@sstadelman the build still fails on Linux, do you get the same error messages when you build and test on Linux with Swift 5.2 on your side? (The Linux Swift CI node uses Swift 5.2) |
@MaxDesiatov it's a different failure message, regarding AbsolutePath optionality. Will test on Linux with 5.2 and ping you when complete. Sorry about that. |
@MaxDesiatov resolved. passed on Swift:latest tag. |
@swift-ci please test |
1 similar comment
@swift-ci please test |
@swift-ci please test |
Co-authored-by: Max Desiatov <[email protected]>
Co-authored-by: Max Desiatov <[email protected]>
Co-authored-by: Max Desiatov <[email protected]>
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.
Awesome, thanks 👍
@swift-ci please test |
1 similar comment
@swift-ci please test |
Hi @neonichu, would you mind having a look at this? Thank you! |
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.
This looks great, thanks @sstadelman for the implementation and @MaxDesiatov for helping with the review!
Thanks @neonichu and @MaxDesiatov for your assistance along the way! @neonichu: what do you expect as the timeline for this being picked up by the standard Xcode distribution? |
Xcode 12 GM won't get this unless the SwiftPM release manager accepts this same PR to the |
The new parameter seems to trip up the build on Windows. This adds the parameter in explicitly which repairs the build.
Xcode 12 GM Seed 1 (12A7209) doesn't support |
I don't think this PR was re-submitted for the |
No, is that the process for adoption in an upcoming patch? |
It doesn't guarantee that it will end up in a 5.3 patch release, but I guess it will be at least considered then if the change is not too disruptive and is well-tested. A similar situation happened to swiftlang/swift-package-manager#2905, which missed the 5.3.0 cut-off. |
Add support for Netrc for Downloader
@MaxDesiatov what is the current status of this repository vis-a-vis swift-package-manager? Do all changes still need to be mirrored in both? |
Yes, definitely in the |
Implemented handling for netrc files. Matches connection settings for binary artifact host, and returns Basic authentication header to be appended to internal
URLRequest
of theDownloader
. Will resolve Supporting basic auth for non-git binary dependency hosts.Netrc
parser based on Carthage implementation and tests, and migrated to regex for flexibility.Features supported
machine
,login
,password
key valuesaccount
andmacdef
entries (relevant only to ftp remotes)login
,password
,account
key valuesdefault
connection settings.default
connection setting, and thatdefault
connection setting is last entryNSHomeDirectory()/.netrc
by defaultWorkspace
supports customnetrcFilePath
parameterSequence Flow (including SPM)
In SPM, a netrc file absolute path is resolved during (3)
getActiveWorkspace()
call ofrun()
procedure, from (1) optional command argument. Optional absolute path is passed to initializedWorkspace
(5).If binary artifacts should be updated, then the (7)
download(...)
operation attempts to load the netrc machine definitions from a file at the resolvednetrcFilePath
(8), or atNSHomeDirectory()/.netrc
ifnil
. The optional resultingNetrc
instance is passed to the createdFoundationDownloader
for each artifact (11). The downloader attempts to match a credential in the list of theNetrc
instance'sMachine
definitions for the artifact host (13). If matched, the base64-encoded<user>:<password>
pair is set to theAuthorization
header for the respectiveURLRequest
.Notes
Downloader
protocol, which is lightweight by design. Though netrc is a common technique, it is not necessarily a universal solution--perhaps in the future we should also support application tokens, etc., which might similarly pollute the protocol. So, this implementation introduces theAuthorizationProviding
interface, under which additional authentication techniques could in the future be added to theWorkspace
, and injected to the binary update process inDownloader
implementations.Downloader
is extended as follows:FoundationDownloader
. OtherDownloaders
should implement handling according to their requirements.swift-driver
andswift-package-manager
packages to raise minimum to 10.13 also. Discussed in thread.swift-package-manager
to support--netrc-file
option. However, the defaultNSHomeDirectory()/.netrc
location for the netrc file can be supported immediately upon merging this PR in TSC.