Skip to content

Commit

Permalink
Merge branch 'master' into feat-add-default-tag-filters-per-application
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Aug 31, 2023
2 parents e9907f6 + 62033d0 commit 49b5a13
Showing 1 changed file with 10 additions and 24 deletions.
34 changes: 10 additions & 24 deletions packages/core/src/pipeline/details/StageFailureMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,33 +73,19 @@ export class StageFailureMessage extends React.Component<IStageFailureMessagePro
}

public render() {
const { message, messages, stage } = this.props;
const { message, messages } = this.props;
const { isFailed, failedTask, failedExecutionId, failedStageName, failedStageId } = this.state;

let stageMessages = message && !messages.length ? [message] : messages;
if (stageMessages.length > 0) {
if (isFailed || failedTask || message || messages.length) {
const exceptionTitle = isFailed ? (messages.length ? 'Exceptions' : 'Exception') : 'Warning';

// expression evaluation warnings can get really long and hide actual failure messages, source
// filter out expression evaluation failure messages if either:
// - there was a stage failure (and failed expressions don't fail the stage)
// - expression evaluation was explicitly disabled for the stage(as Orca still processes expressions and populates
// warnings when evaluation is disabled disabled)
const shouldFilterExpressionFailures =
(isFailed && !stage.context?.failOnFailedExpressions) || stage.context?.skipExpressionEvaluation;

if (shouldFilterExpressionFailures) {
stageMessages = stageMessages.filter((m) => !m.startsWith('Failed to evaluate'));

if (stageMessages.length === 0) {
// no messages to be displayed after filtering
return null;
}
}

const displayMessages = stageMessages.map((m, i) => (
<Markdown key={i} message={m || StageFailureMessages.NO_REASON_PROVIDED} className="break-word" />
));
const displayMessages =
message || !messages.length ? (
<Markdown message={message || StageFailureMessages.NO_REASON_PROVIDED} className="break-word" />
) : (
messages.map((m, i) => (
<Markdown key={i} message={m || StageFailureMessages.NO_REASON_PROVIDED} className="break-word" />
))
);

if (displayMessages) {
return (
Expand Down

0 comments on commit 49b5a13

Please sign in to comment.