-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Migrate Prebuild settings – EXP-672 #18842
Conversation
*/ | ||
prebuilds?: PrebuildSettings; | ||
|
||
/** @deprecated see `Project.settings.prebuilds.enabled` instead. */ |
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.
FYI, not removing here, as these are required for the migration phase
@@ -174,10 +172,7 @@ export class GitHubEnterpriseApp { | |||
context, | |||
}); | |||
|
|||
const shouldRun = Project.hasPrebuildSettings(project) | |||
? prebuildPrecondition.shouldRun | |||
: this.appRules.shouldRunPrebuild(config, CommitContext.isDefaultBranch(context), false, false); |
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.
FYI, this does effectively disables comparable settings in .gitpod.yml, which we want to deprecate in #18788
export function getPrebuildSettings(project: Project): PrebuildSettingsWithDefaults { | ||
const effective = { | ||
...PREBUILD_SETTINGS_DEFAULTS, | ||
...project.settings?.prebuilds, |
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 overrides properties that are set to undefined
.
We need to filoter those properties out first.
/**
* Returns effective prebuild settings for the given project. The resulting settings
* contain default values for properties which are not set explicitly for this project.
*/
export function getPrebuildSettings(project: Project): PrebuildSettingsWithDefaults {
const overrides = Object.fromEntries(
Object.entries(project.settings?.prebuilds ?? {}).filter(([_, value]) => value !== undefined),
);
return {
...PREBUILD_SETTINGS_DEFAULTS,
...overrides,
};
}
```
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.
done
@@ -805,7 +805,7 @@ export class TypeORMWorkspaceDBImpl extends TransactionalDBImpl<WorkspaceDB> imp | |||
const repo = await this.getPrebuiltWorkspaceRepo(); | |||
|
|||
let query = repo.createQueryBuilder("pws"); | |||
query = query.where("pws.projectId != :projectId", { projectId }); | |||
query = query.where("pws.projectId = :projectId", { projectId }); |
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.
🙏
Alright, let me try to add those changes. |
@svenefftinge, could we apply changes to the layout and inlining of settings in a separate PR 🙏🏻. This one is already 1K changes and it took a while to test ride it. The mentioned application of defaults is related but not affected by the settings migration in general. It wouldn't change much to do that separately. |
1f1715d
to
b88a21f
Compare
bool keep_outdated_prebuilds_running = 2; | ||
bool use_previous_prebuilds = 3; | ||
int32 prebuild_every_nth = 4; | ||
reserved 1; // enable_incremental_prebuilds |
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.
👍
@@ -328,22 +328,22 @@ func setupProjectsService(t *testing.T) (*protocol.MockAPIInterface, v1connect.P | |||
|
|||
func newProject(p *protocol.Project) *protocol.Project { | |||
r := rand.Int() | |||
b_false := false |
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.
[nit] Underscore is an anti-pattern in go. camelCase is the expected
b88a21f
to
d0decdb
Compare
Linking through the related documentation and changelog updates related to changing the prebuild settings. Given the potential impact on users workflows from this change, I would suggest that we make sure to incorporate documentation of the changes into the linked docs pull request, so that users are aware of the impact and actions on their end. Some areas that we'll want to clarify in comms (questions are rhetorical, so don't need directly answering here):
... I will try to think through other impacts + questions. Some further discussion, questions and clarifications in this internal slack thread. |
d0decdb
to
b6466c4
Compare
- no more incremental prebuilds - always incremental workspace - never wait for running prebuilds
d29f3b8
to
63c3c6d
Compare
/unhold |
Description
This PR introduces a
PrebuildSettings
model to encapsulate prebuild settings of a project in Gitpod. Existing projects will get updated on access of the project, i.e. once the Project model is accesses, the settings are updated. The Project Settings page uses the new data structure to render and update prebuild settings.As this is primarily a backend change, there are no UX changes to expect.
Regarding system behavior of this one time migration the noteworthy impact is the following:
Summary generated by Copilot
🤖 Generated by Copilot at 9024949
Refactor prebuild settings data model and logic to support more flexible and configurable prebuild options for projects. Update the UI, the protocol, the API, and the server components to use the new
prebuilds
property of the project settings, and migrate the existing settings of inactive projects.Related Issue(s)
Fixes EXP-672
How to test
Documentation
Preview status
Gitpod was successfully deployed to your preview environment.
Build Options
Build
Run the build with werft instead of GHA
Run Leeway with
--dont-test
Publish
Installer
Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
If enabled this will build
install/preview
If enabled this will create the environment on GCE infra
Valid options are
all
,workspace
,webapp
,ide
,jetbrains
,vscode
,ssh
. If enabled,with-preview
andwith-large-vm
will be enabled./hold