diff --git a/Tasks/PublishTestResultsV2/Strings/resources.resjson/en-US/resources.resjson b/Tasks/PublishTestResultsV2/Strings/resources.resjson/en-US/resources.resjson index 768a0886c1dd..60e89a5f59e5 100644 --- a/Tasks/PublishTestResultsV2/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/PublishTestResultsV2/Strings/resources.resjson/en-US/resources.resjson @@ -15,6 +15,8 @@ "loc.input.help.mergeTestResults": "A test run is created for each results file. Check this option to merge results into a single test run. To optimize for better performance, results will be merged into a single run if there are more than 100 result files, irrespective of this option.", "loc.input.label.failTaskOnFailedTests": "Fail if there are test failures", "loc.input.help.failTaskOnFailedTests": "Fail the task if there are any test failures. Check this option to fail the task if test failures are detected in the result files.", + "loc.input.label.failTaskOnFailureToPublishResults": "Fail if there is failure in publishing test results", + "loc.input.help.failTaskOnFailureToPublishResults": "Fail if there is failure in publishing test results. Check this option to fail the task if publishing test results is failed partially.", "loc.input.label.failTaskOnMissingResultsFile": "Fail if no result files are found", "loc.input.help.failTaskOnMissingResultsFile": "Fail the task if no result files are found.", "loc.input.label.testRunTitle": "Test run title", diff --git a/Tasks/PublishTestResultsV2/Tests/Constants.ts b/Tasks/PublishTestResultsV2/Tests/Constants.ts index 70a1543255ea..a9c3abe0b563 100644 --- a/Tasks/PublishTestResultsV2/Tests/Constants.ts +++ b/Tasks/PublishTestResultsV2/Tests/Constants.ts @@ -13,4 +13,5 @@ export const failTaskOnFailedTests = 'failTaskOnFailedTests'; export const proxyUrl = 'agent.proxyurl'; export const proxyUserName = 'agent.proxyusername'; export const proxyPassword = 'agent.proxypassword'; -export const proxyByPassHosts = 'agent.proxybypasslist'; \ No newline at end of file +export const proxyByPassHosts = 'agent.proxybypasslist'; +export const failTaskOnFailureToPublishResults = 'failTaskOnFailureToPublishResults'; \ No newline at end of file diff --git a/Tasks/PublishTestResultsV2/Tests/L0.ts b/Tasks/PublishTestResultsV2/Tests/L0.ts index 4804af4007f8..acff3d352e20 100644 --- a/Tasks/PublishTestResultsV2/Tests/L0.ts +++ b/Tasks/PublishTestResultsV2/Tests/L0.ts @@ -29,6 +29,7 @@ describe('PublishTestResults Suite', function() { delete process.env[constants.listPackagesReturnCode]; delete process.env[constants.osType]; delete process.env[constants.failTaskOnFailedTests]; + delete process.env[constants.failTaskOnFailureToPublishResults]; done(); }); @@ -60,6 +61,7 @@ describe('PublishTestResults Suite', function() { process.env[constants.proxyUserName] = "1"; process.env[constants.proxyPassword] = "1"; process.env[constants.proxyByPassHosts] = undefined; + process.env[constants.failTaskOnFailureToPublishResults] = 'false'; // Start the run tr.run(); @@ -96,6 +98,7 @@ describe('PublishTestResults Suite', function() { process.env[constants.proxyUserName] = "1"; process.env[constants.proxyPassword] = "1"; process.env[constants.proxyByPassHosts] = undefined; + process.env[constants.failTaskOnFailureToPublishResults] = 'false'; // Start the run tr.run(); @@ -132,6 +135,7 @@ describe('PublishTestResults Suite', function() { process.env[constants.proxyUserName] = "1"; process.env[constants.proxyPassword] = "1"; process.env[constants.proxyByPassHosts] = undefined; + process.env[constants.failTaskOnFailureToPublishResults] = 'false'; // Start the run tr.run(); @@ -142,7 +146,7 @@ describe('PublishTestResults Suite', function() { assert.equal(tr.invokedToolCount, 1, `invoked tool count should be 1`); assert(tr.stdOutContained(`TestResultsPublisher.exe`), `Should have called TestResultsPublisher.exe first`); - assert(tr.stdOutContained(`vso[results.publish type=VSTest;mergeResults=false;publishRunAttachments=false;resultFiles=n-files0.xml;failTaskOnFailedTests=false;testRunSystem=VSTS - PTR;]`), + assert(tr.stdOutContained(`vso[results.publish type=VSTest;mergeResults=false;publishRunAttachments=false;resultFiles=n-files0.xml;failTaskOnFailedTests=false;failTaskOnFailureToPublishResults=false;testRunSystem=VSTS - PTR;]`), `Should have published results through Command when feature flag is off`); done(); @@ -172,6 +176,7 @@ describe('PublishTestResults Suite', function() { process.env[constants.proxyUserName] = "1"; process.env[constants.proxyPassword] = "1"; process.env[constants.proxyByPassHosts] = undefined; + process.env[constants.failTaskOnFailureToPublishResults] = 'false'; // Start the run tr.run(); @@ -182,7 +187,7 @@ describe('PublishTestResults Suite', function() { assert.equal(tr.invokedToolCount, 1, `invoked tool count should be 1`); assert(tr.stdOutContained(`TestResultsPublisher.exe`), `Should have called TestResultsPublisher.exe first`); - assert(tr.stdout.indexOf(`vso[results.publish type=VSTest;mergeResults=false;publishRunAttachments=false;resultFiles=n-files0.xml;failTaskOnFailedTests=false;testRunSystem=VSTS - PTR;]`) < 0, + assert(tr.stdout.indexOf(`vso[results.publish type=VSTest;mergeResults=false;publishRunAttachments=false;resultFiles=n-files0.xml;failTaskOnFailedTests=false;failTaskOnFailureToPublishResults=false;testRunSystem=VSTS - PTR;]`) < 0, `Command should not have been called when exe returns with exit code suggesting feature flag is on`); done(); diff --git a/Tasks/PublishTestResultsV2/Tests/TestSetup.ts b/Tasks/PublishTestResultsV2/Tests/TestSetup.ts index 534e4a25a440..c3509109b18c 100644 --- a/Tasks/PublishTestResultsV2/Tests/TestSetup.ts +++ b/Tasks/PublishTestResultsV2/Tests/TestSetup.ts @@ -18,6 +18,7 @@ tr.setInput('testRunTitle', process.env[constants.testRunTitle]); tr.setInput('publishRunAttachments', process.env[constants.publishRunAttachments]); tr.setInput('searchFolder', process.env[constants.searchFolder]); tr.setInput('failTaskOnFailedTests', process.env[constants.failTaskOnFailedTests]); +tr.setInput('failTaskOnFailureToPublishResults', process.env[constants.failTaskOnFailureToPublishResults]); const PublishExeToolPath = path.join(__dirname, '../modules', 'TestResultsPublisher.exe'); const newUuid = "1e1faf9e-d9e5-4054-b351-398ac75b62f5"; diff --git a/Tasks/PublishTestResultsV2/publishtestresults.ts b/Tasks/PublishTestResultsV2/publishtestresults.ts index 9fe7cfee3a15..5e8de343c63b 100644 --- a/Tasks/PublishTestResultsV2/publishtestresults.ts +++ b/Tasks/PublishTestResultsV2/publishtestresults.ts @@ -16,7 +16,7 @@ function isNullOrWhitespace(input: any) { return input.replace(/\s/g, '').length < 1; } -function publish(testRunner, resultFiles, mergeResults, failTaskOnFailedTests, platform, config, runTitle, publishRunAttachments, testRunSystem) { +function publish(testRunner, resultFiles, mergeResults, failTaskOnFailedTests, platform, config, runTitle, publishRunAttachments, testRunSystem , failTaskOnFailureToPublishResults) { var properties = <{ [key: string]: string }>{}; properties['type'] = testRunner; @@ -41,6 +41,9 @@ function publish(testRunner, resultFiles, mergeResults, failTaskOnFailedTests, p if(failTaskOnFailedTests){ properties['failTaskOnFailedTests'] = failTaskOnFailedTests; } + if(failTaskOnFailureToPublishResults){ + properties['failTaskOnFailureToPublishResults'] = failTaskOnFailureToPublishResults; + } properties['testRunSystem'] = testRunSystem; tl.command('results.publish', properties, ''); @@ -73,6 +76,7 @@ async function run() { const publishRunAttachments = tl.getInput('publishRunAttachments'); const failTaskOnFailedTests = tl.getInput('failTaskOnFailedTests'); const failTaskOnMissingResultsFile: boolean = tl.getBoolInput('failTaskOnMissingResultsFile'); + const failTaskOnFailureToPublishResults = tl.getInput('failTaskOnFailureToPublishResults'); let searchFolder = tl.getInput('searchFolder'); tl.debug('testRunner: ' + testRunner); @@ -84,6 +88,7 @@ async function run() { tl.debug('publishRunAttachments: ' + publishRunAttachments); tl.debug('failTaskOnFailedTests: ' + failTaskOnFailedTests); tl.debug('failTaskOnMissingResultsFile: ' + failTaskOnMissingResultsFile); + tl.debug('failTaskOnFailureToPublishResults: ' + failTaskOnFailureToPublishResults); if (isNullOrWhitespace(searchFolder)) { searchFolder = tl.getVariable('System.DefaultWorkingDirectory'); @@ -114,6 +119,7 @@ async function run() { ci.addToConsolidatedCi('platform', platform); ci.addToConsolidatedCi('testResultsFilesCount', testResultsFilesCount); ci.addToConsolidatedCi('failTaskOnMissingResultsFile', failTaskOnMissingResultsFile); + ci.addToConsolidatedCi('failTaskOnFailureToPublishResults', failTaskOnFailureToPublishResults); const dotnetVersion = getDotNetVersion(); ci.addToConsolidatedCi('dotnetVersion', dotnetVersion); @@ -146,7 +152,8 @@ async function run() { testRunTitle, publishRunAttachments, testRunner, - TESTRUN_SYSTEM); + TESTRUN_SYSTEM, + failTaskOnFailureToPublishResults); const exitCode = await testResultsPublisher.publishResultsThroughExe(); tl.debug("Exit code of TestResultsPublisher: " + exitCode); @@ -159,7 +166,8 @@ async function run() { config, testRunTitle, publishRunAttachments, - TESTRUN_SYSTEM); + TESTRUN_SYSTEM, + failTaskOnFailureToPublishResults); } else if (exitCode === 40000) { // The exe returns with exit code: 40000 if there are test failures found and failTaskOnFailedTests is true ci.addToConsolidatedCi('failedTestsInRun', true); @@ -179,7 +187,8 @@ async function run() { config, testRunTitle, publishRunAttachments, - TESTRUN_SYSTEM); + TESTRUN_SYSTEM, + failTaskOnFailureToPublishResults); } } tl.setResult(tl.TaskResult.Succeeded, ''); diff --git a/Tasks/PublishTestResultsV2/publishtestresultstool.ts b/Tasks/PublishTestResultsV2/publishtestresultstool.ts index fd607f0e155f..6f99637eb814 100644 --- a/Tasks/PublishTestResultsV2/publishtestresultstool.ts +++ b/Tasks/PublishTestResultsV2/publishtestresultstool.ts @@ -9,7 +9,8 @@ let uuid = require('uuid'); export class TestResultsPublisher { constructor(matchingTestResultsFiles: string[], mergeResults: string, failTaskOnFailedTests: string, platform: string, config: string, - testRunTitle: string, publishRunAttachments: string, testRunner: string, testRunSystem: string) { + testRunTitle: string, publishRunAttachments: string, testRunner: string, testRunSystem: string + ,failTaskOnFailureToPublishResults: string) { this.matchingTestResultsFiles = matchingTestResultsFiles.slice(0); this.mergeResults = mergeResults; @@ -20,6 +21,7 @@ export class TestResultsPublisher { this.publishRunAttachments = publishRunAttachments; this.testRunner = testRunner; this.testRunSystem = testRunSystem; + this.failTaskOnFailureToPublishResults = failTaskOnFailureToPublishResults; } public async publishResultsThroughExe(): Promise { @@ -120,7 +122,7 @@ export class TestResultsPublisher { envVars = this.addToProcessEnvVars(envVars, 'jobattempt', tl.getVariable('System.JobAttempt')); envVars = this.addToProcessEnvVars(envVars, 'jobidentifier', tl.getVariable('System.JobIdentifier')); envVars = this.addToProcessEnvVars(envVars, 'agenttempdirectory', tl.getVariable('Agent.TempDirectory')); - + envVars = this.addToProcessEnvVars(envVars, 'failtaskonfailuretopublishresults', this.failTaskOnFailureToPublishResults); // Setting proxy details envVars = this.addToProcessEnvVars(envVars, "proxyurl", tl.getVariable('agent.proxyurl')); envVars = this.addToProcessEnvVars(envVars, "proxyusername", tl.getVariable('agent.proxyusername')); @@ -151,4 +153,5 @@ export class TestResultsPublisher { private publishRunAttachments: string; private testRunner: string; private testRunSystem: string; + private failTaskOnFailureToPublishResults: string; } diff --git a/Tasks/PublishTestResultsV2/task.json b/Tasks/PublishTestResultsV2/task.json index 83556a08ed76..4485a9ee1887 100644 --- a/Tasks/PublishTestResultsV2/task.json +++ b/Tasks/PublishTestResultsV2/task.json @@ -13,8 +13,8 @@ "author": "Microsoft Corporation", "version": { "Major": 2, - "Minor": 231, - "Patch": 1 + "Minor": 232, + "Patch": 0 }, "demands": [], "releaseNotes": "", @@ -81,6 +81,14 @@ "required": false, "helpMarkDown": "Fail the task if there are any test failures. Check this option to fail the task if test failures are detected in the result files." }, + { + "name": "failTaskOnFailureToPublishResults", + "type": "boolean", + "label": "Fail if there is failure in publishing test results", + "defaultValue": false, + "required": false, + "helpMarkDown": "Fail if there is failure in publishing test results. Check this option to fail the task if publishing test results is failed partially." + }, { "name": "failTaskOnMissingResultsFile", "type": "boolean", diff --git a/Tasks/PublishTestResultsV2/task.loc.json b/Tasks/PublishTestResultsV2/task.loc.json index 97a212184112..a4897c6f5c06 100644 --- a/Tasks/PublishTestResultsV2/task.loc.json +++ b/Tasks/PublishTestResultsV2/task.loc.json @@ -13,8 +13,8 @@ "author": "Microsoft Corporation", "version": { "Major": 2, - "Minor": 231, - "Patch": 1 + "Minor": 232, + "Patch": 0 }, "demands": [], "releaseNotes": "ms-resource:loc.releaseNotes", @@ -81,6 +81,14 @@ "required": false, "helpMarkDown": "ms-resource:loc.input.help.failTaskOnFailedTests" }, + { + "name": "failTaskOnFailureToPublishResults", + "type": "boolean", + "label": "ms-resource:loc.input.label.failTaskOnFailureToPublishResults", + "defaultValue": false, + "required": false, + "helpMarkDown": "ms-resource:loc.input.help.failTaskOnFailureToPublishResults" + }, { "name": "failTaskOnMissingResultsFile", "type": "boolean", diff --git a/_generated/PublishTestResultsV2.versionmap.txt b/_generated/PublishTestResultsV2.versionmap.txt index 4b460b79a79f..851876f5eac6 100644 --- a/_generated/PublishTestResultsV2.versionmap.txt +++ b/_generated/PublishTestResultsV2.versionmap.txt @@ -1,2 +1,2 @@ -Default|2.231.1 -Node20_229_13|2.231.2 +Default|2.232.0 +Node20_229_13|2.232.1 diff --git a/_generated/PublishTestResultsV2_Node20/Strings/resources.resjson/en-US/resources.resjson b/_generated/PublishTestResultsV2_Node20/Strings/resources.resjson/en-US/resources.resjson index 768a0886c1dd..60e89a5f59e5 100644 --- a/_generated/PublishTestResultsV2_Node20/Strings/resources.resjson/en-US/resources.resjson +++ b/_generated/PublishTestResultsV2_Node20/Strings/resources.resjson/en-US/resources.resjson @@ -15,6 +15,8 @@ "loc.input.help.mergeTestResults": "A test run is created for each results file. Check this option to merge results into a single test run. To optimize for better performance, results will be merged into a single run if there are more than 100 result files, irrespective of this option.", "loc.input.label.failTaskOnFailedTests": "Fail if there are test failures", "loc.input.help.failTaskOnFailedTests": "Fail the task if there are any test failures. Check this option to fail the task if test failures are detected in the result files.", + "loc.input.label.failTaskOnFailureToPublishResults": "Fail if there is failure in publishing test results", + "loc.input.help.failTaskOnFailureToPublishResults": "Fail if there is failure in publishing test results. Check this option to fail the task if publishing test results is failed partially.", "loc.input.label.failTaskOnMissingResultsFile": "Fail if no result files are found", "loc.input.help.failTaskOnMissingResultsFile": "Fail the task if no result files are found.", "loc.input.label.testRunTitle": "Test run title", diff --git a/_generated/PublishTestResultsV2_Node20/Tests/Constants.ts b/_generated/PublishTestResultsV2_Node20/Tests/Constants.ts index 70a1543255ea..a9c3abe0b563 100644 --- a/_generated/PublishTestResultsV2_Node20/Tests/Constants.ts +++ b/_generated/PublishTestResultsV2_Node20/Tests/Constants.ts @@ -13,4 +13,5 @@ export const failTaskOnFailedTests = 'failTaskOnFailedTests'; export const proxyUrl = 'agent.proxyurl'; export const proxyUserName = 'agent.proxyusername'; export const proxyPassword = 'agent.proxypassword'; -export const proxyByPassHosts = 'agent.proxybypasslist'; \ No newline at end of file +export const proxyByPassHosts = 'agent.proxybypasslist'; +export const failTaskOnFailureToPublishResults = 'failTaskOnFailureToPublishResults'; \ No newline at end of file diff --git a/_generated/PublishTestResultsV2_Node20/Tests/L0.ts b/_generated/PublishTestResultsV2_Node20/Tests/L0.ts index 4804af4007f8..acff3d352e20 100644 --- a/_generated/PublishTestResultsV2_Node20/Tests/L0.ts +++ b/_generated/PublishTestResultsV2_Node20/Tests/L0.ts @@ -29,6 +29,7 @@ describe('PublishTestResults Suite', function() { delete process.env[constants.listPackagesReturnCode]; delete process.env[constants.osType]; delete process.env[constants.failTaskOnFailedTests]; + delete process.env[constants.failTaskOnFailureToPublishResults]; done(); }); @@ -60,6 +61,7 @@ describe('PublishTestResults Suite', function() { process.env[constants.proxyUserName] = "1"; process.env[constants.proxyPassword] = "1"; process.env[constants.proxyByPassHosts] = undefined; + process.env[constants.failTaskOnFailureToPublishResults] = 'false'; // Start the run tr.run(); @@ -96,6 +98,7 @@ describe('PublishTestResults Suite', function() { process.env[constants.proxyUserName] = "1"; process.env[constants.proxyPassword] = "1"; process.env[constants.proxyByPassHosts] = undefined; + process.env[constants.failTaskOnFailureToPublishResults] = 'false'; // Start the run tr.run(); @@ -132,6 +135,7 @@ describe('PublishTestResults Suite', function() { process.env[constants.proxyUserName] = "1"; process.env[constants.proxyPassword] = "1"; process.env[constants.proxyByPassHosts] = undefined; + process.env[constants.failTaskOnFailureToPublishResults] = 'false'; // Start the run tr.run(); @@ -142,7 +146,7 @@ describe('PublishTestResults Suite', function() { assert.equal(tr.invokedToolCount, 1, `invoked tool count should be 1`); assert(tr.stdOutContained(`TestResultsPublisher.exe`), `Should have called TestResultsPublisher.exe first`); - assert(tr.stdOutContained(`vso[results.publish type=VSTest;mergeResults=false;publishRunAttachments=false;resultFiles=n-files0.xml;failTaskOnFailedTests=false;testRunSystem=VSTS - PTR;]`), + assert(tr.stdOutContained(`vso[results.publish type=VSTest;mergeResults=false;publishRunAttachments=false;resultFiles=n-files0.xml;failTaskOnFailedTests=false;failTaskOnFailureToPublishResults=false;testRunSystem=VSTS - PTR;]`), `Should have published results through Command when feature flag is off`); done(); @@ -172,6 +176,7 @@ describe('PublishTestResults Suite', function() { process.env[constants.proxyUserName] = "1"; process.env[constants.proxyPassword] = "1"; process.env[constants.proxyByPassHosts] = undefined; + process.env[constants.failTaskOnFailureToPublishResults] = 'false'; // Start the run tr.run(); @@ -182,7 +187,7 @@ describe('PublishTestResults Suite', function() { assert.equal(tr.invokedToolCount, 1, `invoked tool count should be 1`); assert(tr.stdOutContained(`TestResultsPublisher.exe`), `Should have called TestResultsPublisher.exe first`); - assert(tr.stdout.indexOf(`vso[results.publish type=VSTest;mergeResults=false;publishRunAttachments=false;resultFiles=n-files0.xml;failTaskOnFailedTests=false;testRunSystem=VSTS - PTR;]`) < 0, + assert(tr.stdout.indexOf(`vso[results.publish type=VSTest;mergeResults=false;publishRunAttachments=false;resultFiles=n-files0.xml;failTaskOnFailedTests=false;failTaskOnFailureToPublishResults=false;testRunSystem=VSTS - PTR;]`) < 0, `Command should not have been called when exe returns with exit code suggesting feature flag is on`); done(); diff --git a/_generated/PublishTestResultsV2_Node20/Tests/TestSetup.ts b/_generated/PublishTestResultsV2_Node20/Tests/TestSetup.ts index 534e4a25a440..c3509109b18c 100644 --- a/_generated/PublishTestResultsV2_Node20/Tests/TestSetup.ts +++ b/_generated/PublishTestResultsV2_Node20/Tests/TestSetup.ts @@ -18,6 +18,7 @@ tr.setInput('testRunTitle', process.env[constants.testRunTitle]); tr.setInput('publishRunAttachments', process.env[constants.publishRunAttachments]); tr.setInput('searchFolder', process.env[constants.searchFolder]); tr.setInput('failTaskOnFailedTests', process.env[constants.failTaskOnFailedTests]); +tr.setInput('failTaskOnFailureToPublishResults', process.env[constants.failTaskOnFailureToPublishResults]); const PublishExeToolPath = path.join(__dirname, '../modules', 'TestResultsPublisher.exe'); const newUuid = "1e1faf9e-d9e5-4054-b351-398ac75b62f5"; diff --git a/_generated/PublishTestResultsV2_Node20/publishtestresults.ts b/_generated/PublishTestResultsV2_Node20/publishtestresults.ts index 9fe7cfee3a15..5e8de343c63b 100644 --- a/_generated/PublishTestResultsV2_Node20/publishtestresults.ts +++ b/_generated/PublishTestResultsV2_Node20/publishtestresults.ts @@ -16,7 +16,7 @@ function isNullOrWhitespace(input: any) { return input.replace(/\s/g, '').length < 1; } -function publish(testRunner, resultFiles, mergeResults, failTaskOnFailedTests, platform, config, runTitle, publishRunAttachments, testRunSystem) { +function publish(testRunner, resultFiles, mergeResults, failTaskOnFailedTests, platform, config, runTitle, publishRunAttachments, testRunSystem , failTaskOnFailureToPublishResults) { var properties = <{ [key: string]: string }>{}; properties['type'] = testRunner; @@ -41,6 +41,9 @@ function publish(testRunner, resultFiles, mergeResults, failTaskOnFailedTests, p if(failTaskOnFailedTests){ properties['failTaskOnFailedTests'] = failTaskOnFailedTests; } + if(failTaskOnFailureToPublishResults){ + properties['failTaskOnFailureToPublishResults'] = failTaskOnFailureToPublishResults; + } properties['testRunSystem'] = testRunSystem; tl.command('results.publish', properties, ''); @@ -73,6 +76,7 @@ async function run() { const publishRunAttachments = tl.getInput('publishRunAttachments'); const failTaskOnFailedTests = tl.getInput('failTaskOnFailedTests'); const failTaskOnMissingResultsFile: boolean = tl.getBoolInput('failTaskOnMissingResultsFile'); + const failTaskOnFailureToPublishResults = tl.getInput('failTaskOnFailureToPublishResults'); let searchFolder = tl.getInput('searchFolder'); tl.debug('testRunner: ' + testRunner); @@ -84,6 +88,7 @@ async function run() { tl.debug('publishRunAttachments: ' + publishRunAttachments); tl.debug('failTaskOnFailedTests: ' + failTaskOnFailedTests); tl.debug('failTaskOnMissingResultsFile: ' + failTaskOnMissingResultsFile); + tl.debug('failTaskOnFailureToPublishResults: ' + failTaskOnFailureToPublishResults); if (isNullOrWhitespace(searchFolder)) { searchFolder = tl.getVariable('System.DefaultWorkingDirectory'); @@ -114,6 +119,7 @@ async function run() { ci.addToConsolidatedCi('platform', platform); ci.addToConsolidatedCi('testResultsFilesCount', testResultsFilesCount); ci.addToConsolidatedCi('failTaskOnMissingResultsFile', failTaskOnMissingResultsFile); + ci.addToConsolidatedCi('failTaskOnFailureToPublishResults', failTaskOnFailureToPublishResults); const dotnetVersion = getDotNetVersion(); ci.addToConsolidatedCi('dotnetVersion', dotnetVersion); @@ -146,7 +152,8 @@ async function run() { testRunTitle, publishRunAttachments, testRunner, - TESTRUN_SYSTEM); + TESTRUN_SYSTEM, + failTaskOnFailureToPublishResults); const exitCode = await testResultsPublisher.publishResultsThroughExe(); tl.debug("Exit code of TestResultsPublisher: " + exitCode); @@ -159,7 +166,8 @@ async function run() { config, testRunTitle, publishRunAttachments, - TESTRUN_SYSTEM); + TESTRUN_SYSTEM, + failTaskOnFailureToPublishResults); } else if (exitCode === 40000) { // The exe returns with exit code: 40000 if there are test failures found and failTaskOnFailedTests is true ci.addToConsolidatedCi('failedTestsInRun', true); @@ -179,7 +187,8 @@ async function run() { config, testRunTitle, publishRunAttachments, - TESTRUN_SYSTEM); + TESTRUN_SYSTEM, + failTaskOnFailureToPublishResults); } } tl.setResult(tl.TaskResult.Succeeded, ''); diff --git a/_generated/PublishTestResultsV2_Node20/publishtestresultstool.ts b/_generated/PublishTestResultsV2_Node20/publishtestresultstool.ts index fd607f0e155f..6f99637eb814 100644 --- a/_generated/PublishTestResultsV2_Node20/publishtestresultstool.ts +++ b/_generated/PublishTestResultsV2_Node20/publishtestresultstool.ts @@ -9,7 +9,8 @@ let uuid = require('uuid'); export class TestResultsPublisher { constructor(matchingTestResultsFiles: string[], mergeResults: string, failTaskOnFailedTests: string, platform: string, config: string, - testRunTitle: string, publishRunAttachments: string, testRunner: string, testRunSystem: string) { + testRunTitle: string, publishRunAttachments: string, testRunner: string, testRunSystem: string + ,failTaskOnFailureToPublishResults: string) { this.matchingTestResultsFiles = matchingTestResultsFiles.slice(0); this.mergeResults = mergeResults; @@ -20,6 +21,7 @@ export class TestResultsPublisher { this.publishRunAttachments = publishRunAttachments; this.testRunner = testRunner; this.testRunSystem = testRunSystem; + this.failTaskOnFailureToPublishResults = failTaskOnFailureToPublishResults; } public async publishResultsThroughExe(): Promise { @@ -120,7 +122,7 @@ export class TestResultsPublisher { envVars = this.addToProcessEnvVars(envVars, 'jobattempt', tl.getVariable('System.JobAttempt')); envVars = this.addToProcessEnvVars(envVars, 'jobidentifier', tl.getVariable('System.JobIdentifier')); envVars = this.addToProcessEnvVars(envVars, 'agenttempdirectory', tl.getVariable('Agent.TempDirectory')); - + envVars = this.addToProcessEnvVars(envVars, 'failtaskonfailuretopublishresults', this.failTaskOnFailureToPublishResults); // Setting proxy details envVars = this.addToProcessEnvVars(envVars, "proxyurl", tl.getVariable('agent.proxyurl')); envVars = this.addToProcessEnvVars(envVars, "proxyusername", tl.getVariable('agent.proxyusername')); @@ -151,4 +153,5 @@ export class TestResultsPublisher { private publishRunAttachments: string; private testRunner: string; private testRunSystem: string; + private failTaskOnFailureToPublishResults: string; } diff --git a/_generated/PublishTestResultsV2_Node20/task.json b/_generated/PublishTestResultsV2_Node20/task.json index 8d36f3f30626..767595b9f78f 100644 --- a/_generated/PublishTestResultsV2_Node20/task.json +++ b/_generated/PublishTestResultsV2_Node20/task.json @@ -13,8 +13,8 @@ "author": "Microsoft Corporation", "version": { "Major": 2, - "Minor": 231, - "Patch": 2 + "Minor": 232, + "Patch": 1 }, "demands": [], "releaseNotes": "", @@ -81,6 +81,14 @@ "required": false, "helpMarkDown": "Fail the task if there are any test failures. Check this option to fail the task if test failures are detected in the result files." }, + { + "name": "failTaskOnFailureToPublishResults", + "type": "boolean", + "label": "Fail if there is failure in publishing test results", + "defaultValue": false, + "required": false, + "helpMarkDown": "Fail if there is failure in publishing test results. Check this option to fail the task if publishing test results is failed partially." + }, { "name": "failTaskOnMissingResultsFile", "type": "boolean", @@ -152,7 +160,7 @@ "ErrorFailTaskOnFailedTests": "There are one or more test failures detected in result files. Detailed summary of published test results can be viewed in the Tests tab." }, "_buildConfigMapping": { - "Default": "2.231.1", - "Node20_229_13": "2.231.2" + "Default": "2.232.0", + "Node20_229_13": "2.232.1" } } \ No newline at end of file diff --git a/_generated/PublishTestResultsV2_Node20/task.loc.json b/_generated/PublishTestResultsV2_Node20/task.loc.json index 42e0316907e7..1baf1d24b242 100644 --- a/_generated/PublishTestResultsV2_Node20/task.loc.json +++ b/_generated/PublishTestResultsV2_Node20/task.loc.json @@ -13,8 +13,8 @@ "author": "Microsoft Corporation", "version": { "Major": 2, - "Minor": 231, - "Patch": 2 + "Minor": 232, + "Patch": 1 }, "demands": [], "releaseNotes": "ms-resource:loc.releaseNotes", @@ -81,6 +81,14 @@ "required": false, "helpMarkDown": "ms-resource:loc.input.help.failTaskOnFailedTests" }, + { + "name": "failTaskOnFailureToPublishResults", + "type": "boolean", + "label": "ms-resource:loc.input.label.failTaskOnFailureToPublishResults", + "defaultValue": false, + "required": false, + "helpMarkDown": "ms-resource:loc.input.help.failTaskOnFailureToPublishResults" + }, { "name": "failTaskOnMissingResultsFile", "type": "boolean", @@ -152,7 +160,7 @@ "ErrorFailTaskOnFailedTests": "ms-resource:loc.messages.ErrorFailTaskOnFailedTests" }, "_buildConfigMapping": { - "Default": "2.231.1", - "Node20_229_13": "2.231.2" + "Default": "2.232.0", + "Node20_229_13": "2.232.1" } } \ No newline at end of file