-
Notifications
You must be signed in to change notification settings - Fork 4
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
Proxy environment variable support #74
Conversation
I've tried to bring in the latest changes on main but it isn't building or packing:
And
Guessing something broke with yesterday's dependabot updates. |
- Also fixes type error with latest dependabot changes
d1fbbbb
to
148fcb3
Compare
@@ -9,10 +9,14 @@ import { | |||
import {Octokit} from '@octokit/rest' |
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.
I'm not sure if it's worth to check to change to @octokit/action
here since it already implements proxy support, rather than implementing it here manually
octokit/action.js#329
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.
As is the case with a lot of proxy implementations it appears to be a bit "basic". Will raise an issue there with the details and see what they say as well.
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.
@stoe just for my understanding, is the proxy handling something that is always needed for Actions in GHES instances? Are the environment variables always the same or can they differ/be set by the customer? I'm happy to use the superior proxy-agent
dependency in @octokit/action
, I just want to fully understand the context before making the change.
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.
@gr2m, they won't be always needed as this depends on the implementation of the self-hosted runner, but when used they should always follow our documented pattern under https://docs.github.com/en/actions/hosting-your-own-runners/using-a-proxy-server-with-self-hosted-runners
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.
Also, this is independent of GHES and would also apply for self-hosted runners on GHEC (github.com).
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.
Got it, thank you for clarifying. As it's documented in the GitHub docs I consider it best practice, and will implement it for the Action SDK (@octokit/action
). I think you should be able to safely use it instead of @octokit/rest
. I'm happy to help with the transition.
I do plan a bigger overhaul of @octokit/action
(to make it behave more like @octokit/app
) but that won't happen any time soon and when we get there, I'll help you with the upgrade as well.
Updated with the fix needed to workaround changes in the latest dependabot changes in case anyone needs that. |
Ok so given the comments in the PR, what do you think if I do a quick update to the code and implement the I can spend some time tomorrow working on this. |
We can talk about it tomorrow though. |
Ok let's do that as I have a training in the morning and won't manage to get through this before our weekly. I am curious to know what is failing for you on the |
The proxy support in The |
Ok let's have the sync tomorrow and see where I can chime in. I am happy to merge this PR if that fixes entirely the proxy support but at the same time I think @gr2m should make sure this is captured as an issue to get it improved in the actions sdk 😺 |
This PR is probably the wrong way to do it, making use of the My fork of this is working for the time being, seems silly to make changes here now until |
@steve-norman-rft we can chat at octokit/action.js#342, let me know what problems you run into. |
Apologies @gr2m I didn't know that PR existed! 😸 lets keep the discussion there |
X-ref as this comes from a fork that I can't edit. We can use this to replace it with the newest version of |
With #79 fixed, whenever we get the fixes from octokit/action.js#342 and the PR octokit/action.js#349 we should be good to go updating the dependency here |
Closing this PR as it's not relevant anymore with the changes already in the main branch |
Working through this with @droidpl last week and found that octokit doesn't work with proxies without some customisation.
I think this is probably the simplest solution (and possibly worth speaking to the Octokit team about implementing something similar rather than making any consumers have to re-implement this every time).
Some sample code that I used to test various scenarios:
And some results.
No proxy environment variables set, octokit call times out:
Configured with
https_proxy
and ano_proxy
. The url being requested is api.github.com sono_proxy
doesn't match in this case so works:no_proxy
is prefixed with a.
so should not be used for anything ending in.github.com
. As expected request isn't routed through the proxy so times out:This time
no_proxy
is set to localhost, sohttps_proxy
should be used as it works:All requests should be routed through
https_proxy
and appears to work:I can keep using my fork, but this might be useful for other consumers (and potentially other enterprise clients who use proxy servers).