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

added formatted proxy URL #834

Conversation

kirill-ivlev
Copy link
Contributor

Added full proxy URL (http://user:password@host) for the getHttpProxyMethod
And cover this method with the unit tests.

@kirill-ivlev
Copy link
Contributor Author

@mmrazik Could you please review this PR

@@ -1767,6 +1767,7 @@ export function findMatch(defaultRoot: string, patterns: string[] | string, find

export interface ProxyConfiguration {
proxyUrl: string;
proxyFormattedUrl: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

What does proxyFormattedUrl mean - what is the format/purpose/how to use it? Could it make sense to add JSDoc comments here?
Please update docs as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

JSDoc added
Docs updated

node/task.ts Outdated
if (proxyUsername) {
proxyAddress = `${parsedUrl.protocol}//${proxyUsername}:${proxyPassword}@${parsedUrl.host}`;
}
console.log('returning proxy config');
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need to signalize about it in stdout (not even on debug level)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

@@ -1767,6 +1767,7 @@ export function findMatch(defaultRoot: string, patterns: string[] | string, find

export interface ProxyConfiguration {
proxyUrl: string;
proxyFormattedUrl: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

This field is not orthogonal to the other fields, so it could be error-prone in future (it depends on values of the fields like proxyUrl/proxyUsername, so if they will be changed - we would need to change it as well).
Could it make sense to just add some function which return formatted url - instead of adding new field to avoid such issue?

Copy link
Contributor

Choose a reason for hiding this comment

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

Resolved per offline discussion - since we considering that this is intended to be read-only object (containing current proxy settings) - it should be good to keep in a separate field

@anatolybolshakov
Copy link
Contributor

Could you please bump package version as well (patch number)?

@anatolybolshakov
Copy link
Contributor

LGTM, thanks! Please take a look at the comments also

import tl = require('azure-pipelines-task-lib/task');

async function run() {
let proxy = tl.getProxyConfiguration()

Choose a reason for hiding this comment

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

nit: const

@kirill-ivlev kirill-ivlev force-pushed the users/kirill-ivlev/add-proxy-formatted-url branch from fd046dd to 458f4a1 Compare May 19, 2022 07:22
@alexander-smolyakov
Copy link

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@alexander-smolyakov
Copy link

@mmrazik would you mind taking a look at this pull request?

@kirill-ivlev kirill-ivlev merged commit fb34438 into microsoft:master May 25, 2022
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.

None yet

4 participants