Skip to content

Commit

Permalink
feat: report Artifact GC failures in user interface. Fixes #8518 (#9115)
Browse files Browse the repository at this point in the history
* feat: add ArtifactGCError Condition

Signed-off-by: Dillen Padhiar <[email protected]>

* feat: add artifactGCError to ConditionType in UI files

Signed-off-by: Dillen Padhiar <[email protected]>

* feat: report artifactGC errors to UI

Signed-off-by: Dillen Padhiar <[email protected]>

* chore: fixed lint issue

Signed-off-by: Dillen Padhiar <[email protected]>

* feat: removed check in hasArtifactGCError for empty conditions

Signed-off-by: Dillen Padhiar <[email protected]>

* chore: make pre-commit

Signed-off-by: Dillen Padhiar <[email protected]>

* feat: reformatting

Signed-off-by: Dillen Padhiar <[email protected]>
  • Loading branch information
dpadhiar committed Jul 15, 2022
1 parent 56d0c66 commit 559b59c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
2 changes: 2 additions & 0 deletions pkg/apis/workflow/v1alpha1/workflow_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1898,6 +1898,8 @@ const (
ConditionTypeSpecError ConditionType = "SpecError"
// ConditionTypeMetricsError is an error during metric emission
ConditionTypeMetricsError ConditionType = "MetricsError"
//ConditionTypeArtifactGCError is an error on artifact garbage collection
ConditionTypeArtifactGCError ConditionType = "ArtifactGCError"
)

type Condition struct {
Expand Down
16 changes: 11 additions & 5 deletions ui/src/app/shared/conditions-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@ interface Props {
}

const WarningConditions: ConditionType[] = ['SpecWarning'];
const ErrorConditions: ConditionType[] = ['MetricsError', 'SubmissionError', 'SpecError'];
const ErrorConditions: ConditionType[] = ['MetricsError', 'SubmissionError', 'SpecError', 'ArtifactGCError'];

export function hasWarningConditionBadge(conditions: Condition[]): boolean {
if (conditions.length === 0) {
return false;
}

for (const condition of conditions) {
if (WarningConditions.includes(condition.type)) {
return true;
Expand All @@ -26,6 +22,16 @@ export function hasWarningConditionBadge(conditions: Condition[]): boolean {
return false;
}

export function hasArtifactGCError(conditions: Condition[]): boolean {
for (const condition of conditions) {
if (condition.type === 'ArtifactGCError') {
return true;
}
}

return false;
}

function getConditionIcon(condition: ConditionType): JSX.Element {
let icon;
if (WarningConditions.includes(condition as ConditionType)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {ErrorNotice} from '../../../shared/components/error-notice';
import {ProcessURL} from '../../../shared/components/links';
import {Loading} from '../../../shared/components/loading';
import {SecurityNudge} from '../../../shared/components/security-nudge';
import {hasWarningConditionBadge} from '../../../shared/conditions-panel';
import {hasArtifactGCError, hasWarningConditionBadge} from '../../../shared/conditions-panel';
import {Context} from '../../../shared/context';
import {historyUrl} from '../../../shared/history';
import {getPodName, getTemplateNameFromNode} from '../../../shared/pod-name';
Expand Down Expand Up @@ -256,6 +256,9 @@ export const WorkflowDetails = ({history, location, match}: RouteComponentProps<
if (e.type === 'DELETED') {
setError(new Error('Workflow deleted'));
} else {
if (hasArtifactGCError(e.object.status.conditions)) {
setError(new Error('Artifact garbage collection failed'));
}
setWorkflow(e.object);
}
},
Expand Down
2 changes: 1 addition & 1 deletion ui/src/models/workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ export interface Condition {
message: string;
}

export type ConditionType = 'Completed' | 'SpecWarning' | 'MetricsError' | 'SubmissionError' | 'SpecError';
export type ConditionType = 'Completed' | 'SpecWarning' | 'MetricsError' | 'SubmissionError' | 'SpecError' | 'ArtifactGCError';
export type ConditionStatus = 'True' | 'False' | 'Unknown';

/**
Expand Down

0 comments on commit 559b59c

Please sign in to comment.