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

[MavenV2, MavenV3]: Fixed bug when task succeeds on tests failure #14658

Merged
merged 13 commits into from
Apr 1, 2021
13 changes: 10 additions & 3 deletions Tasks/MavenV2/maventask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@ async function execBuild() {
});

// Do not force an exit as publishing results is async and it won't have finished
})
.fail(function (err) {
// Set task failure if get exception at step 5
console.error(err.message);
anatolybolshakov marked this conversation as resolved.
Show resolved Hide resolved
tl.setResult(tl.TaskResult.Failed, "Build failed.");
});
}

Expand Down Expand Up @@ -336,9 +341,11 @@ function publishJUnitTestResults(testResultsFiles: string) {
tl.debug('Pattern found in testResultsFiles parameter');
var buildFolder = tl.getVariable('System.DefaultWorkingDirectory');
tl.debug(`buildFolder=${buildFolder}`);
matchingJUnitResultFiles = tl.findMatch(buildFolder, testResultsFiles, null, {
matchBase: true
});
matchingJUnitResultFiles = tl.findMatch(buildFolder, testResultsFiles, {
allowBrokenSymbolicLinks: true,
anatolybolshakov marked this conversation as resolved.
Show resolved Hide resolved
followSpecifiedSymbolicLink: true,
followSymbolicLinks: true,
}, { matchBase: true });
}
else {
tl.debug('No pattern found in testResultsFiles parameter');
Expand Down
2 changes: 1 addition & 1 deletion Tasks/MavenV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 183,
"Minor": 185,
"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`",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/MavenV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 183,
"Minor": 185,
"Patch": 0
},
"releaseNotes": "ms-resource:loc.releaseNotes",
Expand Down
13 changes: 10 additions & 3 deletions Tasks/MavenV3/maventask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,11 @@ async function execBuild() {
});

// Do not force an exit as publishing results is async and it won't have finished
})
.fail(function (err) {
// Set task failure if get exception at step 5
console.error(err.message);
tl.setResult(tl.TaskResult.Failed, "Build failed.");
});
}

Expand Down Expand Up @@ -347,9 +352,11 @@ function publishJUnitTestResults(testResultsFiles: string) {
tl.debug('Pattern found in testResultsFiles parameter');
var buildFolder = tl.getVariable('System.DefaultWorkingDirectory');
tl.debug(`buildFolder=${buildFolder}`);
matchingJUnitResultFiles = tl.findMatch(buildFolder, testResultsFiles, null, {
matchBase: true
});
matchingJUnitResultFiles = tl.findMatch(buildFolder, testResultsFiles, {
followSymbolicLinks: true,
allowBrokenSymbolicLinks: true,
followSpecifiedSymbolicLink: true,
}, { matchBase: true });
}
else {
tl.debug('No pattern found in testResultsFiles parameter');
Expand Down
2 changes: 1 addition & 1 deletion Tasks/MavenV3/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 3,
"Minor": 183,
"Minor": 185,
"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`",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/MavenV3/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 3,
"Minor": 183,
"Minor": 185,
"Patch": 0
},
"releaseNotes": "ms-resource:loc.releaseNotes",
Expand Down