diff --git a/packages/components/src/components/PipelineRun/PipelineRun.js b/packages/components/src/components/PipelineRun/PipelineRun.js index 253e837d7..8ea638bc0 100644 --- a/packages/components/src/components/PipelineRun/PipelineRun.js +++ b/packages/components/src/components/PipelineRun/PipelineRun.js @@ -97,7 +97,7 @@ export /* istanbul ignore next */ class PipelineRunContainer extends Component { return []; } - const { tasks, taskRuns } = this.props; + const { tasks, taskRuns, intl } = this.props; if (!tasks || !taskRuns) { return []; @@ -107,10 +107,22 @@ export /* istanbul ignore next */ class PipelineRunContainer extends Component { status: { taskRuns: taskRunDetails } } = pipelineRun; + const retryPodIndex = {}; + const retriedTaskRuns = taskRuns + .filter(taskRun => taskRun.status.retriesStatus) + .reduce((acc, taskRun) => { + taskRun.status.retriesStatus.forEach((retryStatus, index) => { + const retryRun = { ...taskRun }; + retryRun.status = retryStatus; + retryPodIndex[retryStatus.podName] = index; + acc.push(retryRun); + }); + return acc; + }, []); return taskRuns + .concat(retriedTaskRuns) .map(taskRun => { let taskSpec; - if (taskRun.spec.taskRef) { const task = selectedTask(taskRun.spec.taskRef.name, tasks); @@ -135,7 +147,7 @@ export /* istanbul ignore next */ class PipelineRunContainer extends Component { const { reason, status: succeeded } = getStatus(taskRun); - const { pipelineTaskName } = taskRunDetails[taskRunName] || { + let { pipelineTaskName } = taskRunDetails[taskRunName] || { pipelineTaskName: taskRun.metadata.labels['tekton.dev/conditionCheck'] }; @@ -167,11 +179,24 @@ export /* istanbul ignore next */ class PipelineRunContainer extends Component { ); steps = stepsStatus(reorderedSteps, taskRun.status.steps); } + const { podName } = taskRun.status; + + if (retryPodIndex[podName] || taskRun.status.retriesStatus) { + const retryNumber = + retryPodIndex[podName] || taskRun.status.retriesStatus.length; + pipelineTaskName = intl.formatMessage( + { + id: 'dashboard.pipelineRun.pipelineTaskName.retryAppendage', + defaultMessage: '{pipelineTaskName} (retry {retryNumber, number})' + }, + { pipelineTaskName, retryNumber } + ); + } return { - id: taskRun.metadata.uid, + id: `${taskRun.metadata.uid}${podName}`, pipelineTaskName, - pod: taskRun.status.podName, + pod: podName, reason, steps, succeeded, diff --git a/packages/components/src/components/PipelineRun/PipelineRun.test.js b/packages/components/src/components/PipelineRun/PipelineRun.test.js index bc12fe3da..e70e1ecd4 100644 --- a/packages/components/src/components/PipelineRun/PipelineRun.test.js +++ b/packages/components/src/components/PipelineRun/PipelineRun.test.js @@ -70,3 +70,60 @@ it('PipelineRunContainer handles init step failures', async () => { ); await waitForElement(() => getByText(initStepName)); }); + +it('PipelineRunContainer handles init step failures for retry', async () => { + const initStepName = 'my-failed-init-step'; + const pipelineRunName = 'fake_pipelineRunName'; + const taskRunName = 'fake_taskRunName'; + const retryText = '(retry 1)'; + + const taskRun = { + metadata: { + name: taskRunName, + labels: {} + }, + spec: { + params: {}, + resources: { + inputs: {}, + outputs: {} + }, + taskSpec: {} + }, + status: { + steps: [ + { + terminated: {}, + name: initStepName + } + ], + retriesStatus: [ + { + status: { + steps: [ + { + terminated: {}, + name: initStepName + } + ] + } + } + ] + } + }; + + const pipelineRun = { + metadata: { + name: pipelineRunName + }, + status: { + taskRuns: [] + } + }; + + const { getByText } = renderWithIntl( + + ); + await waitForElement(() => getByText(initStepName)); + await waitForElement(() => getByText(retryText)); +}); diff --git a/src/nls/messages_en.json b/src/nls/messages_en.json index c9ddfae5c..60620cf49 100644 --- a/src/nls/messages_en.json +++ b/src/nls/messages_en.json @@ -192,6 +192,7 @@ "dashboard.pipelineRun.logEmpty": "No log available", "dashboard.pipelineRun.logFailed": "Unable to fetch log", "dashboard.pipelineRun.notFound": "PipelineRun not found", + "dashboard.pipelineRun.pipelineTaskName.retryAppendage": "{pipelineTaskName} (retry {retryNumber, number})", "dashboard.pipelineRun.rerunStatusMessage": "View status", "dashboard.pipelineRun.stepCompleted": "Step completed", "dashboard.pipelineRun.stepFailed": "Step failed", @@ -314,4 +315,4 @@ "react-intl-formatted-duration.minutesUnit": "{value, plural, one {minute} other {minutes}}", "react-intl-formatted-duration.secondsUnit": "{value, plural, one {second} other {seconds}}" } -} +} \ No newline at end of file