Skip to content

[server] incremental workspaces #14461

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

Merged
merged 2 commits into from
Nov 8, 2022
Merged

[server] incremental workspaces #14461

merged 2 commits into from
Nov 8, 2022

Conversation

svenefftinge
Copy link
Contributor

@svenefftinge svenefftinge commented Nov 7, 2022

Description

Introduces a project setting that allows for starting workspaces on the successful prebuild on the direct linear commit history. Enabling this will always skip the "prebuild-in-progress" view.
It also allows specifying the number of commits to skip in between prebuilds.

Related Issue(s)

Fixes #12583

How to test

  • create a team & project
  • go to the settings and enable 'incremental prebuilds' set the number of commits to 1
  • start a workspace.
  • push a commit (no config change!) and verify that no prebuild is running
  • start a workspace and verify that it is based on the first prebuild
  • push a commit (no config change!) and verify that a prebuild gets triggered
  • push a commit that changes the init task in the gitpod.yml and verify that a prebuild gets triggered

Release Notes

Introduced a new project setting that allows starting workspaces based on the last successful prebuild in the git commit history.

Documentation

Werft options:

  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-integration-tests=all
    Valid options are all, workspace, webapp, ide

@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-se-inc-ws2.1 because the annotations in the pull request description changed
(with .werft/ from main)

@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-se-inc-ws2.2 because the annotations in the pull request description changed
(with .werft/ from main)

@svenefftinge svenefftinge marked this pull request as ready for review November 7, 2022 03:27
@svenefftinge svenefftinge requested a review from a team November 7, 2022 03:27
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Nov 7, 2022
@svenefftinge svenefftinge changed the title Skip prebuilds for incremental workspaces [server] incremental workspaces (2 of 2) - Skip prebuilds Nov 7, 2022
@AlexTugarev
Copy link
Member

This issue is related: #14237

I would make sense to decouple receiving push events from actually triggering a prebuild. We could introduce a control loop (on quorum leader) to go through the recorded webhook events and then call the prebuild manager periodically.

@svenefftinge
Copy link
Contributor Author

This issue is related: #14237

I think we can and should tackle this issue separately, to avoid making this PR bigger than it needs to be.

@gtsiolis
Copy link
Contributor

gtsiolis commented Nov 7, 2022

Looking at this now! 👀

Copy link
Contributor

@gtsiolis gtsiolis left a comment

Choose a reason for hiding this comment

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

Thanks for reaching out, @svenefftinge! Left some comments below!

</div>
<div className="flex mt-4 max-w-2xl">
<div className="flex flex-col ml-6">
<input
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: This could also benefit from a button to update the number here, as we do with dotfiles.

@svenefftinge svenefftinge marked this pull request as ready for review November 7, 2022 18:11
@svenefftinge svenefftinge changed the title [server] incremental workspaces (2 of 2) - Skip prebuilds [server] incremental workspaces Nov 7, 2022
@svenefftinge
Copy link
Contributor Author

svenefftinge commented Nov 8, 2022

/werft run with-clean-slate-deployment

👍 started the job as gitpod-build-se-inc-ws2.10
(with .werft/ from main)

Copy link
Contributor

@jankeromnes jankeromnes left a comment

Choose a reason for hiding this comment

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

Awesome work, many thanks @svenefftinge! 💯

I read through the code changes twice, and tested various cases, and everything looks good so far, so approving to unblock this. 🚢

(I feel like I'd need to spend more time to fully understand and test all the implications of the workspace creation mode changes, but this provides sufficient value and seems low-risk enough that we can also go ahead with this, and we can adjust and look for bugs async / or worst case, revert at the first sign of trouble 😋)

Let's do this! 🏀

Comment on lines +105 to +106
// we are disabling prebuild cancellation when incremental workspaces are enabled
keepOutdatedPrebuildsRunning: target.checked || project?.settings?.keepOutdatedPrebuildsRunning,
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like we'll eventually want to remove this feature. It's not ideal / has too many unfortunate side effects.

Comment on lines +137 to +139
<div className="text-gray-500 dark:text-gray-400 text-sm mt-2">
The number of commits that are skipped between prebuilds.
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

We'll likely iterate on this feature and the UX more later, but I wonder: Why bundle these two features together? (I.e. "run prebuilds every N commits" and "always skip prebuild in progress").

I feel like these should be two separate features, and I'm not 100% sure we can do a good job explaining to users exactly what this "number of skipped commits" does and how to use it properly for their project.

Comment on lines +159 to +166
if (!ws.done) {
await this.webhookEvents.updateEvent(event.id, {
prebuildStatus: "prebuild_triggered",
status: "processed",
prebuildId: ws.prebuildId,
});
return ws;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I fully understand this change. What does it mean when ws.done is true? And does it always mean that we did not in fact trigger a prebuild? 💭

@roboquat roboquat merged commit c18efbd into main Nov 8, 2022
@roboquat roboquat deleted the se/inc-ws2 branch November 8, 2022 08:33
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note size/XL team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Run Fewer Prebuilds
5 participants