azure-pipelines-task-lib 3.2.1 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/package.json +2 -2
  2. package/task.d.ts +6 -0
  3. package/task.js +18 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "azure-pipelines-task-lib",
3
- "version": "3.2.1",
3
+ "version": "3.3.1",
4
4
  "description": "Azure Pipelines Task SDK",
5
5
  "main": "./task.js",
6
6
  "typings": "./task.d.ts",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "homepage": "https://github.com/Microsoft/azure-pipelines-task-lib",
29
29
  "dependencies": {
30
- "minimatch": "3.0.4",
30
+ "minimatch": "3.0.5",
31
31
  "mockery": "^1.7.0",
32
32
  "q": "^1.5.1",
33
33
  "semver": "^5.1.0",
package/task.d.ts CHANGED
@@ -530,6 +530,12 @@ export declare function filter(pattern: string, options?: MatchOptions): (elemen
530
530
  export declare function findMatch(defaultRoot: string, patterns: string[] | string, findOptions?: FindOptions, matchOptions?: MatchOptions): string[];
531
531
  export interface ProxyConfiguration {
532
532
  proxyUrl: string;
533
+ /**
534
+ * Proxy URI formated as: protocol://username:password@hostname:port
535
+ *
536
+ * For tools that require setting proxy configuration in the single environment variable
537
+ */
538
+ proxyFormattedUrl: string;
533
539
  proxyUsername?: string;
534
540
  proxyPassword?: string;
535
541
  proxyBypassHosts?: string[];
package/task.js CHANGED
@@ -1606,6 +1606,21 @@ function findMatch(defaultRoot, patterns, findOptions, matchOptions) {
1606
1606
  return finalResult;
1607
1607
  }
1608
1608
  exports.findMatch = findMatch;
1609
+ /**
1610
+ * Build Proxy URL in the following format: protocol://username:password@hostname:port
1611
+ * @param proxyUrl Url address of the proxy server (eg: http://example.com)
1612
+ * @param proxyUsername Proxy username (optional)
1613
+ * @param proxyPassword Proxy password (optional)
1614
+ * @returns string
1615
+ */
1616
+ function getProxyFormattedUrl(proxyUrl, proxyUsername, proxyPassword) {
1617
+ var parsedUrl = new URL(proxyUrl);
1618
+ var proxyAddress = parsedUrl.protocol + "//" + parsedUrl.host;
1619
+ if (proxyUsername) {
1620
+ proxyAddress = parsedUrl.protocol + "//" + proxyUsername + ":" + proxyPassword + "@" + parsedUrl.host;
1621
+ }
1622
+ return proxyAddress;
1623
+ }
1609
1624
  /**
1610
1625
  * Gets http proxy configuration used by Build/Release agent
1611
1626
  *
@@ -1629,11 +1644,13 @@ function getHttpProxyConfiguration(requestUrl) {
1629
1644
  return null;
1630
1645
  }
1631
1646
  else {
1647
+ var proxyAddress = getProxyFormattedUrl(proxyUrl, proxyUsername, proxyPassword);
1632
1648
  return {
1633
1649
  proxyUrl: proxyUrl,
1634
1650
  proxyUsername: proxyUsername,
1635
1651
  proxyPassword: proxyPassword,
1636
- proxyBypassHosts: proxyBypassHosts
1652
+ proxyBypassHosts: proxyBypassHosts,
1653
+ proxyFormattedUrl: proxyAddress
1637
1654
  };
1638
1655
  }
1639
1656
  }