-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat(proxy): Support no_proxy configuration #6550
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
base: develop
Are you sure you want to change the base?
Conversation
Add support for NO_PROXY environment variable in git operations.
Add support for no_proxy configuration in setup_proxy function.
WalkthroughAdds NO_PROXY handling: read from config, propagate into Git background jobs (set $env:NO_PROXY inside jobs), and configure the system web proxy bypass list from NO_PROXY in setup_proxy. Changes
Sequence Diagram(s)sequenceDiagram
participant Config as Config
participant Core as core.ps1\n(Invoke-Git)
participant Job as Background Job\n(Git worker)
participant Download as download.ps1\n(setup_proxy)
participant Proxy as System Proxy
Config->>Core: get_config NO_PROXY
Core->>Job: Start-Job (pass using:no_proxy)
Job->>Job: if no_proxy set -> $env:NO_PROXY = no_proxy
Config->>Download: get_config NO_PROXY
Download->>Download: if no_proxy -> split by ","
Download->>Proxy: [net.webrequest]::defaultwebproxy.BypassList = list
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
lib/download.ps1 (1)
576-579: Improve string handling for NO_PROXY bypass list.The current implementation could produce unexpected results if the NO_PROXY configuration contains leading/trailing whitespace or empty values. Consider trimming the entire string and filtering out empty entries.
Apply this diff to improve robustness:
if ($no_proxy) { - $bypass_list = $no_proxy -split "\s*,\s*" + $bypass_list = $no_proxy.Trim() -split "\s*,\s*" | Where-Object { $_ -ne '' } [net.webrequest]::defaultwebproxy.BypassList = $bypass_list }This ensures:
- Leading/trailing whitespace from the entire string is removed
- Empty elements from consecutive commas or malformed input are filtered out
- The BypassList receives only valid, non-empty entries
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
lib/core.ps1(2 hunks)lib/download.ps1(2 hunks)
🔇 Additional comments (2)
lib/download.ps1 (1)
554-554: Good: NO_PROXY configuration retrieval.The retrieval of the NO_PROXY configuration is correctly placed and follows the same pattern as the PROXY configuration.
lib/core.ps1 (1)
235-235: NO_PROXY implementation is correct and properly propagated.Verification confirms the implementation follows best practices:
- Line 235 correctly retrieves NO_PROXY from configuration using the standard
get_configpattern- Line 250 properly passes NO_PROXY to the background job via
$using:scope- Line 256-258 conditionally sets
$env:NO_PROXYonly when the value is non-empty—more robust than the unconditional HTTP_PROXY/HTTPS_PROXY handling- NO_PROXY is applied only within background jobs for network-dependent Git operations (clone, checkout, pull, fetch, ls-remote)
The implementation is complete and correct. No changes required.
Trimmed whitespace from no_proxy variable before splitting, as reported by @coderabbitai
Description
Enhance setup_proxy Invoke-Git functions to handle no_proxy settings
Motivation and Context
Closes #6549
How Has This Been Tested?
In our network, where we need to use proxy to access to Internet, and have internal buckets that can't be reached with the proxy, and this configuration in Scoop
config.json:{ "proxy": "<proxy-server>:<proxy-port>", "no_proxy": "localhost, 127.0.0.1, .private.domain.com" }Checklist:
developbranch.Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.