Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@clarktlaugh
Copy link

@clarktlaugh clarktlaugh commented Oct 11, 2022

This PR adds support for using an http proxy server using the hpagent package (https://www.npmjs.com/package/hpagent). It only makes changes to the defaultOptions if one of the regular proxy EVs is set (http(s)_proxy, HTTP(s)_PROXY).

This change is important in order to allow this action to work within a corporate environment that requires the use of an http proxy to communicate between runners and a Github Enterprise deployment in isolated network compartments.

Resolves #138

@clarktlaugh
Copy link
Author

Hello, is it possible to get some eyes on this review?

Copy link
Contributor

@maxcoulombe maxcoulombe left a comment

Choose a reason for hiding this comment

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

Hey @clarktlaugh, thanks for taking this on!

I have a couple of small comments to address before we can merge this but the bulk of the improvement looks good. My main concern is whether or not specifying the proxy address in the documented inputs would make this feature easier to discover and use for people.

"homepage": "https://github.com/hashicorp/vault-action#readme",
"dependencies": {
"got": "^11.8.5",
"hpagent": "^1.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

I see the latest version is 1.2.0 if we want to start with an up-to-date new dependency

}
}

if (process.env['http_proxy'] || process.env['HTTP_PROXY']) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should add this setting in the list of inputs supported by the action so it is explicit and documented.

Unless these environment variables have a special meaning and are required for the agent to work properly?

Copy link
Author

Choose a reason for hiding this comment

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

These are pretty standard environment variables that, if needed, could be added to the .env file for a self-hosted runner, negating the need for them to be explicitly provided in the action inputs.

When using this action on github.com, these variables would not be set and would not be needed. They are only necessary in a corporate environment where network "compartments" might require a proxy to be configured in order to reach them.

That's why I did not add them as inputs, but rather just made the decision to pick them up from the runner's environment.

Copy link
Contributor

@maxcoulombe maxcoulombe Mar 2, 2023

Choose a reason for hiding this comment

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

I think it make sense since they are standard, not vault-specific and the use case is somewhat niche. It's probably worth a mention in the README though, otherwise people would need to read the source code to know proxy servers are supported by the action.

proxy: process.env['https_proxy'] || process.env['HTTPS_PROXY']
})
}

Copy link
Contributor

Choose a reason for hiding this comment

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

We generate the dist/index when releasing new versions its fine to not commit it if you prefer. It often leads to annoying merge conflicts to resolve.

Copy link
Author

Choose a reason for hiding this comment

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

I wasn't sure about that part... whether it needed to be added to the commit or not. I can definitely remove it.

maxFreeSockets: 256,
proxy: process.env['https_proxy'] || process.env['HTTPS_PROXY']
})
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand this might be very difficult to test functionally but can we add a small UT that at least checks the agent is set or unset depending of the config received?

Copy link
Author

Choose a reason for hiding this comment

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

I will see what I can do!

@clarktlaugh
Copy link
Author

Thank you for the feedback -- I'll get working on updating the PR.

@maxcoulombe maxcoulombe added the waiting-for-response Indicates a maintainer asked a question that must be answered by contributors before proceeding label Mar 6, 2023
@fairclothjm
Copy link
Collaborator

Thanks for the submission! Are you still interested in carrying this forward?

@clarktlaugh
Copy link
Author

Thanks for the submission! Are you still interested in carrying this forward?

Yes, sorry -- it's been a while since I've checked back here. I will update my PR in the next few days.

@manang
Copy link

manang commented Jun 14, 2023

hi, news about this PR?

@dysonfrost
Copy link

dysonfrost commented Jul 12, 2023

Hello, it would be really useful to add these proxy capabilities.

@msardara
Copy link

Hello guys, any news regarding this PR? Is there any work needed to merge it?

@leetcarey
Copy link

I am having a similar issue. Is there a workaround

@federico-manuel-trasande-kyndryl

Is there any news about this implementation? I have this issue were I can't use the action behind corporate proxy.

@federico-manuel-trasande-kyndryl

Is there any news or ETA to when this feature will be implemented? this is something we really need for our pipelines. And also, I'm surprised that this isn't something implemented before or is not needed by more people.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-for-response Indicates a maintainer asked a question that must be answered by contributors before proceeding

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Proxy configuration

8 participants