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

Respect no_proxy settings next to the proxy settings. #23

Closed
rajbos opened this issue Oct 10, 2022 · 6 comments · Fixed by #24
Closed

Respect no_proxy settings next to the proxy settings. #23

rajbos opened this issue Oct 10, 2022 · 6 comments · Fixed by #24

Comments

@rajbos
Copy link

rajbos commented Oct 10, 2022

With #21 there is now support for proxy settings, which do not adhere to the no_proxy settings, breaking in our setup where we set both http_proxy and no_proxy.

@rajbos
Copy link
Author

rajbos commented Oct 11, 2022

I've been checking to see if I can contribute, and wanted to discuss first about the direction😁.

From what I can see, https-proxy-agent does not support the no_proxy settings 😞. That means we have two options:

  1. Add a setting to ignore the https_proxy environment variable: ignore_proxy: false, which requires user input.
  2. Write a check to see if the target url is in the no_proxy list, and if so, do not inject the https-proxy-agent here

Tagging @peter-murray for visibility.

@peter-murray
Copy link
Owner

peter-murray commented Oct 11, 2022

Option 1 is the quickest to deliver in this case, but seeing that we are reading the settings from the environment ti does present Option 2 as being a more consistent approach.

If I was to do this, if you explicitly inject the proxy as an input to the action, there would be no ignoring the proxy URLs, otherwise why did you inject it?
Then if the proxy is coming from the environment, and no_proxy was set, then that should be respected, which means that the test for that needs to go elsewhere...

@rajbos
Copy link
Author

rajbos commented Oct 11, 2022

Good point. Then it's Option 3?

  1. Make the injection of the proxy as input required and do not load the environment settings at all.

Or would you want do do both 3 and 2 then (sorry if this is getting confusing)?

@peter-murray
Copy link
Owner

peter-murray commented Oct 11, 2022

I originally liked the idea of loading it from the runner environment if it was set, as this keeps the workflows DRY, especially if you set it inside the workflow as a default instead of inside the runner itself.

I think now that this has shipped we need support for the following:

  1. If the user has provided a proxy as an input to the action, use it. This also overrides any environment settings (most specific)
  2. If the action is falling back to environment variables, then if no_proxy is also set in the environment variables, respect that is the server is covered by that.

This is achievable, just not as clean as I would like.

@peter-murray
Copy link
Owner

After going around the bush a few times with this, I landed on the assumption that the no_proxy would be host names, so in the case of GitHub.com would be api.github.com in the string and it works in my limited testing.

@rajbos would you mind checking that the branch no-proxy-support does what you need it to do before I publish this to main and release a new version?

@rajbos
Copy link
Author

rajbos commented Oct 11, 2022

Works like a charm @peter-murray!

I've tested:

  • With our environment settings (HTTPS_PROXY and NO_PROXY), with a github_api_base_url set
  • With our environment settings (HTTPS_PROXY and NO_PROXY), without a github_api_base_url set
  • With our environment settings (HTTPS_PROXY and NO_PROXY), with the https_proxy variable set

Things work as expected with these combinations! Thanks for turning this around so quickly 🤗.

peter-murray added a commit that referenced this issue Oct 12, 2022
* Adding support for no_proxy, fixes #23
* Updating actions steps to support Node 16
* Updating rest references due to changes in github-script
* Adding logging for no_proxy usecases
* Updating to new core libraries with output support changes
* Consolidating API URL lookup for the action to a single location
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 a pull request may close this issue.

2 participants