Skip to content

Commit 63c3c6d

Browse files
committed
[prebuilds] changed prebuild semantics
- no more incremental prebuilds - always incremental workspace - never wait for running prebuilds
1 parent f111f23 commit 63c3c6d

File tree

24 files changed

+318
-726
lines changed

24 files changed

+318
-726
lines changed

components/dashboard/src/admin/ProjectDetail.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ export default function ProjectDetail(props: { project: Project; owner: string |
4545
</Property>
4646
</div>
4747
<div className="flex w-full mt-6">
48-
<Property name="Incremental Prebuilds">
49-
{props.project.settings?.useIncrementalPrebuilds ? "Yes" : "No"}
50-
</Property>
5148
<Property name="Marked Deleted">{props.project.markedDeleted ? "Yes" : "No"}</Property>
5249
</div>
5350
</div>

components/dashboard/src/projects/ProjectSettings.tsx

Lines changed: 56 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { useCallback, useContext, useState, Fragment, useMemo, useEffect } from
99
import { useHistory } from "react-router";
1010
import { CheckboxInputField } from "../components/forms/CheckboxInputField";
1111
import { PageWithSubMenu } from "../components/PageWithSubMenu";
12-
import PillLabel from "../components/PillLabel";
1312
import { getGitpodService } from "../service/service";
1413
import { ProjectContext, useCurrentProject } from "./project-context";
1514
import { getProjectSettingsMenu, getProjectTabs } from "./projects.routes";
@@ -113,6 +112,7 @@ export default function ProjectSettingsView() {
113112

114113
await updateProjectSettings({
115114
prebuilds: {
115+
...project.settings?.prebuilds,
116116
enable: value,
117117
},
118118
});
@@ -237,13 +237,12 @@ export default function ProjectSettingsView() {
237237
label="Enable prebuilds"
238238
hint={
239239
<span>
240-
{prebuildSettings.enable ? (
241-
<Fragment>
242-
Prebuilds will run for any <code>before</code> or <code>init</code> tasks.
243-
</Fragment>
244-
) : (
245-
"Requires permissions to configure repository webhooks."
246-
)}{" "}
240+
<Fragment>
241+
Prebuilds reduce wait time for new workspaces.
242+
{!prebuildSettings.enable
243+
? " Enabling requires permissions to configure repository webhooks."
244+
: ""}
245+
</Fragment>{" "}
247246
<a
248247
className="gp-link"
249248
target="_blank"
@@ -259,17 +258,51 @@ export default function ProjectSettingsView() {
259258
/>
260259
{prebuildSettings.enable && (
261260
<>
262-
<SelectInputField
263-
disabled={!prebuildSettings.enable}
264-
label="Build branches"
265-
value={prebuildSettings.branchStrategy || ""}
266-
containerClassName="max-w-md ml-6 text-sm"
267-
onChange={(val) => setPrebuildBranchStrategy(val as PrebuildSettings.BranchStrategy)}
268-
>
269-
<option value="default-branch">Default branch</option>
270-
<option value="all-branches">All branches</option>
271-
<option value="matched-branches">Matched by pattern</option>
272-
</SelectInputField>
261+
<div className="flex mt-4 max-w-2xl">
262+
<div className="flex flex-col ml-6">
263+
<label
264+
htmlFor="prebuildInterval"
265+
className={classNames(
266+
"text-sm font-semibold cursor-pointer tracking-wide",
267+
!prebuildSettings.enable
268+
? "text-gray-400 dark:text-gray-400"
269+
: "text-gray-600 dark:text-gray-100",
270+
)}
271+
>
272+
Commit Interval
273+
</label>
274+
<input
275+
type="number"
276+
id="prebuildInterval"
277+
min="0"
278+
max="100"
279+
step="5"
280+
className="mt-2"
281+
disabled={!prebuildSettings.enable}
282+
value={prebuildSettings.prebuildInterval}
283+
onChange={({ target }) => setPrebuildInterval(target.value)}
284+
/>
285+
<div className="text-gray-500 dark:text-gray-400 text-sm mt-2">
286+
The number of commits to be skipped between prebuild runs.
287+
</div>
288+
</div>
289+
</div>
290+
<div>
291+
<SelectInputField
292+
disabled={!prebuildSettings.enable}
293+
label="Branch Filter"
294+
value={prebuildSettings.branchStrategy || ""}
295+
containerClassName="max-w-md ml-6 text-sm"
296+
onChange={(val) => setPrebuildBranchStrategy(val as PrebuildSettings.BranchStrategy)}
297+
>
298+
<option value="all-branches">All branches</option>
299+
<option value="default-branch">Default branch</option>
300+
<option value="matched-branches">Match branches by pattern</option>
301+
</SelectInputField>
302+
<div className="ml-6 text-gray-500 dark:text-gray-400 text-sm mt-2">
303+
Run prebuilds on the selected branches only.
304+
</div>
305+
</div>
273306
{prebuildSettings.branchStrategy === "matched-branches" && (
274307
<div className="flex flex-col ml-6 mt-4">
275308
<label
@@ -298,94 +331,18 @@ export default function ProjectSettingsView() {
298331
)}
299332
<InputField
300333
className="max-w-md ml-6 text-sm"
301-
label="Workspace machine type"
334+
label="Machine type"
302335
disabled={!prebuildSettings.enable}
303336
>
304337
<SelectWorkspaceClassComponent
305338
disabled={!prebuildSettings.enable}
306339
selectedWorkspaceClass={prebuildSettings.workspaceClass}
307340
onSelectionChange={setWorkspaceClassForPrebuild}
308341
/>
309-
</InputField>
310-
<CheckboxInputField
311-
label="Enable Incremental Prebuilds"
312-
hint={
313-
<span>
314-
When possible, use an earlier successful prebuild as a base to create new prebuilds.
315-
This can make your prebuilds significantly faster, especially if they normally take
316-
longer than 10 minutes.{" "}
317-
<a
318-
className="gp-link"
319-
target="_blank"
320-
rel="noreferrer"
321-
href="https://www.gitpod.io/changelog/faster-incremental-prebuilds"
322-
>
323-
Learn more
324-
</a>
325-
</span>
326-
}
327-
disabled={!prebuildSettings.enable}
328-
checked={project.settings?.useIncrementalPrebuilds ?? false}
329-
onChange={(checked) => updateProjectSettings({ useIncrementalPrebuilds: checked })}
330-
/>
331-
<CheckboxInputField
332-
label="Cancel Prebuilds on Outdated Commits"
333-
hint="Cancel pending or running prebuilds on the same branch when new commits are pushed."
334-
disabled={!prebuildSettings.enable}
335-
checked={!project.settings?.keepOutdatedPrebuildsRunning}
336-
onChange={(checked) => updateProjectSettings({ keepOutdatedPrebuildsRunning: !checked })}
337-
/>
338-
<CheckboxInputField
339-
label={
340-
<span>
341-
Use Last Successful Prebuild{" "}
342-
<PillLabel type="warn" className="font-semibold mt-2 ml-2 py-0.5 px-2 self-center">
343-
Alpha
344-
</PillLabel>
345-
</span>
346-
}
347-
hint="Skip waiting for prebuilds in progress and use the last successful prebuild from previous
348-
commits on the same branch."
349-
disabled={!prebuildSettings.enable}
350-
checked={!!project.settings?.allowUsingPreviousPrebuilds}
351-
onChange={(checked) =>
352-
updateProjectSettings({
353-
allowUsingPreviousPrebuilds: checked,
354-
// we are disabling prebuild cancellation when incremental workspaces are enabled
355-
keepOutdatedPrebuildsRunning:
356-
checked || project?.settings?.keepOutdatedPrebuildsRunning,
357-
})
358-
}
359-
/>
360-
<div className="flex mt-4 max-w-2xl">
361-
<div className="flex flex-col ml-6">
362-
<label
363-
htmlFor="prebuildInterval"
364-
className={classNames(
365-
"text-sm font-semibold cursor-pointer tracking-wide",
366-
!prebuildSettings.enable
367-
? "text-gray-400 dark:text-gray-400"
368-
: "text-gray-600 dark:text-gray-100",
369-
)}
370-
>
371-
Prebuild interval
372-
</label>
373-
<input
374-
type="number"
375-
id="prebuildInterval"
376-
min="0"
377-
max="100"
378-
step="5"
379-
className="mt-2"
380-
disabled={!prebuildSettings.enable}
381-
value={prebuildSettings.prebuildInterval}
382-
onChange={({ target }) => setPrebuildInterval(target.value)}
383-
/>
384-
<div className="text-gray-500 dark:text-gray-400 text-sm mt-2">
385-
The number of commits to be skipped between prebuild runs.
386-
</div>
342+
<div className="text-gray-500 dark:text-gray-400 text-sm mt-2">
343+
Use a smaller machine type for cost optimization.
387344
</div>
388-
</div>
345+
</InputField>
389346
</>
390347
)}
391348
<div>

components/dashboard/src/service/public-api.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ export function projectToProtocol(project: Project): ProtocolProject {
107107
teamId: project.teamId,
108108
appInstallationId: "undefined",
109109
settings: {
110-
allowUsingPreviousPrebuilds: project.settings?.prebuild?.usePreviousPrebuilds,
111-
keepOutdatedPrebuildsRunning: project.settings?.prebuild?.keepOutdatedPrebuildsRunning,
112-
useIncrementalPrebuilds: project.settings?.prebuild?.enableIncrementalPrebuilds,
113110
workspaceClasses: {
114111
regular: project.settings?.workspace?.workspaceClass?.regular || "",
115112
},

components/dashboard/src/workspaces/CreateWorkspacePage.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ export function CreateWorkspacePage() {
172172

173173
// we already have shown running workspaces to the user
174174
opts.ignoreRunningWorkspaceOnSameCommit = true;
175-
opts.ignoreRunningPrebuild = true;
176175

177176
// if user received an INVALID_GITPOD_YML yml for their contextURL they can choose to proceed using default configuration
178177
if (workspaceContext.error?.code === ErrorCodes.INVALID_GITPOD_YML) {

components/gitpod-protocol/go/gitpod-service.go

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,19 +1678,9 @@ type Repository struct {
16781678

16791679
// WorkspaceCreationResult is the WorkspaceCreationResult message type
16801680
type WorkspaceCreationResult struct {
1681-
CreatedWorkspaceID string `json:"createdWorkspaceId,omitempty"`
1682-
ExistingWorkspaces []*WorkspaceInfo `json:"existingWorkspaces,omitempty"`
1683-
RunningPrebuildWorkspaceID string `json:"runningPrebuildWorkspaceID,omitempty"`
1684-
RunningWorkspacePrebuild *RunningWorkspacePrebuild `json:"runningWorkspacePrebuild,omitempty"`
1685-
WorkspaceURL string `json:"workspaceURL,omitempty"`
1686-
}
1687-
1688-
// RunningWorkspacePrebuild is the RunningWorkspacePrebuild message type
1689-
type RunningWorkspacePrebuild struct {
1690-
PrebuildID string `json:"prebuildID,omitempty"`
1691-
SameCluster bool `json:"sameCluster,omitempty"`
1692-
Starting string `json:"starting,omitempty"`
1693-
WorkspaceID string `json:"workspaceID,omitempty"`
1681+
CreatedWorkspaceID string `json:"createdWorkspaceId,omitempty"`
1682+
ExistingWorkspaces []*WorkspaceInfo `json:"existingWorkspaces,omitempty"`
1683+
WorkspaceURL string `json:"workspaceURL,omitempty"`
16941684
}
16951685

16961686
// Workspace is the Workspace message type
@@ -2027,8 +2017,6 @@ type CreateWorkspaceOptions struct {
20272017
ContextURL string `json:"contextUrl,omitempty"`
20282018
OrganizationId string `json:"organizationId,omitempty"`
20292019
IgnoreRunningWorkspaceOnSameCommit bool `json:"ignoreRunningWorkspaceOnSameCommit,omitemopty"`
2030-
IgnoreRunningPrebuild bool `json:"ignoreRunningPrebuild,omitemopty"`
2031-
AllowUsingPreviousPrebuilds bool `json:"allowUsingPreviousPrebuilds,omitemopty"`
20322020
ForceDefaultConfig bool `json:"forceDefaultConfig,omitemopty"`
20332021
}
20342022

@@ -2291,12 +2279,9 @@ type Project struct {
22912279
}
22922280

22932281
type ProjectSettings struct {
2294-
UseIncrementalPrebuilds bool `json:"useIncrementalPrebuilds,omitempty"`
2295-
UsePersistentVolumeClaim bool `json:"usePersistentVolumeClaim,omitempty"`
2296-
KeepOutdatedPrebuildsRunning bool `json:"keepOutdatedPrebuildsRunning,omitempty"`
2297-
AllowUsingPreviousPrebuilds bool `json:"allowUsingPreviousPrebuilds,omitempty"`
2298-
WorkspaceClasses *WorkspaceClassesSettings `json:"workspaceClasses,omitempty"`
2299-
PrebuildSettings *PrebuildSettings `json:"prebuilds,omitempty"`
2282+
UsePersistentVolumeClaim bool `json:"usePersistentVolumeClaim,omitempty"`
2283+
WorkspaceClasses *WorkspaceClassesSettings `json:"workspaceClasses,omitempty"`
2284+
PrebuildSettings *PrebuildSettings `json:"prebuilds,omitempty"`
23002285
}
23012286
type PrebuildSettings struct {
23022287
Enable *bool `json:"enable,omitempty"`

components/gitpod-protocol/src/gitpod-service.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,6 @@ export namespace GitpodServer {
424424
// whether running workspaces on the same context should be ignored. If false (default) users will be asked.
425425
//TODO(se) remove this option and let clients do that check if they like. The new create workspace page does it already
426426
ignoreRunningWorkspaceOnSameCommit?: boolean;
427-
ignoreRunningPrebuild?: boolean;
428-
allowUsingPreviousPrebuilds?: boolean;
429427
forceDefaultConfig?: boolean;
430428
}
431429

components/gitpod-protocol/src/protocol.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,16 +1500,7 @@ export interface WorkspaceCreationResult {
15001500
createdWorkspaceId?: string;
15011501
workspaceURL?: string;
15021502
existingWorkspaces?: WorkspaceInfo[];
1503-
runningWorkspacePrebuild?: {
1504-
prebuildID: string;
1505-
workspaceID: string;
1506-
instanceID: string;
1507-
starting: RunningWorkspacePrebuildStarting;
1508-
sameCluster: boolean;
1509-
};
1510-
runningPrebuildWorkspaceID?: string;
15111503
}
1512-
export type RunningWorkspacePrebuildStarting = "queued" | "starting" | "running";
15131504

15141505
export namespace WorkspaceCreationResult {
15151506
export function is(data: any): data is WorkspaceCreationResult {

components/gitpod-protocol/src/teams-projects-protocol.ts

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,28 @@ export interface ProjectSettings {
3636
* @deprecated see `Project.settings.prebuilds.branchMatchingPattern` instead.
3737
*/
3838
prebuildBranchPattern?: string;
39-
40-
useIncrementalPrebuilds?: boolean;
41-
keepOutdatedPrebuildsRunning?: boolean;
42-
// whether new workspaces can start on older prebuilds and incrementally update
43-
allowUsingPreviousPrebuilds?: boolean;
4439
/**
4540
* how many commits in the commit history a prebuild is good (undefined and 0 means every commit is prebuilt)
4641
*
4742
* @deprecated see `Project.settings.prebuilds.intervall` instead.
4843
*/
4944
prebuildEveryNthCommit?: number;
45+
46+
/**
47+
* @deprecated always false
48+
*/
49+
useIncrementalPrebuilds?: boolean;
50+
51+
/**
52+
* @deprecated always true (we should kill dangling prebuilds)
53+
*/
54+
keepOutdatedPrebuildsRunning?: boolean;
55+
// whether new workspaces can start on older prebuilds and incrementally update
56+
/**
57+
* @deprecated always true
58+
*/
59+
allowUsingPreviousPrebuilds?: boolean;
60+
5061
// preferred workspace classes
5162
workspaceClasses?: WorkspaceClasses;
5263
}
@@ -58,7 +69,7 @@ export interface PrebuildSettings {
5869
enable?: boolean;
5970

6071
/**
61-
* Defines an interval of commits to run new prebuilds for. Defaults to 10
72+
* Defines an interval of commits to run new prebuilds for. Defaults to 20
6273
*/
6374
prebuildInterval?: number;
6475

@@ -113,7 +124,7 @@ export namespace Project {
113124
export const PREBUILD_SETTINGS_DEFAULTS: PrebuildSettingsWithDefaults = {
114125
enable: false,
115126
branchMatchingPattern: "**",
116-
prebuildInterval: 10,
127+
prebuildInterval: 20,
117128
branchStrategy: "all-branches",
118129
};
119130

components/public-api-server/pkg/apiv1/project.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,9 @@ func projectSettingsToAPIResponse(s *protocol.ProjectSettings) *v1.ProjectSettin
168168
}
169169

170170
settings := &v1.ProjectSettings{
171-
Prebuild: &v1.PrebuildSettings{
172-
EnableIncrementalPrebuilds: s.UseIncrementalPrebuilds,
173-
KeepOutdatedPrebuildsRunning: s.KeepOutdatedPrebuildsRunning,
174-
UsePreviousPrebuilds: s.AllowUsingPreviousPrebuilds,
175-
},
171+
Prebuild: &v1.PrebuildSettings{},
176172
Workspace: &v1.WorkspaceSettings{
177-
EnablePersistentVolumeClaim: s.UsePersistentVolumeClaim,
178-
WorkspaceClass: workspaceClassesToAPIResponse(s.WorkspaceClasses),
173+
WorkspaceClass: workspaceClassesToAPIResponse(s.WorkspaceClasses),
179174
},
180175
}
181176
if s.PrebuildSettings != nil {

components/public-api-server/pkg/apiv1/project_test.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,10 +336,7 @@ func newProject(p *protocol.Project) *protocol.Project {
336336
CloneURL: "https://github.com/easyCZ/foobar",
337337
AppInstallationID: "1337",
338338
Settings: &protocol.ProjectSettings{
339-
UseIncrementalPrebuilds: true,
340-
UsePersistentVolumeClaim: true,
341-
KeepOutdatedPrebuildsRunning: true,
342-
AllowUsingPreviousPrebuilds: true,
339+
UsePersistentVolumeClaim: true,
343340
WorkspaceClasses: &protocol.WorkspaceClassesSettings{
344341
Regular: "default",
345342
Prebuild: "default",

0 commit comments

Comments
 (0)