From 49d4bf6dcedb769cd0a9785904fe4384d6917a68 Mon Sep 17 00:00:00 2001 From: Shelley Lambert Date: Fri, 13 Jan 2023 11:38:41 -0500 Subject: [PATCH] Update regex to ignore extra words in buildName (#766) * Update regex to ignore extra words in buildName Signed-off-by: Shelley Lambert --- .../src/Build/Summary/ResultSummary.jsx | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/test-result-summary-client/src/Build/Summary/ResultSummary.jsx b/test-result-summary-client/src/Build/Summary/ResultSummary.jsx index aee7f9d5..54a037ee 100644 --- a/test-result-summary-client/src/Build/Summary/ResultSummary.jsx +++ b/test-result-summary-client/src/Build/Summary/ResultSummary.jsx @@ -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]; @@ -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] = @@ -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, + }; } } }