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

add proxy support for download now-cli #1844

Closed
wants to merge 3 commits into from

Conversation

liudonghua123
Copy link

If I was in a intranet environment, I could not download and install now-cli successfully.

@codecov-io
Copy link

Codecov Report

Merging #1844 into canary will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           canary   #1844   +/-   ##
======================================
  Coverage    6.34%   6.34%           
======================================
  Files          93      93           
  Lines        4049    4049           
======================================
  Hits          257     257           
  Misses       3792    3792

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1c9aeee...7d1f51f. Read the comment docs.

@@ -9,6 +9,7 @@ import fetch from 'node-fetch';
import retry from 'async-retry';
import which from 'which-promise';
import readPkg from 'read-pkg';
import HttpsProxyAgent from 'https-proxy-agent';
Copy link
Member

Choose a reason for hiding this comment

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

It would be better to use the proxy-agent module for this, so that SOCKS proxies would also be supported.

@@ -86,7 +87,18 @@ async function download() {
try {
const name = platformToName[platform];
const url = `https://github.com/zeit/now-cli/releases/download/${packageJSON.version}/${name}.gz`;
const resp = await fetch(url, { compress: false });
// check whether the proxy was set and configure the proxy agent settings
Copy link
Member

Choose a reason for hiding this comment

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

The proxy-agent module also does the env var parsing logic. See TooTallNate/node-proxy-agent#16.

package.json Outdated
@@ -206,5 +206,8 @@
"utility-types": "2.1.0",
"which-promise": "1.0.0",
"write-json-file": "2.2.0"
},
"dependencies": {
"https-proxy-agent": "2.2.1"
Copy link
Member

Choose a reason for hiding this comment

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

The proxy-agent module should be in devDependencies like the other deps.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, The proxy-agent module is more powerful and graceful, but it maybe hide more details in my opinion. Need more discussion to choose upon advantages and disadvantages.

Copy link
Contributor

@leo leo left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution. Please take a look at the comments above.

@liudonghua123
Copy link
Author

Thank you for your contribution. Please take a look at the comments above.

I saw the comments above, and I will change the proxy strategy and update the pr.

@juliangruber
Copy link
Contributor

Hey @liudonghua123, could you please take a look at the failing tests ^? 🙏

@leo
Copy link
Contributor

leo commented May 30, 2019

Thank you for your suggestion!

Unfortunately, since this PR seems to be unmaintained, we will close it for now.

However, the team will still be tracking the scenario where Now CLI is not able to install behind a intranet proxy.

@leo leo closed this May 30, 2019
@liudonghua123
Copy link
Author

Hi, @juliangruber I didn't found any error checks or failing tests. Could you show me the steps to see the failing tests during the CI process. Thanks.
Here is my snapshot.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants