Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dashboard] Don't show 'Continue with Default Image' button while the build is still running #4104

Merged
merged 2 commits into from
Apr 29, 2021

Conversation

jankeromnes
Copy link
Contributor

@jankeromnes jankeromnes commented Apr 29, 2021

Fixes #3777

While going down the rabbit hole of trying to fix the Continue with Default Image button while a build is still running in #3993, we realized that running Docker builds cannot be interrupted. image-builder simply wasn't designed for that.

So we have 3 choices:

  1. Change image-builder so that it can interrupt builds that are currently in progress

  2. Just start a new workspace instance while the old instance is still building, and live with having two instances in this case (breaks many assumptions in the code)

  3. Remove the Continue with Default Image button while the build is still running, for now (this was also the case in the previous dashboard design -- button only showed up when the build finished / failed)

This PR implements choice 3.

How to test:

@jankeromnes jankeromnes changed the title [dashboard] Don't show 'Continue With Default Image' button while the build is still running [dashboard] Don't show 'Continue with Default Image' button while the build is still running Apr 29, 2021
@@ -267,7 +267,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} onStartWithDefaultImage={() => this.startWorkspace(true, true)} phase={phase} error={error} />;
return <ImageBuildView workspaceId={this.state.workspaceInstance.workspaceId} onStartWithDefaultImage={e => { (e.target as HTMLButtonElement).disabled = true; this.startWorkspace(true, true); }} phase={phase} error={error} />;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the disablement is quite hidden now. would extracting to a dedicated handler as a local help to make it more readable?

Copy link
Member

@AlexTugarev AlexTugarev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as advertised!

@jankeromnes jankeromnes force-pushed the jx/dont-continue-with-default-img branch from c6d6cf1 to d0be03f Compare April 29, 2021 08:10
@jankeromnes jankeromnes force-pushed the jx/dont-continue-with-default-img branch from d0be03f to 5774850 Compare April 29, 2021 08:12
@jankeromnes
Copy link
Contributor Author

jankeromnes commented Apr 29, 2021

🎰

/werft run

👍 started the job as gitpod-build-jx-dont-continue-with-default-img.4

@jankeromnes jankeromnes merged commit 4c87092 into main Apr 29, 2021
@jankeromnes jankeromnes deleted the jx/dont-continue-with-default-img branch April 29, 2021 08:35
@gtsiolis
Copy link
Contributor

gtsiolis commented Apr 29, 2021

FWIW, Tried this earlier and worked as expected! 🎰

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Continue with Default Image" button doesn't work when build is still in progress
3 participants