diff --git a/Tasks/Common/artifacts-common/connectionDataUtils.ts b/Tasks/Common/artifacts-common/connectionDataUtils.ts index b83996fb9d8c..875ceb802a0d 100644 --- a/Tasks/Common/artifacts-common/connectionDataUtils.ts +++ b/Tasks/Common/artifacts-common/connectionDataUtils.ts @@ -79,7 +79,12 @@ async function getServiceUriFromAreaId(areaId: string, accessToken: string): Pro return serviceUriFromArea.locationUrl; } catch (error) { tl.debug(`Failed to obtain the service URI for area ID ${areaId}`); - tl.debug(JSON.stringify(error)); + if (error instanceof Error) { + if (error.message) { tl.debug(error.message); } + if (error.stack) { tl.debug(error.stack); } + } else { + tl.debug(error); + } throw error; } } \ No newline at end of file diff --git a/Tasks/Common/artifacts-common/retryUtils.ts b/Tasks/Common/artifacts-common/retryUtils.ts index 32eda0960bf6..d436355b8da3 100644 --- a/Tasks/Common/artifacts-common/retryUtils.ts +++ b/Tasks/Common/artifacts-common/retryUtils.ts @@ -11,7 +11,12 @@ export async function retryOnException(action: () => Promise, maxTries: nu throw error; } tl.debug(`Attempt failed. Number of tries left: ${maxTries}`); - tl.debug(JSON.stringify(error)); + if (error instanceof Error) { + if (error.message) { tl.debug(error.message); } + if (error.stack) { tl.debug(error.stack); } + } else { + tl.debug(error); + } await delay(retryIntervalInMilliseconds); } } diff --git a/Tasks/Common/packaging-common/Strings/resources.resjson/en-US/resources.resjson b/Tasks/Common/packaging-common/Strings/resources.resjson/en-US/resources.resjson index 311b0d1417ac..122592ad3a7c 100644 --- a/Tasks/Common/packaging-common/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/Common/packaging-common/Strings/resources.resjson/en-US/resources.resjson @@ -24,6 +24,6 @@ "loc.messages.NGCommon_SpsNotFound": "Unable to find the '%s' [%s] area. There may be a problem with your Team Foundation Server installation.", "loc.messages.NGCommon_UnabletoDetectNuGetVersion": "Unknown NuGet version selected.", "loc.messages.NGCommon_UnableToFindTool": "Unable to find tool %s", - "loc.messages.Warning_SessionCreationFailed": "Could not create provenance session: %s", + "loc.messages.Warning_SessionCreationFailed": "Could not create provenance session.", "loc.messages.Warning_UpdatingNuGetVersion": "Updating version of NuGet.exe to %s from %s. Behavior changes or breaking changes might occur as NuGet updates to a new version. If this is not desired, uncheck the 'Check for Latest Version' option in the task." } \ No newline at end of file diff --git a/Tasks/Common/packaging-common/locationUtilities.ts b/Tasks/Common/packaging-common/locationUtilities.ts index d96c6087b4e9..3b6590a83113 100644 --- a/Tasks/Common/packaging-common/locationUtilities.ts +++ b/Tasks/Common/packaging-common/locationUtilities.ts @@ -4,6 +4,7 @@ import * as tl from 'azure-pipelines-task-lib/task'; import { IRequestOptions } from 'azure-devops-node-api/interfaces/common/VsoBaseInterfaces'; import * as provenance from "./provenance"; +import { logError, LogType } from './util'; export enum ProtocolType { NuGet, @@ -36,12 +37,10 @@ export async function getServiceUriFromAreaId(serviceUri: string, accessToken: s const locationApi = await webApi.getLocationsApi(); tl.debug(`Getting URI for area ID ${areaId} from ${serviceUri}`); - try { - const serviceUriFromArea = await retryOnExceptionHelper(() => locationApi.getResourceArea(areaId), 3, 1000); - return serviceUriFromArea.locationUrl; - } catch (error) { - throw new Error(error); - } + const resourceArea = await retryOnExceptionHelper(() => locationApi.getResourceArea(areaId), 3, 1000); + tl.debug(`Found resource area with locationUrl: ${resourceArea && resourceArea.locationUrl}`); + + return resourceArea.locationUrl; } export async function getNuGetUriFromBaseServiceUri(serviceUri: string, accesstoken: string): Promise { @@ -87,16 +86,15 @@ export async function getPackagingUris(protocolType: ProtocolType): Promise locationApi.getConnectionData(interfaces.ConnectOptions.IncludeServices), 3, 1000); - tl.debug('Successfully acquired the connection data'); + const defaultAccessPoint: string = connectionData.locationServiceData.accessMappings.find((mapping) => mapping.moniker === connectionData.locationServiceData.defaultAccessMappingMoniker ).accessPoint; @@ -147,7 +145,9 @@ export function getWebApiWithProxy(serviceUri: string, accessToken?: string): vs allowRetries: true, maxRetries: 5 }; - return new vsts.WebApi(serviceUri, credentialHandler, options); + const webApi = new vsts.WebApi(serviceUri, credentialHandler, options); + tl.debug(`Created webApi client for ${serviceUri}; options: ${JSON.stringify(options)}`); + return webApi; } // This function is to apply retries generically for any unreliable network calls @@ -158,10 +158,10 @@ export async function retryOnExceptionHelper(action: () => Promise, maxTri } catch (error) { maxTries--; if (maxTries < 1) { - throw Error(error); + throw error; } tl.debug(`Network call failed. Number of retries left: ${maxTries}`); - tl.debug(JSON.stringify(error)); + if (error) { logError(error, LogType.warning); } await delay(retryIntervalInMilliseconds); } } @@ -178,8 +178,8 @@ interface RegistryLocation { }; export async function getFeedRegistryUrl( - packagingUrl: string, - registryType: RegistryType, + packagingUrl: string, + registryType: RegistryType, feedId: string, project: string, accessToken?: string, diff --git a/Tasks/Common/packaging-common/module.json b/Tasks/Common/packaging-common/module.json index f8286e3a7beb..ba2f4ab3c148 100644 --- a/Tasks/Common/packaging-common/module.json +++ b/Tasks/Common/packaging-common/module.json @@ -25,7 +25,7 @@ "NGCommon_SpsNotFound": "Unable to find the '%s' [%s] area. There may be a problem with your Team Foundation Server installation.", "NGCommon_UnabletoDetectNuGetVersion": "Unknown NuGet version selected.", "NGCommon_UnableToFindTool": "Unable to find tool %s", - "Warning_SessionCreationFailed": "Could not create provenance session: %s", + "Warning_SessionCreationFailed": "Could not create provenance session.", "Warning_UpdatingNuGetVersion": "Updating version of NuGet.exe to %s from %s. Behavior changes or breaking changes might occur as NuGet updates to a new version. If this is not desired, uncheck the 'Check for Latest Version' option in the task." } } \ No newline at end of file diff --git a/Tasks/Common/packaging-common/provenance.ts b/Tasks/Common/packaging-common/provenance.ts index d2e3032109b4..fe3f4743bade 100644 --- a/Tasks/Common/packaging-common/provenance.ts +++ b/Tasks/Common/packaging-common/provenance.ts @@ -3,6 +3,7 @@ import * as tl from 'azure-pipelines-task-lib'; import * as VsoBaseInterfaces from 'azure-devops-node-api/interfaces/common/VsoBaseInterfaces'; import { ClientVersioningData } from 'azure-devops-node-api/VsoClient'; import vstsClientBases = require('azure-devops-node-api/ClientApiBases'); +import { logError, LogType } from './util'; import * as restclient from 'typed-rest-client/RestClient'; @@ -67,7 +68,8 @@ export class ProvenanceHelper { const session = await prov.createSession(sessionRequest, protocol, project); return session.sessionId; } catch (error) { - tl.warning(tl.loc("Warning_SessionCreationFailed", JSON.stringify(error))); + tl.warning(tl.loc("Warning_SessionCreationFailed")); + logError(error, LogType.warning); } } return feedId; diff --git a/Tasks/Common/packaging-common/util.ts b/Tasks/Common/packaging-common/util.ts index 2cab209fd4ba..8f75be93e54f 100644 --- a/Tasks/Common/packaging-common/util.ts +++ b/Tasks/Common/packaging-common/util.ts @@ -82,8 +82,8 @@ export function getProjectAndFeedIdFromInputParam(inputParam: string): any { } export function getProjectAndFeedIdFromInput(feedProject: string): any { - var projectId = null; - var feedId = feedProject; + let projectId = null; + let feedId = feedProject; if(feedProject && feedProject.includes("/")) { const feedProjectParts = feedProject.split("/"); projectId = feedProjectParts[0] || null; @@ -95,3 +95,31 @@ export function getProjectAndFeedIdFromInput(feedProject: string): any { projectId: projectId } } + +export enum LogType { + debug, + warning, + error +} + +function log(message: string, logType: LogType) { + if (logType === LogType.warning) { + tl.warning(message); + } else if (logType === LogType.error) { + tl.error(message); + } else { + tl.debug(message); + } +} + +/** + * Logs the error instead of throwing. + */ +export function logError(error: any, logType: LogType = LogType.debug) { + if (error instanceof Error) { + if (error.message) { log(error.message, logType); } + if (error.stack) { log(error.stack, LogType.debug); } // Log stack always as debug + } else { + log(`Error: ${error}`, logType); + } +} diff --git a/Tasks/DotNetCoreCLIV2/pushcommand.ts b/Tasks/DotNetCoreCLIV2/pushcommand.ts index 478ce7089a88..09b4d14f4378 100644 --- a/Tasks/DotNetCoreCLIV2/pushcommand.ts +++ b/Tasks/DotNetCoreCLIV2/pushcommand.ts @@ -9,7 +9,7 @@ import { IExecOptions } from 'azure-pipelines-task-lib/toolrunner'; import { NuGetConfigHelper2 } from 'packaging-common/nuget/NuGetConfigHelper2'; import * as ngRunner from 'packaging-common/nuget/NuGetToolRunner2'; import * as pkgLocationUtils from 'packaging-common/locationUtilities'; -import { getProjectAndFeedIdFromInputParam } from 'packaging-common/util'; +import { getProjectAndFeedIdFromInputParam, logError } from 'packaging-common/util'; export async function run(): Promise { let packagingLocation: pkgLocationUtils.PackagingLocation; @@ -17,7 +17,7 @@ export async function run(): Promise { packagingLocation = await pkgLocationUtils.getPackagingUris(pkgLocationUtils.ProtocolType.NuGet); } catch (error) { tl.debug('Unable to get packaging URIs, using default collection URI'); - tl.debug(JSON.stringify(error)); + logError(error); const collectionUrl = tl.getVariable('System.TeamFoundationCollectionUri'); packagingLocation = { PackagingUris: [collectionUrl], diff --git a/Tasks/DotNetCoreCLIV2/restorecommand.ts b/Tasks/DotNetCoreCLIV2/restorecommand.ts index 3889ce3e1099..527df01d77cb 100644 --- a/Tasks/DotNetCoreCLIV2/restorecommand.ts +++ b/Tasks/DotNetCoreCLIV2/restorecommand.ts @@ -9,7 +9,7 @@ import { IExecOptions } from 'azure-pipelines-task-lib/toolrunner'; import * as nutil from 'packaging-common/nuget/Utility'; import * as commandHelper from 'packaging-common/nuget/CommandHelper'; import * as pkgLocationUtils from 'packaging-common/locationUtilities'; -import { getProjectAndFeedIdFromInputParam } from 'packaging-common/util'; +import { getProjectAndFeedIdFromInputParam, logError } from 'packaging-common/util'; export async function run(): Promise { let packagingLocation: pkgLocationUtils.PackagingLocation; @@ -17,7 +17,7 @@ export async function run(): Promise { packagingLocation = await pkgLocationUtils.getPackagingUris(pkgLocationUtils.ProtocolType.NuGet); } catch (error) { tl.debug('Unable to get packaging URIs, using default collection URI'); - tl.debug(JSON.stringify(error)); + logError(error); const collectionUrl = tl.getVariable('System.TeamFoundationCollectionUri'); packagingLocation = { PackagingUris: [collectionUrl], diff --git a/Tasks/DotNetCoreCLIV2/task.json b/Tasks/DotNetCoreCLIV2/task.json index 0e039ee861d5..d8c24d142418 100644 --- a/Tasks/DotNetCoreCLIV2/task.json +++ b/Tasks/DotNetCoreCLIV2/task.json @@ -17,7 +17,7 @@ "demands": [], "version": { "Major": 2, - "Minor": 164, + "Minor": 165, "Patch": 0 }, "minimumAgentVersion": "2.115.0", diff --git a/Tasks/DotNetCoreCLIV2/task.loc.json b/Tasks/DotNetCoreCLIV2/task.loc.json index 002677c69cde..49e4d39ef1c3 100644 --- a/Tasks/DotNetCoreCLIV2/task.loc.json +++ b/Tasks/DotNetCoreCLIV2/task.loc.json @@ -17,7 +17,7 @@ "demands": [], "version": { "Major": 2, - "Minor": 164, + "Minor": 165, "Patch": 0 }, "minimumAgentVersion": "2.115.0", diff --git a/Tasks/DownloadPackageV0/npm-shrinkwrap.json b/Tasks/DownloadPackageV0/npm-shrinkwrap.json index 4fd5c69ff65a..fba5801bfb98 100644 --- a/Tasks/DownloadPackageV0/npm-shrinkwrap.json +++ b/Tasks/DownloadPackageV0/npm-shrinkwrap.json @@ -43,12 +43,9 @@ "integrity": "sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ==" }, "@types/uuid": { - "version": "3.4.6", - "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-3.4.6.tgz", - "integrity": "sha512-cCdlC/1kGEZdEglzOieLDYBxHsvEOIg7kp/2FYyVR9Pxakq+Qf/inL3RKQ+PA8gOlI/NnL+fXmQH12nwcGzsHw==", - "requires": { - "@types/node": "*" - } + "version": "3.4.7", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-3.4.7.tgz", + "integrity": "sha512-C2j2FWgQkF1ru12SjZJyMaTPxs/f6n90+5G5qNakBxKXjTBc/YTSelHh4Pz1HUDwxFXD9WvpQhOGCDC+/Y4mIQ==" }, "abbrev": { "version": "1.1.0", @@ -76,9 +73,9 @@ } }, "azure-devops-node-api": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-8.0.0.tgz", - "integrity": "sha512-QkIzphuE3y/hZVMB6ONN0Dev5r9+CIAiopWulwoYx1Er0kYcsbXsKXKynuLSxsVPocMppbr4YPhTsX2eHY/Mjw==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-9.0.1.tgz", + "integrity": "sha512-0veE4EWHObJxzwgHlydG65BjNMuLPkR1nzcQ2K51PIho1/F4llpKt3pelC30Vbex5zA9iVgQ9YZGlkkvOBSksw==", "requires": { "tunnel": "0.0.4", "typed-rest-client": "1.2.0", @@ -280,7 +277,7 @@ }, "packaging-common": { "version": "file:../../_build/Tasks/Common/packaging-common-1.0.1.tgz", - "integrity": "sha512-FD0twlxEoNya5rM3H4NXRKboiivqf/mkVek86OTNVr+epl2+cpTLkcVOF98liCw60z7300DOCYk9O6Gxjo7HSg==", + "integrity": "sha512-PHc+laktXoJxvy2khoAYHN+Qo4LQjmuvBDuoe9NPDVE/ekKKjjgUCeZ0kTIMBQ7v/wcpKxfxTRdvvpMIZ8a29w==", "requires": { "@types/ini": "1.3.30", "@types/ltx": "2.8.0", @@ -303,6 +300,16 @@ "version": "10.12.9", "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.9.tgz", "integrity": "sha512-eajkMXG812/w3w4a1OcBlaTwsFPO5F7fJ/amy+tieQxEMWBlbV1JGSjkFM+zkHNf81Cad+dfIRA+IBkvmvdAeA==" + }, + "azure-devops-node-api": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-8.0.0.tgz", + "integrity": "sha512-QkIzphuE3y/hZVMB6ONN0Dev5r9+CIAiopWulwoYx1Er0kYcsbXsKXKynuLSxsVPocMppbr4YPhTsX2eHY/Mjw==", + "requires": { + "tunnel": "0.0.4", + "typed-rest-client": "1.2.0", + "underscore": "1.8.3" + } } } }, diff --git a/Tasks/DownloadPackageV0/task.json b/Tasks/DownloadPackageV0/task.json index 745dc5b33b91..341c2717df63 100644 --- a/Tasks/DownloadPackageV0/task.json +++ b/Tasks/DownloadPackageV0/task.json @@ -9,7 +9,7 @@ "author": "ms-vscs-rm", "version": { "Major": 0, - "Minor": 164, + "Minor": 165, "Patch": 0 }, "demands": [], diff --git a/Tasks/DownloadPackageV0/task.loc.json b/Tasks/DownloadPackageV0/task.loc.json index c1e07dd0fb24..a16c213ca725 100644 --- a/Tasks/DownloadPackageV0/task.loc.json +++ b/Tasks/DownloadPackageV0/task.loc.json @@ -9,8 +9,8 @@ "author": "ms-vscs-rm", "version": { "Major": 0, - "Minor": 161, - "Patch": 1 + "Minor": 165, + "Patch": 0 }, "demands": [], "minimumAgentVersion": "1.99.0", diff --git a/Tasks/DownloadPackageV1/task.json b/Tasks/DownloadPackageV1/task.json index 3e521748f700..b4aee83b805e 100644 --- a/Tasks/DownloadPackageV1/task.json +++ b/Tasks/DownloadPackageV1/task.json @@ -9,7 +9,7 @@ "author": "ms-vscs-rm", "version": { "Major": 1, - "Minor": 164, + "Minor": 165, "Patch": 0 }, "demands": [], diff --git a/Tasks/DownloadPackageV1/task.loc.json b/Tasks/DownloadPackageV1/task.loc.json index de222ab1f27d..4baac875e435 100644 --- a/Tasks/DownloadPackageV1/task.loc.json +++ b/Tasks/DownloadPackageV1/task.loc.json @@ -9,8 +9,8 @@ "author": "ms-vscs-rm", "version": { "Major": 1, - "Minor": 161, - "Patch": 2 + "Minor": 165, + "Patch": 0 }, "demands": [], "releaseNotes": "ms-resource:loc.releaseNotes", @@ -186,4 +186,4 @@ "Info_Downloading": "ms-resource:loc.messages.Info_Downloading", "Info_UsingArtifactToolDownload": "ms-resource:loc.messages.Info_UsingArtifactToolDownload" } -} +} \ No newline at end of file diff --git a/Tasks/MavenAuthenticateV0/task.json b/Tasks/MavenAuthenticateV0/task.json index c8999b68b12f..ac69dc161bbc 100644 --- a/Tasks/MavenAuthenticateV0/task.json +++ b/Tasks/MavenAuthenticateV0/task.json @@ -9,7 +9,7 @@ "author": "Microsoft Corporation", "version": { "Major": 0, - "Minor": 164, + "Minor": 165, "Patch": 0 }, "runsOn": [ diff --git a/Tasks/MavenV2/mavenutil.ts b/Tasks/MavenV2/mavenutil.ts index 648507603f60..279c7007b5c6 100644 --- a/Tasks/MavenV2/mavenutil.ts +++ b/Tasks/MavenV2/mavenutil.ts @@ -5,6 +5,7 @@ import fs = require('fs'); import * as tl from 'azure-pipelines-task-lib/task'; import * as tr from 'azure-pipelines-task-lib/toolrunner'; import * as pkgLocationUtils from "packaging-common/locationUtilities"; +import { logError } from 'packaging-common/util'; import * as url from "url"; import * as xml2js from 'xml2js'; @@ -200,7 +201,7 @@ async function collectFeedRepositories(pomContents:string): Promise { packagingLocation = await pkgLocationUtils.getPackagingUris(pkgLocationUtils.ProtocolType.Maven); } catch (error) { tl.debug("Unable to get packaging URIs, using default collection URI"); - tl.debug(JSON.stringify(error)); + logError(error); packagingLocation = { PackagingUris: [collectionUrl], DefaultPackagingUri: collectionUrl diff --git a/Tasks/MavenV2/task.json b/Tasks/MavenV2/task.json index f51266c57113..b3297ecf07a9 100644 --- a/Tasks/MavenV2/task.json +++ b/Tasks/MavenV2/task.json @@ -17,7 +17,7 @@ "author": "Microsoft Corporation", "version": { "Major": 2, - "Minor": 164, + "Minor": 165, "Patch": 0 }, "releaseNotes": "Configuration of the SonarQube analysis was moved to the [SonarQube](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarqube) or [SonarCloud](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarcloud) extensions, in task `Prepare Analysis Configuration`", diff --git a/Tasks/MavenV2/task.loc.json b/Tasks/MavenV2/task.loc.json index bdfc6e91bbfb..8b7704e25174 100644 --- a/Tasks/MavenV2/task.loc.json +++ b/Tasks/MavenV2/task.loc.json @@ -17,7 +17,7 @@ "author": "Microsoft Corporation", "version": { "Major": 2, - "Minor": 161, + "Minor": 165, "Patch": 0 }, "releaseNotes": "ms-resource:loc.releaseNotes", diff --git a/Tasks/MavenV3/mavenutil.ts b/Tasks/MavenV3/mavenutil.ts index 935192676319..2e4b60215712 100644 --- a/Tasks/MavenV3/mavenutil.ts +++ b/Tasks/MavenV3/mavenutil.ts @@ -5,6 +5,7 @@ import fs = require('fs'); import * as tl from 'azure-pipelines-task-lib/task'; import * as tr from 'azure-pipelines-task-lib/toolrunner'; import * as pkgLocationUtils from "packaging-common/locationUtilities"; +import { logError } from 'packaging-common/util'; import * as url from "url"; import * as xml2js from 'xml2js'; @@ -200,7 +201,7 @@ export async function collectFeedRepositories(pomContents:string): Promise packagingLocation = await pkgLocationUtils.getPackagingUris(pkgLocationUtils.ProtocolType.Maven); } catch (error) { tl.debug("Unable to get packaging URIs, using default collection URI"); - tl.debug(JSON.stringify(error)); + logError(error); packagingLocation = { PackagingUris: [collectionUrl], DefaultPackagingUri: collectionUrl}; diff --git a/Tasks/MavenV3/task.json b/Tasks/MavenV3/task.json index a210ee1cac03..9ceb030ab90e 100644 --- a/Tasks/MavenV3/task.json +++ b/Tasks/MavenV3/task.json @@ -17,7 +17,7 @@ "author": "Microsoft Corporation", "version": { "Major": 3, - "Minor": 164, + "Minor": 165, "Patch": 0 }, "releaseNotes": "Configuration of the SonarQube analysis was moved to the [SonarQube](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarqube) or [SonarCloud](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarcloud) extensions, in task `Prepare Analysis Configuration`", diff --git a/Tasks/MavenV3/task.loc.json b/Tasks/MavenV3/task.loc.json index 5b5d533eb9be..1c2985ef6771 100644 --- a/Tasks/MavenV3/task.loc.json +++ b/Tasks/MavenV3/task.loc.json @@ -17,7 +17,7 @@ "author": "Microsoft Corporation", "version": { "Major": 3, - "Minor": 161, + "Minor": 165, "Patch": 0 }, "releaseNotes": "ms-resource:loc.releaseNotes", diff --git a/Tasks/NpmAuthenticateV0/npmauth.ts b/Tasks/NpmAuthenticateV0/npmauth.ts index 3080b69eff04..0873fa0eb591 100644 --- a/Tasks/NpmAuthenticateV0/npmauth.ts +++ b/Tasks/NpmAuthenticateV0/npmauth.ts @@ -72,7 +72,7 @@ async function main(): Promise { packagingLocation = await pkgLocationUtils.getPackagingUris(pkgLocationUtils.ProtocolType.Npm); } catch (error) { tl.debug('Unable to get packaging URIs, using default collection URI'); - tl.debug(JSON.stringify(error)); + util.logError(error); const collectionUrl = tl.getVariable('System.TeamFoundationCollectionUri'); packagingLocation = { PackagingUris: [collectionUrl], @@ -80,14 +80,14 @@ async function main(): Promise { }; } let LocalNpmRegistries = await npmutil.getLocalNpmRegistries(workingDirectory, packagingLocation.PackagingUris); - + let npmrcFile = fs.readFileSync(npmrc, 'utf8').split(os.EOL); for (let RegistryURLString of npmrcparser.GetRegistries(npmrc, /* saveNormalizedRegistries */ true)) { let registryURL = URL.parse(RegistryURLString); let registry: npmregistry.NpmRegistry; if (endpointRegistries && endpointRegistries.length > 0) { for (let serviceEndpoint of endpointRegistries) { - + if (util.toNerfDart(serviceEndpoint.url) == util.toNerfDart(RegistryURLString)) { let serviceURL = URL.parse(serviceEndpoint.url); console.log(tl.loc("AddingEndpointCredentials", registryURL.host)); diff --git a/Tasks/NpmAuthenticateV0/task.json b/Tasks/NpmAuthenticateV0/task.json index 412312cc38ea..348e63d4ccb4 100644 --- a/Tasks/NpmAuthenticateV0/task.json +++ b/Tasks/NpmAuthenticateV0/task.json @@ -9,7 +9,7 @@ "author": "Microsoft Corporation", "version": { "Major": 0, - "Minor": 164, + "Minor": 165, "Patch": 0 }, "runsOn": [ diff --git a/Tasks/NpmAuthenticateV0/task.loc.json b/Tasks/NpmAuthenticateV0/task.loc.json index f0ce082b0eef..3b9a0d4af491 100644 --- a/Tasks/NpmAuthenticateV0/task.loc.json +++ b/Tasks/NpmAuthenticateV0/task.loc.json @@ -9,7 +9,7 @@ "author": "Microsoft Corporation", "version": { "Major": 0, - "Minor": 161, + "Minor": 165, "Patch": 0 }, "runsOn": [ @@ -66,4 +66,4 @@ "argumentFormat": "" } } -} +} \ No newline at end of file diff --git a/Tasks/NpmV0/npmtask.ts b/Tasks/NpmV0/npmtask.ts index 848c0febb60e..3c91b2683228 100644 --- a/Tasks/NpmV0/npmtask.ts +++ b/Tasks/NpmV0/npmtask.ts @@ -5,6 +5,7 @@ import tl = require('vsts-task-lib/task'); import trm = require('vsts-task-lib/toolrunner'); var extend = require('util')._extend; import * as pkgLocationUtils from "packaging-common/locationUtilities"; +import { logError } from 'packaging-common/util'; interface EnvironmentDictionary { [key: string]: string; } @@ -199,7 +200,7 @@ async function addBuildCredProviderEnv(env: EnvironmentDictionary) : Promise { packagingLocation = await pkgLocationUtils.getPackagingUris(pkgLocationUtils.ProtocolType.Npm); } catch (error) { tl.debug('Unable to get packaging URIs, using default collection URI'); - tl.debug(JSON.stringify(error)); + util.logError(error); const collectionUrl = tl.getVariable('System.TeamFoundationCollectionUri'); packagingLocation = { PackagingUris: [collectionUrl], diff --git a/Tasks/NpmV1/task.json b/Tasks/NpmV1/task.json index e1135137abf5..b02b780efd86 100644 --- a/Tasks/NpmV1/task.json +++ b/Tasks/NpmV1/task.json @@ -9,7 +9,7 @@ "author": "Microsoft Corporation", "version": { "Major": 1, - "Minor": 164, + "Minor": 165, "Patch": 0 }, "runsOn": [ diff --git a/Tasks/NpmV1/task.loc.json b/Tasks/NpmV1/task.loc.json index 181d2f1de659..f9eaaa032435 100644 --- a/Tasks/NpmV1/task.loc.json +++ b/Tasks/NpmV1/task.loc.json @@ -9,7 +9,7 @@ "author": "Microsoft Corporation", "version": { "Major": 1, - "Minor": 161, + "Minor": 165, "Patch": 0 }, "runsOn": [ @@ -197,4 +197,4 @@ "WorkingDirectoryNotDirectory": "ms-resource:loc.messages.WorkingDirectoryNotDirectory", "NGCommon_AreaNotFoundInSps": "ms-resource:loc.messages.NGCommon_AreaNotFoundInSps" } -} +} \ No newline at end of file diff --git a/Tasks/NuGetAuthenticateV0/task.json b/Tasks/NuGetAuthenticateV0/task.json index 795878a30297..57c5139d5f05 100644 --- a/Tasks/NuGetAuthenticateV0/task.json +++ b/Tasks/NuGetAuthenticateV0/task.json @@ -13,7 +13,7 @@ ], "version": { "Major": 0, - "Minor": 161, + "Minor": 165, "Patch": 0 }, "minimumAgentVersion": "2.120.0", diff --git a/Tasks/NuGetCommandV2/nugetcustom.ts b/Tasks/NuGetCommandV2/nugetcustom.ts index 1286a5b9bdef..b92bc0675c2a 100644 --- a/Tasks/NuGetCommandV2/nugetcustom.ts +++ b/Tasks/NuGetCommandV2/nugetcustom.ts @@ -2,6 +2,7 @@ import * as auth from "packaging-common/nuget/Authentication"; import * as ngToolRunner from "packaging-common/nuget/NuGetToolRunner2"; import * as nutil from "packaging-common/nuget/Utility"; import * as tl from "azure-pipelines-task-lib/task"; +import { logError } from 'packaging-common/util'; import peParser = require("packaging-common/pe-parser/index"); import * as pkgLocationUtils from "packaging-common/locationUtilities"; @@ -23,7 +24,7 @@ export async function run(nuGetPath: string): Promise { packagingLocation = await pkgLocationUtils.getPackagingUris(pkgLocationUtils.ProtocolType.NuGet); } catch (error) { tl.debug("Unable to get packaging URIs, using default collection URI"); - tl.debug(JSON.stringify(error)); + logError(error); const collectionUrl = tl.getVariable("System.TeamFoundationCollectionUri"); packagingLocation = { PackagingUris: [collectionUrl], diff --git a/Tasks/NuGetCommandV2/nugetpublisher.ts b/Tasks/NuGetCommandV2/nugetpublisher.ts index adcd60d728fb..ae57226f5e0e 100644 --- a/Tasks/NuGetCommandV2/nugetpublisher.ts +++ b/Tasks/NuGetCommandV2/nugetpublisher.ts @@ -14,6 +14,7 @@ import INuGetCommandOptions from "packaging-common/nuget/INuGetCommandOptions2"; import * as vstsNuGetPushToolRunner from "./Common/VstsNuGetPushToolRunner"; import * as vstsNuGetPushToolUtilities from "./Common/VstsNuGetPushToolUtilities"; import { getProjectAndFeedIdFromInputParam } from 'packaging-common/util'; +import { logError } from 'packaging-common/util'; class PublishOptions implements INuGetCommandOptions { constructor( @@ -41,7 +42,7 @@ export async function run(nuGetPath: string): Promise { packagingLocation = await pkgLocationUtils.getPackagingUris(pkgLocationUtils.ProtocolType.NuGet); } catch (error) { tl.debug("Unable to get packaging URIs, using default collection URI"); - tl.debug(JSON.stringify(error)); + logError(error); const collectionUrl = tl.getVariable("System.TeamFoundationCollectionUri"); packagingLocation = { PackagingUris: [collectionUrl], diff --git a/Tasks/NuGetCommandV2/nugetrestore.ts b/Tasks/NuGetCommandV2/nugetrestore.ts index e8b56311ee8d..98412665ec11 100644 --- a/Tasks/NuGetCommandV2/nugetrestore.ts +++ b/Tasks/NuGetCommandV2/nugetrestore.ts @@ -13,6 +13,7 @@ import * as pkgLocationUtils from "packaging-common/locationUtilities"; import * as telemetry from "utility-common/telemetry"; import INuGetCommandOptions from "packaging-common/nuget/INuGetCommandOptions2"; import { getProjectAndFeedIdFromInputParam } from 'packaging-common/util'; +import { logError } from 'packaging-common/util'; class RestoreOptions implements INuGetCommandOptions { constructor( @@ -33,7 +34,7 @@ export async function run(nuGetPath: string): Promise { packagingLocation = await pkgLocationUtils.getPackagingUris(pkgLocationUtils.ProtocolType.NuGet); } catch (error) { tl.debug("Unable to get packaging URIs, using default collection URI"); - tl.debug(JSON.stringify(error)); + logError(error); const collectionUrl = tl.getVariable("System.TeamFoundationCollectionUri"); packagingLocation = { PackagingUris: [collectionUrl], diff --git a/Tasks/NuGetCommandV2/task.json b/Tasks/NuGetCommandV2/task.json index d1d999cb77b2..5c9dc50b6594 100644 --- a/Tasks/NuGetCommandV2/task.json +++ b/Tasks/NuGetCommandV2/task.json @@ -9,7 +9,7 @@ "author": "Microsoft Corporation", "version": { "Major": 2, - "Minor": 164, + "Minor": 165, "Patch": 0 }, "runsOn": [ diff --git a/Tasks/NuGetCommandV2/task.loc.json b/Tasks/NuGetCommandV2/task.loc.json index f275d10ef5e6..721852f801ef 100644 --- a/Tasks/NuGetCommandV2/task.loc.json +++ b/Tasks/NuGetCommandV2/task.loc.json @@ -9,8 +9,8 @@ "author": "Microsoft Corporation", "version": { "Major": 2, - "Minor": 161, - "Patch": 1 + "Minor": 165, + "Patch": 0 }, "runsOn": [ "Agent", @@ -535,4 +535,4 @@ "Warning_UpdatingNuGetVersion": "ms-resource:loc.messages.Warning_UpdatingNuGetVersion", "Error_NugetFailedWithCodeAndErr": "ms-resource:loc.messages.Error_NugetFailedWithCodeAndErr" } -} +} \ No newline at end of file diff --git a/Tasks/NuGetPublisherV0/nugetpublisher.ts b/Tasks/NuGetPublisherV0/nugetpublisher.ts index 98ed9825d405..dc97c0735fa1 100644 --- a/Tasks/NuGetPublisherV0/nugetpublisher.ts +++ b/Tasks/NuGetPublisherV0/nugetpublisher.ts @@ -9,6 +9,7 @@ import * as ngToolGetter from "packaging-common/nuget/NuGetToolGetter"; import * as ngToolRunner from "packaging-common/nuget/NuGetToolRunner"; import * as nutil from "packaging-common/nuget/Utility"; import * as pkgLocationUtils from "packaging-common/locationUtilities"; +import { logError } from 'packaging-common/util'; class PublishOptions implements INuGetCommandOptions { constructor( @@ -28,7 +29,7 @@ async function main(): Promise { packagingLocation = await pkgLocationUtils.getPackagingUris(pkgLocationUtils.ProtocolType.NuGet); } catch (error) { tl.debug("Unable to get packaging URIs, using default collection URI"); - tl.debug(JSON.stringify(error)); + logError(error); const collectionUrl = tl.getVariable("System.TeamFoundationCollectionUri"); packagingLocation = { PackagingUris: [collectionUrl], diff --git a/Tasks/NuGetPublisherV0/task.json b/Tasks/NuGetPublisherV0/task.json index 1eaa94ed4568..30a7616e7cb9 100644 --- a/Tasks/NuGetPublisherV0/task.json +++ b/Tasks/NuGetPublisherV0/task.json @@ -9,7 +9,7 @@ "author": "Lawrence Gripper", "version": { "Major": 0, - "Minor": 164, + "Minor": 165, "Patch": 0 }, "runsOn": [ diff --git a/Tasks/NuGetPublisherV0/task.loc.json b/Tasks/NuGetPublisherV0/task.loc.json index 2298b748805e..4b26e86ac1ba 100644 --- a/Tasks/NuGetPublisherV0/task.loc.json +++ b/Tasks/NuGetPublisherV0/task.loc.json @@ -9,7 +9,7 @@ "author": "Lawrence Gripper", "version": { "Major": 0, - "Minor": 161, + "Minor": 165, "Patch": 0 }, "runsOn": [ @@ -170,4 +170,4 @@ "NGCommon_UnableToFindTool": "ms-resource:loc.messages.NGCommon_UnableToFindTool", "Warning_UpdatingNuGetVersion": "ms-resource:loc.messages.Warning_UpdatingNuGetVersion" } -} +} \ No newline at end of file diff --git a/Tasks/NuGetToolInstallerV0/task.json b/Tasks/NuGetToolInstallerV0/task.json index 7d242f619640..7d48aa500692 100644 --- a/Tasks/NuGetToolInstallerV0/task.json +++ b/Tasks/NuGetToolInstallerV0/task.json @@ -14,7 +14,7 @@ "author": "Microsoft Corporation", "version": { "Major": 0, - "Minor": 164, + "Minor": 165, "Patch": 0 }, "preview": false, diff --git a/Tasks/NuGetToolInstallerV0/task.loc.json b/Tasks/NuGetToolInstallerV0/task.loc.json index 063daa42844c..1d920bf7d67c 100644 --- a/Tasks/NuGetToolInstallerV0/task.loc.json +++ b/Tasks/NuGetToolInstallerV0/task.loc.json @@ -14,7 +14,7 @@ "author": "Microsoft Corporation", "version": { "Major": 0, - "Minor": 161, + "Minor": 165, "Patch": 0 }, "preview": false, @@ -75,4 +75,4 @@ "NGCommon_UnableToFindTool": "ms-resource:loc.messages.NGCommon_UnableToFindTool", "Warning_UpdatingNuGetVersion": "ms-resource:loc.messages.Warning_UpdatingNuGetVersion" } -} +} \ No newline at end of file diff --git a/Tasks/NuGetToolInstallerV1/task.json b/Tasks/NuGetToolInstallerV1/task.json index 55b3421ec22d..ba31ed2fc8d1 100644 --- a/Tasks/NuGetToolInstallerV1/task.json +++ b/Tasks/NuGetToolInstallerV1/task.json @@ -14,7 +14,7 @@ "author": "Microsoft Corporation", "version": { "Major": 1, - "Minor": 164, + "Minor": 165, "Patch": 0 }, "preview": false, diff --git a/Tasks/NuGetToolInstallerV1/task.loc.json b/Tasks/NuGetToolInstallerV1/task.loc.json index 4305c3a30282..c2087ed87118 100644 --- a/Tasks/NuGetToolInstallerV1/task.loc.json +++ b/Tasks/NuGetToolInstallerV1/task.loc.json @@ -14,7 +14,7 @@ "author": "Microsoft Corporation", "version": { "Major": 1, - "Minor": 161, + "Minor": 165, "Patch": 0 }, "preview": false, @@ -83,4 +83,4 @@ "NGCommon_UnableToFindTool": "ms-resource:loc.messages.NGCommon_UnableToFindTool", "Warning_UpdatingNuGetVersion": "ms-resource:loc.messages.Warning_UpdatingNuGetVersion" } -} +} \ No newline at end of file diff --git a/Tasks/NuGetV0/nuget.ts b/Tasks/NuGetV0/nuget.ts index 597a00a3726e..92b00b95a132 100644 --- a/Tasks/NuGetV0/nuget.ts +++ b/Tasks/NuGetV0/nuget.ts @@ -7,6 +7,7 @@ import * as auth from "packaging-common/nuget/Authentication"; import nuGetGetter = require("packaging-common/nuget/NuGetToolGetter"); import peParser = require('packaging-common/pe-parser/index'); import * as pkgLocationUtils from "packaging-common/locationUtilities"; +import { logError } from 'packaging-common/util'; class NuGetExecutionOptions { constructor( @@ -23,7 +24,7 @@ async function main(): Promise { packagingLocation = await pkgLocationUtils.getPackagingUris(pkgLocationUtils.ProtocolType.NuGet); } catch (error) { tl.debug("Unable to get packaging URIs, using default collection URI"); - tl.debug(JSON.stringify(error)); + logError(error); const collectionUrl = tl.getVariable("System.TeamFoundationCollectionUri"); packagingLocation = { PackagingUris: [collectionUrl], diff --git a/Tasks/NuGetV0/task.json b/Tasks/NuGetV0/task.json index d9e6bbe8a68e..7b8d5574a023 100644 --- a/Tasks/NuGetV0/task.json +++ b/Tasks/NuGetV0/task.json @@ -10,7 +10,7 @@ "helpMarkDown": "", "version": { "Major": 0, - "Minor": 164, + "Minor": 165, "Patch": 0 }, "runsOn": [ diff --git a/Tasks/NuGetV0/task.loc.json b/Tasks/NuGetV0/task.loc.json index c22403bbb952..b4af85cf4654 100644 --- a/Tasks/NuGetV0/task.loc.json +++ b/Tasks/NuGetV0/task.loc.json @@ -10,7 +10,7 @@ "helpMarkDown": "ms-resource:loc.helpMarkDown", "version": { "Major": 0, - "Minor": 161, + "Minor": 165, "Patch": 0 }, "runsOn": [ @@ -75,4 +75,4 @@ "NGCommon_UnableToFindTool": "ms-resource:loc.messages.NGCommon_UnableToFindTool", "Warning_UpdatingNuGetVersion": "ms-resource:loc.messages.Warning_UpdatingNuGetVersion" } -} +} \ No newline at end of file diff --git a/Tasks/PipAuthenticateV0/pipauthenticatemain.ts b/Tasks/PipAuthenticateV0/pipauthenticatemain.ts index 1836d3e6158c..5b943d8fe083 100644 --- a/Tasks/PipAuthenticateV0/pipauthenticatemain.ts +++ b/Tasks/PipAuthenticateV0/pipauthenticatemain.ts @@ -4,7 +4,7 @@ import * as pkgLocationUtils from "packaging-common/locationUtilities"; import * as telemetry from "utility-common/telemetry"; import * as auth from "./authentication"; import * as utils from "./utilities"; -import { getProjectAndFeedIdFromInput } from 'packaging-common/util'; +import { getProjectAndFeedIdFromInput, logError } from 'packaging-common/util'; async function main(): Promise { tl.setResourcePath(path.join(__dirname, "task.json")); @@ -32,7 +32,7 @@ async function main(): Promise { localAccessToken); } catch (error) { tl.debug(tl.loc("FailedToGetPackagingUri")); - tl.debug(JSON.stringify(error)); + logError(error); packagingLocation = serviceUri; } diff --git a/Tasks/PipAuthenticateV0/task.json b/Tasks/PipAuthenticateV0/task.json index 070fb575bbad..388f578b91e0 100644 --- a/Tasks/PipAuthenticateV0/task.json +++ b/Tasks/PipAuthenticateV0/task.json @@ -9,7 +9,7 @@ "category": "Package", "version": { "Major": 0, - "Minor": 164, + "Minor": 165, "Patch": 0 }, "runsOn": [ diff --git a/Tasks/PipAuthenticateV0/task.loc.json b/Tasks/PipAuthenticateV0/task.loc.json index 37958d95933c..9a175164520c 100644 --- a/Tasks/PipAuthenticateV0/task.loc.json +++ b/Tasks/PipAuthenticateV0/task.loc.json @@ -9,7 +9,7 @@ "category": "Package", "version": { "Major": 0, - "Minor": 161, + "Minor": 165, "Patch": 0 }, "runsOn": [ @@ -86,4 +86,4 @@ "Warn_TooManyFeedEntries": "ms-resource:loc.messages.Warn_TooManyFeedEntries", "Warning_SessionCreationFailed": "ms-resource:loc.messages.Warning_SessionCreationFailed" } -} +} \ No newline at end of file diff --git a/Tasks/PipAuthenticateV1/task.json b/Tasks/PipAuthenticateV1/task.json index aa2683ea66bc..41aefe3d1407 100644 --- a/Tasks/PipAuthenticateV1/task.json +++ b/Tasks/PipAuthenticateV1/task.json @@ -9,8 +9,8 @@ "category": "Package", "version": { "Major": 1, - "Minor": 156, - "Patch": 2 + "Minor": 165, + "Patch": 0 }, "runsOn": [ "Agent", diff --git a/Tasks/PyPIPublisherV0/Strings/resources.resjson/en-US/resources.resjson b/Tasks/PyPIPublisherV0/Strings/resources.resjson/en-US/resources.resjson index ebaa79380323..4caecabe9bf9 100644 --- a/Tasks/PyPIPublisherV0/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/PyPIPublisherV0/Strings/resources.resjson/en-US/resources.resjson @@ -1,6 +1,6 @@ { "loc.friendlyName": "PyPI publisher", - "loc.helpMarkDown": "[More Information](https://go.microsoft.com/fwlink/?linkid=875289)", + "loc.helpMarkDown": "[Learn more about this task](https://go.microsoft.com/fwlink/?linkid=875289)", "loc.description": "Create and upload an sdist or wheel to a PyPI-compatible index using Twine", "loc.instanceNameFormat": "Package and publish to PyPI", "loc.input.label.serviceEndpoint": "PyPI service connection", diff --git a/Tasks/TwineAuthenticateV0/authentication.ts b/Tasks/TwineAuthenticateV0/authentication.ts index f86d8815e952..fa324123eb12 100644 --- a/Tasks/TwineAuthenticateV0/authentication.ts +++ b/Tasks/TwineAuthenticateV0/authentication.ts @@ -1,6 +1,7 @@ import * as tl from "azure-pipelines-task-lib/task"; import * as pkgLocationUtils from "packaging-common/locationUtilities"; import { getProjectAndFeedIdFromInput } from 'packaging-common/util'; +import { logError } from 'packaging-common/util'; export interface IPackageSource { feedUri: string; @@ -50,7 +51,7 @@ export async function getInternalAuthInfoArray(inputKey: string): Promise { const buildIdentityDisplayName: string = null; @@ -69,7 +70,7 @@ export async function run(artifactToolPath: string): Promise { serviceUri, accessToken); } catch (error) { - tl.debug(JSON.stringify(error)); + logError(error); packagingLocation = serviceUri; } diff --git a/Tasks/UseDotNetV2/task.json b/Tasks/UseDotNetV2/task.json index 14fb997ad036..83ba2371f669 100644 --- a/Tasks/UseDotNetV2/task.json +++ b/Tasks/UseDotNetV2/task.json @@ -13,7 +13,7 @@ "author": "Microsoft Corporation", "version": { "Major": 2, - "Minor": 164, + "Minor": 165, "Patch": 0 }, "satisfies": [ diff --git a/Tasks/UseNodeV1/task.json b/Tasks/UseNodeV1/task.json index e4b2eec5adbc..afba2698c915 100644 --- a/Tasks/UseNodeV1/task.json +++ b/Tasks/UseNodeV1/task.json @@ -16,7 +16,7 @@ "author": "Microsoft Corporation", "version": { "Major": 1, - "Minor": 164, + "Minor": 165, "Patch": 0 }, "satisfies": [