Skip to content

Commit

Permalink
Update regex to ignore extra words in buildName (adoptium#766)
Browse files Browse the repository at this point in the history
* Update regex to ignore extra words in buildName

Signed-off-by: Shelley Lambert <slambert@gmail.com>
  • Loading branch information
smlambert authored Jan 13, 2023
1 parent 1dfde0c commit 49d4bf6
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions test-result-summary-client/src/Build/Summary/ResultSummary.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ export default class ResultSummary extends Component {
if (buildName.includes('openj9')) {
jdkImpl = 'j9';
}
const regex = /^jdk(\d+).?-(\w+)-(\w+)-(\w+)/i;
// use non-capture group to ignore words evaluation and release if present
const regex = /^jdk(\d+).?(?:-evaluation|-release)?-(\w+)-(\w+)-(\w+)/i;
const tokens = buildName.match(regex);
if (Array.isArray(tokens) && tokens.length > 4) {
jdkVersion = tokens[1];
Expand Down Expand Up @@ -170,8 +171,13 @@ export default class ResultSummary extends Component {
builds.forEach((build) => {
const buildName = build.buildName.toLowerCase();
if (getInfoFromBuildName(buildName)) {
const { jdkVersion, jdkImpl, level, group, platform } =
getInfoFromBuildName(buildName);
const {
jdkVersion,
jdkImpl,
level,
group,
platform,
} = getInfoFromBuildName(buildName);
if (jdkVersion && jdkImpl && level && group && platform) {
buildMap[platform] = buildMap[platform] || {};
buildMap[platform][jdkVersion] =
Expand Down Expand Up @@ -249,14 +255,15 @@ export default class ResultSummary extends Component {
].testSummary.total += total;
}
} else {
buildMap[platform][jdkVersion][jdkImpl][level][group] =
{
buildResult: build.buildResult,
testSummary: build.testSummary,
buildUrl: build.buildUrl,
buildId: build._id,
hasChildren: build.hasChildren,
};
buildMap[platform][jdkVersion][jdkImpl][level][
group
] = {
buildResult: build.buildResult,
testSummary: build.testSummary,
buildUrl: build.buildUrl,
buildId: build._id,
hasChildren: build.hasChildren,
};
}
}
}
Expand Down

0 comments on commit 49d4bf6

Please sign in to comment.