Read analysis failures from index file
This commit is contained in:
@@ -12,9 +12,10 @@ import { RemoteQueryResultIndex, RemoteQueryResultIndexItem } from './remote-que
|
||||
interface ApiResultIndexItem {
|
||||
nwo: string;
|
||||
id: string;
|
||||
results_count: number;
|
||||
bqrs_file_size: number;
|
||||
results_count?: number;
|
||||
bqrs_file_size?: number;
|
||||
sarif_file_size?: number;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export async function getRemoteQueryIndex(
|
||||
@@ -34,7 +35,8 @@ export async function getRemoteQueryIndex(
|
||||
const resultIndexItems = await getResultIndexItems(credentials, owner, repoName, resultIndexArtifactId);
|
||||
|
||||
const items = resultIndexItems.map(item => {
|
||||
const artifactId = getArtifactIDfromName(item.id, workflowUri, artifactList);
|
||||
// We only need the artifact for non-error items.
|
||||
const artifactId = item.error ? undefined : getArtifactIDfromName(item.id, workflowUri, artifactList);
|
||||
|
||||
return {
|
||||
id: item.id.toString(),
|
||||
@@ -43,6 +45,7 @@ export async function getRemoteQueryIndex(
|
||||
resultCount: item.results_count,
|
||||
bqrsFileSize: item.bqrs_file_size,
|
||||
sarifFileSize: item.sarif_file_size,
|
||||
error: item.error
|
||||
} as RemoteQueryResultIndexItem;
|
||||
});
|
||||
|
||||
|
||||
@@ -82,7 +82,8 @@ export class RemoteQueriesInterfaceManager {
|
||||
totalResultCount: totalResultCount,
|
||||
executionTimestamp: this.formatDate(query.executionStartTime),
|
||||
executionDuration: executionDuration,
|
||||
analysisSummaries: analysisSummaries
|
||||
analysisSummaries: analysisSummaries,
|
||||
analysisFailures: queryResult.analysisFailures,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import { RemoteQueriesInterfaceManager } from './remote-queries-interface';
|
||||
import { RemoteQuery } from './remote-query';
|
||||
import { RemoteQueriesMonitor } from './remote-queries-monitor';
|
||||
import { getRemoteQueryIndex } from './gh-actions-api-client';
|
||||
import { RemoteQueryResultIndex } from './remote-query-result-index';
|
||||
import { RemoteQueryFailureIndexItem, RemoteQueryResultIndex, RemoteQuerySuccessIndexItem } from './remote-query-result-index';
|
||||
import { RemoteQueryResult } from './remote-query-result';
|
||||
import { DownloadLink } from './download-link';
|
||||
import { AnalysesResultsManager } from './analyses-results-manager';
|
||||
@@ -128,7 +128,10 @@ export class RemoteQueriesManager {
|
||||
}
|
||||
|
||||
private mapQueryResult(executionEndTime: Date, resultIndex: RemoteQueryResultIndex, queryId: string): RemoteQueryResult {
|
||||
const analysisSummaries = resultIndex.items.map(item => ({
|
||||
|
||||
const successes = resultIndex.items.filter(item => !item.error) as RemoteQuerySuccessIndexItem[];
|
||||
const failures = resultIndex.items.filter(item => item.error) as RemoteQueryFailureIndexItem[];
|
||||
const analysisSummaries = successes.map(item => ({
|
||||
nwo: item.nwo,
|
||||
resultCount: item.resultCount,
|
||||
fileSizeInBytes: item.sarifFileSize ? item.sarifFileSize : item.bqrsFileSize,
|
||||
@@ -139,10 +142,15 @@ export class RemoteQueriesManager {
|
||||
queryId,
|
||||
} as DownloadLink
|
||||
}));
|
||||
const analysisFailures = failures.map(item => ({
|
||||
nwo: item.nwo,
|
||||
error: item.error
|
||||
}));
|
||||
|
||||
return {
|
||||
executionEndTime,
|
||||
analysisSummaries,
|
||||
analysisFailures
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ export interface RemoteQueryResultIndex {
|
||||
items: RemoteQueryResultIndexItem[];
|
||||
}
|
||||
|
||||
export interface RemoteQueryResultIndexItem {
|
||||
export interface RemoteQuerySuccessIndexItem {
|
||||
id: string;
|
||||
artifactId: number;
|
||||
nwo: string;
|
||||
@@ -11,3 +11,12 @@ export interface RemoteQueryResultIndexItem {
|
||||
bqrsFileSize: number;
|
||||
sarifFileSize?: number;
|
||||
}
|
||||
|
||||
export interface RemoteQueryFailureIndexItem {
|
||||
id: string;
|
||||
artifactId: number;
|
||||
nwo: string;
|
||||
error: string;
|
||||
}
|
||||
|
||||
export type RemoteQueryResultIndexItem = RemoteQuerySuccessIndexItem & RemoteQueryFailureIndexItem;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { DownloadLink } from './download-link';
|
||||
import { AnalysisFailure } from './shared/analysis-failure';
|
||||
|
||||
export interface RemoteQueryResult {
|
||||
executionEndTime: Date;
|
||||
analysisSummaries: AnalysisSummary[];
|
||||
analysisFailures: AnalysisFailure[];
|
||||
}
|
||||
|
||||
export interface AnalysisSummary {
|
||||
|
||||
@@ -83,6 +83,12 @@ export const sampleRemoteQueryResult: RemoteQueryResult = {
|
||||
queryId: 'query.ql-123-xyz'
|
||||
}
|
||||
}
|
||||
],
|
||||
analysisFailures: [
|
||||
{
|
||||
nwo: 'big-corp/repo5',
|
||||
error: 'Error message'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
export interface AnalysisFailure {
|
||||
nwo: string,
|
||||
error: string
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { DownloadLink } from '../download-link';
|
||||
import { AnalysisFailure } from './analysis-failure';
|
||||
|
||||
export interface RemoteQueryResult {
|
||||
queryTitle: string;
|
||||
@@ -10,7 +11,8 @@ export interface RemoteQueryResult {
|
||||
totalResultCount: number;
|
||||
executionTimestamp: string;
|
||||
executionDuration: string;
|
||||
analysisSummaries: AnalysisSummary[]
|
||||
analysisSummaries: AnalysisSummary[],
|
||||
analysisFailures: AnalysisFailure[];
|
||||
}
|
||||
|
||||
export interface AnalysisSummary {
|
||||
|
||||
Reference in New Issue
Block a user