Skip to content

Commit

Permalink
[dashboard] When an image build fails, also print instance.status.con…
Browse files Browse the repository at this point in the history
…ditions.failed in the build logs

Fixes #3693 (comment)
  • Loading branch information
jankeromnes committed Apr 2, 2021
1 parent 65ff180 commit 2ba533e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
6 changes: 3 additions & 3 deletions components/dashboard/src/start/StartWorkspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
case "stopped":
phase = StartPhase.Stopped;
if (this.state.hasImageBuildLogs) {
return <ImageBuildView workspaceId={this.state.workspaceInstance.workspaceId} phase={phase} />;
return <ImageBuildView workspaceId={this.state.workspaceInstance.workspaceId} phase={phase} error={error} />;
}
if (!isHeadless && this.state.workspaceInstance.status.conditions.timeout) {
title = 'Timed Out';
Expand Down Expand Up @@ -314,7 +314,7 @@ function PendingChangesDropdown(props: { workspaceInstance?: WorkspaceInstance }
</ContextMenu>;
}

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

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

return <StartPage title="Building Image" phase={props.phase}>
<Suspense fallback={<div />}>
<WorkspaceLogs logsEmitter={logsEmitter}/>
<WorkspaceLogs logsEmitter={logsEmitter} errorMessage={props.error?.message} />
</Suspense>
</StartPage>;
}
Expand Down
11 changes: 8 additions & 3 deletions components/dashboard/src/start/WorkspaceLogs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { DisposableCollection } from '@gitpod/gitpod-protocol';

export interface WorkspaceLogsProps {
logsEmitter: EventEmitter;
errorMessage?: string;
}

export interface WorkspaceLogsState {
Expand All @@ -34,9 +35,7 @@ export default class WorkspaceLogs extends React.Component<WorkspaceLogsProps, W
if (element === null) {
return;
}
const theme: ITheme = {
// background: '#F5F5F4',
};
const theme: ITheme = {};
const options: ITerminalOptions = {
cursorBlink: false,
disableStdin: true,
Expand Down Expand Up @@ -71,6 +70,12 @@ export default class WorkspaceLogs extends React.Component<WorkspaceLogsProps, W
});
}

componentDidUpdate() {
if (this.terminal && this.props.errorMessage) {
this.terminal.write('\n' + this.props.errorMessage);
}
}

componentWillUnmount() {
this.toDispose.dispose();
}
Expand Down

0 comments on commit 2ba533e

Please sign in to comment.