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

Split the error handling so release note generation always attempted even with API errors #912

Merged
merged 1 commit into from
Dec 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions Extensions/XplatGenerateReleaseNotes/V3/ReleaseNotesFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -905,10 +905,12 @@ export async function generateReleaseNotes(
var globalBuilds: UnifiedArtifactDetails[] = [];
var globalTests: TestCaseResult[] = [];
var releaseTests: TestCaseResult[] = [];
var relatedWorkItems: WorkItem[] = [];
var fullWorkItems: WorkItem[] = [];

var mostRecentSuccessfulDeploymentName: string = "";
let mostRecentSuccessfulDeploymentRelease: Release;
let mostRecentSuccessfulBuild: Build;
var mostRecentSuccessfulDeploymentRelease: Release;
var mostRecentSuccessfulBuild: Build;

var currentRelease: Release;
var currentBuild: Build;
Expand Down Expand Up @@ -1188,9 +1190,7 @@ export async function generateReleaseNotes(
}

// get an array of workitem ids
let fullWorkItems = await getFullWorkItemDetails(workItemTrackingApi, globalWorkItems);

let relatedWorkItems = [];
fullWorkItems = await getFullWorkItemDetails(workItemTrackingApi, globalWorkItems);

if (getParentsAndChildren) {
agentApi.logInfo("Getting direct parents and children of WorkItems");
Expand Down Expand Up @@ -1304,6 +1304,14 @@ export async function generateReleaseNotes(
// enrich the founds PRs
await enrichPullRequest(gitApi, inDirectlyAssociatedPullRequests);
}

} catch (ex) {
agentApi.logInfo(`The most common reason for the task to fail is due API ECONNRESET issues. To avoid this failing the pipeline these will be treated as warnings and an attempt to generate any release notes possible`);
agentApi.logWarn(ex);
reject (ex);
}

try {
agentApi.logInfo(`Total Builds: [${globalBuilds.length}]`);
agentApi.logInfo(`Total Commits: [${globalCommits.length}]`);
agentApi.logInfo(`Total Workitems: [${globalWorkItems.length}]`);
Expand Down
2 changes: 1 addition & 1 deletion Extensions/XplatGenerateReleaseNotes/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ Error: connect ETIMEDOUT 13.107.42.18:443

This is an issue with the underlying Azure DevOps Node SDK or REST API endpoints, not this task. Hence, an issue has been raised in the the appropriate [Repo #425](https://github.com/microsoft/azure-devops-node-api/issues/425)

The best workaround at present is to always place this task, and any associated tasks e.g. one that upload the generated release notes to a WIKI, in a dedicated YML pipeline job. This allows the task to be easily retried without rerunning the whole pipeline.
Historically the only workaround has been to always place this task, and any associated tasks e.g. one that upload the generated release notes to a WIKI, in a dedicated YML pipeline job. This allows the task to be easily retried without rerunning the whole pipeline. However, with 3.37.x the error traps have been changed in the task to treat any error that occurs whilst accessing the API as a warning, but allow the task to run on to try to generate any release notes it can with the data it has managed to get. This is far from perfect but a bit more robust.

## OAUTH Scope limiting what Associated Items can be seen
This task uses the build agent's access OAUTH token to access the Azure DevOps API. The permissions this identity has is dependant upon the [the Job authorization scope](https://docs.microsoft.com/en-us/azure/devops/pipelines/process/access-tokens?view=azure-devops&tabs=yaml#job-authorization-scope).
Expand Down