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

Support rerun builds in UI #771

Merged
merged 1 commit into from
Feb 9, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
}

.cell {
position: relative;
color: #fff;
border-radius: 4px;
padding: 4px;
Expand Down
32 changes: 31 additions & 1 deletion test-result-summary-client/src/Build/Summary/ResultGrid.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
MinusCircleOutlined,
StopOutlined,
WarningOutlined,
InfoCircleOutlined,
} from '@ant-design/icons';

import { Tooltip } from 'antd';
Expand Down Expand Up @@ -51,6 +52,8 @@ class Cell extends Component {
);
}
const result = groups[group].buildResult;
const rerunBuildUrl =
groups[group].rerunBuildUrl;
let element = '';
if (!groups[group].testSummary) {
element = (
Expand Down Expand Up @@ -92,12 +95,26 @@ class Cell extends Component {
? 'Build Result is from TestBenchmarkParser (not CI build)'
: ''}{' '}
<br />
Jenkins link:
<br />
{rerunBuildUrl ? (
<a
href={rerunBuildUrl}
target="_blank"
rel="noopener noreferrer"
>
Rerun build
</a>
) : (
''
)}
<br />
<a
href={groups[group].buildUrl}
target="_blank"
rel="noopener noreferrer"
>
Jenkins Link
Test build
</a>
</div>
);
Expand Down Expand Up @@ -172,6 +189,19 @@ class Cell extends Component {
<Tooltip title={<div>{element}</div>}>
{linkInfo}
</Tooltip>
{rerunBuildUrl && (
<InfoCircleOutlined
style={{
position: 'absolute',
color: 'orange',
fontSize: '12px',
top: -5,
right: -5,
background: 'white',
borderRadius: '100%',
}}
/>
)}
</div>
);
})}
Expand Down
47 changes: 29 additions & 18 deletions test-result-summary-client/src/Build/Summary/ResultSummary.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ export default class ResultSummary extends Component {
jdkImpl = 'j9';
}
// use non-capture group to ignore words evaluation and release if present
const regex = /^jdk(\d+).?(?:-evaluation|-release)?-(\w+)-(\w+)-(\w+)/i;
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 @@ -168,16 +169,14 @@ export default class ResultSummary extends Component {
childBuildsResult = setBuildsStatus(build, childBuildsResult);
});
builds.sort((a, b) => a.buildName.localeCompare(b.buildName));

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, rerun } =
getInfoFromBuildName(buildName);

const hasRerun = rerun ? rerun : false;
if (jdkVersion && jdkImpl && level && group && platform) {
buildMap[platform] = buildMap[platform] || {};
buildMap[platform][jdkVersion] =
Expand Down Expand Up @@ -214,7 +213,7 @@ export default class ResultSummary extends Component {
buildMap[platform][jdkVersion][jdkImpl][level][
group
].hasChildren = build.hasChildren;
} else if (build.testSummary) {
} else if (build.testSummary && !hasRerun) {
buildMap[platform][jdkVersion][jdkImpl][level][
group
].testSummary = buildMap[platform][jdkVersion][
Expand Down Expand Up @@ -254,16 +253,28 @@ export default class ResultSummary extends Component {
group
].testSummary.total += total;
}
if (
hasRerun &&
!buildMap[platform][jdkVersion][jdkImpl][level][
group
].rerunBuildUrl
) {
buildMap[platform][jdkVersion][jdkImpl][level][
group
].rerunBuildUrl = build.buildUrl;
console.log('build.buildUrl1', build.buildUrl);
}
} 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,

rerunBuildUrl: hasRerun ? build.buildUrl : '',
};
}
}
}
Expand Down
32 changes: 32 additions & 0 deletions test-result-summary-client/src/Build/TestTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { Component } from 'react';
import TextFilter from '../utils/TextFilter';
import {
ClusterOutlined,
InfoCircleOutlined,
GithubOutlined,
HistoryOutlined,
QuestionCircleOutlined,
Expand Down Expand Up @@ -82,6 +83,36 @@ export default class TestTable extends Component {
);
});
}
const renderTestName = (value, row) => {
const testName = value;
const { buildName } = row;
let rerun = false;
if (buildName && buildName.includes('_rerun')) {
rerun = true;
}
return (
<span>
<div>
{rerun ? (
<>
{testName}
<Tooltip title="Rerun">
<InfoCircleOutlined
style={{
color: 'orange',
fontSize: '12px',
verticalAlign: 'top',
}}
/>
</Tooltip>
</>
) : (
testName
)}
</div>
</span>
);
};

const renderAction = (value, row) => {
const { testId, testName } = value;
Expand Down Expand Up @@ -202,6 +233,7 @@ export default class TestTable extends Component {
handleFilterChange={this.handleFilterChange}
/>
),
render: renderTestName,
},
{
title: 'Action',
Expand Down
6 changes: 5 additions & 1 deletion test-result-summary-client/src/utils/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ export const getInfoFromBuildName = (buildName) => {
const tokens = buildName.match(regex);
if (Array.isArray(tokens) && tokens.length > 5) {
const [_, jdkVersion, jdkImpl, level, group, platform] = tokens;
return { jdkVersion, jdkImpl, level, group, platform };
let rerun = false;
if (buildName.includes('_rerun')) {
rerun = true;
}
return { jdkVersion, jdkImpl, level, group, platform, rerun };
}
return null;
};
Expand Down