diff options
author | Daniel Smith <daniel.smith@qt.io> | 2024-03-11 11:33:56 +0100 |
---|---|---|
committer | Daniel Smith <daniel.smith@qt.io> | 2024-03-20 13:37:20 +0100 |
commit | f3ae55255751a841c15ad77615e66c53cfd28f0e (patch) | |
tree | 3bf89d3d7c8335772477a5535395a1ef384c4fa7 | |
parent | fa74cb3f0d42039c86373ea6f0124c0a9cb22f41 (diff) |
Fix detection of tqtc/lts- and lts- prefixed branches in jira closer
Due to how the jira closer matches fix version based on raw
version strings, it was incorrectly checking gerrit for the
existence of tqtc/lts- and lts- prefixed branches as the raw
branch without the prefix. This caused the bot to believe that
the target branch was not yet created, and assign the wrong fix
version to the jira issue.
Fixes: QTQAINFRA-6064
Change-Id: If3879ba0a696eca613432ee01d633bb347accc99
Reviewed-by: Daniel Smith <daniel.smith@qt.io>
-rw-r--r-- | scripts/gerrit/cherry-pick_automation/plugin_bots/jira_closer/jira_closer.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/gerrit/cherry-pick_automation/plugin_bots/jira_closer/jira_closer.js b/scripts/gerrit/cherry-pick_automation/plugin_bots/jira_closer/jira_closer.js index 888a8ced..96f55865 100644 --- a/scripts/gerrit/cherry-pick_automation/plugin_bots/jira_closer/jira_closer.js +++ b/scripts/gerrit/cherry-pick_automation/plugin_bots/jira_closer/jira_closer.js @@ -78,7 +78,9 @@ function findClosestVersionMatch(uuid, branch, issueId) { // non-existing branch as for cherry-picking repos. async function findNextRelease(uuid, project, branch, mergeDate, usesCherryPicking, issueId) { logger.log(`FIXES: Searching for the next release release related to ${branch}`, "verbose", uuid); - + let prefixRe = /^(tqtc\/lts-|lts-)/; + let match = prefixRe.exec(branch); + let prefix = match ? match[0] : ""; // Recurse through branches in the generator and locate the desired branch. // Passing negativeSearch=true searches for the next non-existent branch. // Otherwise, the highest existing branch is passed to callback(). @@ -95,16 +97,17 @@ async function findNextRelease(uuid, project, branch, mergeDate, usesCherryPicki // Allow for plain branches or Version objects equally, // but any value passed to thisBranch must be an object resulting from generator.next(); let tempBranch = thisBranch.value.parsedVersion || thisBranch.value; - promisedVerifyBranch(uuid, project, tempBranch, branchesCache) + let querybranch = prefixRe.test(tempBranch) ? tempBranch : `${prefix}${tempBranch}`; + promisedVerifyBranch(uuid, project, querybranch, branchesCache) .then((validBranch) => { // Treat branches created after the merge date as non-existent. This makes the branch // a valid fix target since it would not have existed at the time of merging. if (validBranch && (moment.isMoment(validBranch) ? validBranch.isBefore(mergeDate) : true)) { - logger.log(`FIXES: Found existing branch ${tempBranch}`, "debug", uuid); + logger.log(`FIXES: Found existing branch ${querybranch}`, "debug", uuid); lastFound = thisBranch.value; checkNextBranch(generator.next(), generator, negativeSearch, lastFound, callback); } else { - logger.log(`FIXES: Couldn't find ${tempBranch}, or it was created after the merge date.`, + logger.log(`FIXES: Couldn't find ${querybranch}, or it was created after the merge date.`, "debug", uuid); if (negativeSearch) { // If we couldn't find the x.x.0 release, check to make sure a feature |