-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[server] incremental workspaces (1 of 2) #14303
Conversation
started the job as gitpod-build-se-inc-ws.1 because the annotations in the pull request description changed |
274b9e6
to
1834e8d
Compare
@@ -57,7 +57,6 @@ export default function SelectWorkspaceClass(props: SelectWorkspaceClassProps) { | |||
} else { | |||
return ( | |||
<div> | |||
<h3 className="mt-12">Workspaces</h3> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to the call site
getGitpodService() | ||
.server.getWorkspace(workspaceId) | ||
.then((ws) => { | ||
if (ws.latestInstance?.status?.phase === "stopped") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
polling here every 2 secs is much simpler (and actually works). Listening to events has a problem where we could have missed the 'stopped' event and then hang forever
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love this! I'm a huge fan of this simpler approach, and it also aligns much better with where we are looking to go with Pub API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with either way. Can we use repeat or any other mechnaims that ensures we cannot pile up requests here? ☁️
@@ -1065,70 +1067,8 @@ export class GitpodServerEEImpl extends GitpodServerImpl { | |||
return; | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
everything deleted below is no longer needed because we are now polling for prebuild finish. See above ☝️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I would recommend splitting up the polling changes from the rest of the incremental workspaces feature.
/hold if you'd like a review from someone else also, I may not have 100% of the context here
Starting to review now. |
@@ -262,7 +265,9 @@ export default class CreateWorkspace extends React.Component<CreateWorkspaceProp | |||
</> | |||
</div> | |||
<div className="flex justify-end mt-6"> | |||
<button onClick={() => this.createWorkspace(CreateWorkspaceMode.Default)}>New Workspace</button> | |||
<button onClick={() => this.createWorkspace({ ignoreRunningWorkspaceOnSameCommit: true })}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -148,7 +151,7 @@ export default class CreateWorkspace extends React.Component<CreateWorkspaceProp | |||
<button | |||
className="" | |||
onClick={() => { | |||
this.createWorkspace(CreateWorkspaceMode.Default, true); | |||
this.createWorkspace({ forceDefaultConfig: true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -421,7 +420,12 @@ export namespace GitpodServer { | |||
} | |||
export interface CreateWorkspaceOptions { | |||
contextUrl: string; | |||
mode?: CreateWorkspaceMode; | |||
// whether running prebuilds should be ignored. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧡
@@ -211,6 +211,12 @@ export interface AdditionalUserData { | |||
dotfileRepo?: string; | |||
// preferred workspace classes | |||
workspaceClasses?: WorkspaceClasses; | |||
// whether running prebuilds should be ignored on start | |||
ignoreRunnningPrebuilds?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to encapsulate these options in a sub-shape ala workspaceStartOptions
or so? That would make some of the other code shorter as well, and help keeping this one clean(er).
@@ -1070,7 +1068,7 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable { | |||
normalizedContextUrl = this.contextParser.normalizeContextURL(contextUrl); | |||
let runningForContextPromise: Promise<WorkspaceInfo[]> = Promise.resolve([]); | |||
const contextPromise = this.contextParser.handle(ctx, user, normalizedContextUrl); | |||
if (mode === CreateWorkspaceMode.SelectIfRunning) { | |||
if (!options.ignoreRunningWorkspaceOnSameCommit) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -1153,14 +1151,20 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable { | |||
} | |||
} | |||
|
|||
if (mode === CreateWorkspaceMode.SelectIfRunning && context.forceCreateNewWorkspace !== true) { | |||
if (!options.ignoreRunningWorkspaceOnSameCommit && !context.forceCreateNewWorkspace) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -998,23 +998,29 @@ export class GitpodServerEEImpl extends GitpodServerImpl { | |||
prebuiltWorkspace = await this.workspaceDb | |||
.trace(ctx) | |||
.findPrebuiltWorkspaceByCommit(cloneUrl, commitSHAs); | |||
if (prebuiltWorkspace?.state !== "available" && allowUsingPreviousPrebuilds) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This slight change in behavior (never starting based on previous prebuilds for OpenPrebuildContext) makes sense 💯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to change this to prebuiltWorkspace?.state !== "available" && ignoreRunningPrebuild && allowUsingPreviousPrebuilds
?
Otherwise exposing the ignoreRunningPrebuild
option to users makes less sense, because it is not independent of allowUsingPreviousPrebuild
, and we would have to explain that connection. 😕
Code LGTM, starting testing now. |
/werft run 👍 started the job as gitpod-build-se-inc-ws.3 |
Because of the missing preview env and failing build I took the liberty to rebase on latest main with the goal to test... |
@svenefftinge Can you explain why you think exposing the |
I tested back and forth, and it seems to mostly just work (TM) 🙂 Update: |
@svenefftinge Given the last two comments [1, 2] I think it would make sense to just expose a single option: the incremental workspace one. Motivation: the other options are hard to explain, add less additional value, and are not independent. BTW I'd love to approve a PR that "just" replaces the mode with the option fields, that alone is 🧡 🙃 |
b7ee4a9
to
80c54c2
Compare
Thanks @geropl ! I've worked a bit on this with @mbrevoort as well and we agreed that we should only have the |
Yeah, it doesn't make sense. I think I did it because I could 😅 Have removed it. |
9f52ac1
to
09fcd52
Compare
09fcd52
to
327e06f
Compare
</div> | ||
</Modal> | ||
); | ||
} else if (result?.runningWorkspacePrebuild) { | ||
return ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we put this behind a feature flag, just to decouple it from the rollout of the "incremental workspace" feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could make the removal of runningWorkspacePrebuild
a separate PR, that we merge first. But I'm not sure that buys us a lot. Would be super helpful to dive into the uncertainty a bit more and figure out if there is something we missed. I can't think of any issues that the removal of this feature could have on existing workflows or deployment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the core, the concern I have is: What happens to a high-frequency repo, that did not enable incremental workspaces yet, once we roll this out? To me it feels they'd just never benefit from Prebuilds anymore. Until they understand that there is Incremental Workspaces, and validate that it works for them. This feels like a bad spot for us to be in, and it feels unnecessary as well.
Alternatively, we could leave the screen as-is, maybe tied to !opts.incrementalWorkspace
. That way, people can still try to manually fall back to "Use last successful prebuild" (current code) if they want to.
Plus it gives us an obvious spot where to out the advertisement for the "Incremental Workspaces" option, which people can learn about and "migrate" to. 🧘
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me it feels they'd just never benefit from Prebuilds anymore
Why? They would have the same prebuilds as before, just don't get interrupted constantly by a running prebuild when starting a workspace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plus it gives us an obvious spot where to out the advertisement for the "Incremental Workspaces" option, which people can learn about and "migrate" to.
I would like to make this the default behavior once we have used it a little and verified it does what we hope it does.
💯 d'accord: project level also is nice because it_s a property of the project whether it supports incremental build
@svenefftinge I believe the same, but would be a bit more cautios with rolling out this change. Can we put this behind a feature flag? Just in case there are issues, e.g. unexpecte UX flow bugs etc.? Also, it would feel way better to keep the rollout separate from the other change. 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey everyone! Saw this new setting a left a drive-by comment below which can be also tackled in a follow-up issue. 😁
327e06f
to
dcafc70
Compare
dcafc70
to
7ccdcf4
Compare
let's go for #14461 |
Attention
Description
This change adds a project preference that allows to generally use previous prebuilds and incrementally update the workspace when creating a workspace:
Related Issue(s)
See #12582
How to test
Release Notes
Documentation
Werft options:
If enabled this will build
install/preview
Valid options are
all
,workspace
,webapp
,ide