Skip to content

Commit 82ca202

Browse files
committed
[dashboard] When an image build fails, also print instance.status.conditions.failed in the build logs
Fixes #3693 (comment)
1 parent 4ffbbd8 commit 82ca202

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

components/dashboard/src/start/StartWorkspace.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
252252
case "stopped":
253253
phase = StartPhase.Stopped;
254254
if (this.state.hasImageBuildLogs) {
255-
return <ImageBuildView workspaceId={this.state.workspaceInstance.workspaceId} phase={phase} />;
255+
return <ImageBuildView workspaceId={this.state.workspaceInstance.workspaceId} phase={phase} error={error} />;
256256
}
257257
if (!isHeadless && this.state.workspaceInstance.status.conditions.timeout) {
258258
title = 'Timed Out';
@@ -314,7 +314,7 @@ function PendingChangesDropdown(props: { workspaceInstance?: WorkspaceInstance }
314314
</ContextMenu>;
315315
}
316316

317-
function ImageBuildView(props: { workspaceId: string, phase?: StartPhase }) {
317+
function ImageBuildView(props: { workspaceId: string, phase?: StartPhase, error?: StartWorkspaceError }) {
318318
const logsEmitter = new EventEmitter();
319319

320320
useEffect(() => {
@@ -339,7 +339,7 @@ function ImageBuildView(props: { workspaceId: string, phase?: StartPhase }) {
339339

340340
return <StartPage title="Building Image" phase={props.phase}>
341341
<Suspense fallback={<div />}>
342-
<WorkspaceLogs logsEmitter={logsEmitter}/>
342+
<WorkspaceLogs logsEmitter={logsEmitter} errorMessage={props.error?.message} />
343343
</Suspense>
344344
</StartPage>;
345345
}

components/dashboard/src/start/WorkspaceLogs.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { DisposableCollection } from '@gitpod/gitpod-protocol';
1313

1414
export interface WorkspaceLogsProps {
1515
logsEmitter: EventEmitter;
16+
errorMessage?: string;
1617
}
1718

1819
export interface WorkspaceLogsState {
@@ -34,9 +35,7 @@ export default class WorkspaceLogs extends React.Component<WorkspaceLogsProps, W
3435
if (element === null) {
3536
return;
3637
}
37-
const theme: ITheme = {
38-
// background: '#F5F5F4',
39-
};
38+
const theme: ITheme = {};
4039
const options: ITerminalOptions = {
4140
cursorBlink: false,
4241
disableStdin: true,
@@ -71,6 +70,12 @@ export default class WorkspaceLogs extends React.Component<WorkspaceLogsProps, W
7170
});
7271
}
7372

73+
componentDidUpdate() {
74+
if (this.terminal && this.props.errorMessage) {
75+
this.terminal.write('\n' + this.props.errorMessage);
76+
}
77+
}
78+
7479
componentWillUnmount() {
7580
this.toDispose.dispose();
7681
}

0 commit comments

Comments
 (0)