Skip to content

Commit

Permalink
Add parameters to control timeout logic (#894)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfennell committed Dec 1, 2020
1 parent ac26bde commit 741113c
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ async function run(): Promise<number> {
var overrideBuildReleaseId = tl.getInput("overrideBuildReleaseId");
var getIndirectPullRequests = tl.getBoolInput("getIndirectPullRequests");

var maxRetries = parseInt(tl.getInput("maxRetries"));
var pauseTime = parseInt(tl.getInput("pauseTime"));

var returnCode = await util.generateReleaseNotes(
overridePat,
tpcUri,
Expand Down Expand Up @@ -76,7 +79,9 @@ async function run(): Promise<number> {
getAllParents,
tags,
overrideBuildReleaseId,
getIndirectPullRequests
getIndirectPullRequests,
maxRetries,
pauseTime
);

} catch (err) {
Expand Down
105 changes: 63 additions & 42 deletions Extensions/XplatGenerateReleaseNotes/V3/ReleaseNotesFunctions.ts

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions Extensions/XplatGenerateReleaseNotes/V3/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,24 @@
"required": true,
"helpMarkDown": "If enabled an attempt will be made to populate a list of indirectly associated PRs i.e PR that are associated with a PR's associated commits",
"groupName":"advanced"
},
{
"name": "maxRetries",
"type": "string",
"label": "Max. Retries",
"defaultValue": "3",
"required": false,
"helpMarkDown": "The number of time to retry any REST API calls that timeout, defaults to 3",
"groupName":"advanced"
},
{
"name": "pauseTime",
"type": "string",
"label": "Pause Time",
"defaultValue": "5000",
"required": false,
"helpMarkDown": "Interval to wait before attempting a retry of failed API calls, in milliseconds, defaults to 5000",
"groupName":"advanced"
}

],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ async function run(): Promise<number> {
var overrideBuildReleaseId = settings.overrideBuildReleaseId;
var getIndirectPullRequests = getBoolean(settings.getIndirectPullRequests);

var maxRetries = parseInt(settings.maxRetries);
var pauseTime = parseInt(settings.pauseTime);

var returnCode = await util.generateReleaseNotes(
pat,
tpcUri,
Expand Down Expand Up @@ -112,7 +115,9 @@ async function run(): Promise<number> {
getAllParents,
tags,
overrideBuildReleaseId,
getIndirectPullRequests);
getIndirectPullRequests,
maxRetries,
pauseTime);
} else {
console.log(`Cannot fine settings file ${filename}`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,8 @@
"Fix349": "true",
"tags": "",
"overrideBuildReleaseId": "",
"getIndirectPullRequests": "false"
"getIndirectPullRequests": "false",

"maxRetries": "3",
"pauseTime": "5000"
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@
"Fix349": "true",
"tags": "",
"overrideBuildReleaseId": "",
"getIndirectPullRequests": "false"
"getIndirectPullRequests": "false",

"maxRetries": "3",
"pauseTime": "5000"
}
3 changes: 3 additions & 0 deletions Extensions/XplatGenerateReleaseNotes/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Generates release notes for a Classic Build or Release, or a YML based build. The generated file can be any text based format of your choice
* Can be used on any type of Azure DevOps Agents (Windows, Mac or Linux)
* Uses same logic as Azure DevOps Release UI to work out the work items and commits/changesets associated with the release
* 3.32.x Adds parameters to control the retry logic for timed outed out API calls
* 3.28.x provide a new array of `inDirectlyAssociatedPullRequests`, this contains PR associated with a PR's associated commits. Useful if using a Gitflow work work-flow [x866](https://github.com/rfennell/AzurePipelines/issues/866) (see sample template below)
* 3.27.x enriches the PR with associated commits (see sample template below)
* 3.25.x enriches the PR with associated work items references (you need to do a lookup into the list of work items to get details, see sample template below)
Expand Down Expand Up @@ -334,6 +335,8 @@ The task takes the following parameters
* A valid build ID (int) - Use the build ID as the comparison
* An invalid build ID (int) - If a valid build cannot be found then the task exits with a message
* Any other non empty input value - The task exits with an error message
* (Advanced) MaxRetries - The number of time to retry any REST API calls that timeout, defaults to 3
* (Advanced) PauseTime - Interval to wait before attempting a retry of failed API calls, in milliseconds, defaults to 5000
* (Handlebars) customHandlebars ExtensionCode. A custom Handlebars extension written as a JavaScript module e.g. module.exports = {foo: function () {return 'Returns foo';}};
* (Outputs) Optional: Name of the variable that release notes contents will be copied into for use in other tasks. As an output variable equates to an environment variable, so there is a limit on the maximum size. For larger release notes it is best to save the file locally as opposed to using an output variable.

Expand Down

0 comments on commit 741113c

Please sign in to comment.