Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: gitpod-io/gitpod
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d0decdb434bc29ed5c8517903681384f701d3a1d
Choose a base ref
..
head repository: gitpod-io/gitpod
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b6466c4e9fbefefc78dc988a65476413222dfc47
Choose a head ref
Showing with 7 additions and 6 deletions.
  1. +3 −1 components/server/src/projects/projects-service.spec.db.ts
  2. +4 −5 components/server/src/projects/projects-service.ts
4 changes: 3 additions & 1 deletion components/server/src/projects/projects-service.spec.db.ts
Original file line number Diff line number Diff line change
@@ -214,6 +214,7 @@ describe("ProjectsService", async () => {
...Project.PREBUILD_SETTINGS_DEFAULTS,
enable: false,
},
workspaceClasses: {},
});
});

@@ -238,10 +239,11 @@ describe("ProjectsService", async () => {
...Project.PREBUILD_SETTINGS_DEFAULTS,
enable: false,
},
workspaceClasses: {},
});
});

it.only("prebuild settings migration / new and active project / updated settings", async () => {
it("prebuild settings migration / new and active project / updated settings", async () => {
const ps = container.get(ProjectsService);
const cloneUrl = "https://github.com/gitpod-io/gitpod.git";
const oldProject = await createTestProject(ps, org, owner, {
9 changes: 4 additions & 5 deletions components/server/src/projects/projects-service.ts
Original file line number Diff line number Diff line change
@@ -413,7 +413,7 @@ export class ProjectsService {
}

const logCtx: any = { oldSettings: { ...project.settings } };
const newPrebuildSettings: PrebuildSettings = { enable: false };
const newPrebuildSettings: PrebuildSettings = { enable: false, ...Project.PREBUILD_SETTINGS_DEFAULTS };

// if workspaces were running in the past week
const isInactive = await this.isProjectConsideredInactive(SYSTEM_USER, project.id);
@@ -430,10 +430,6 @@ export class ProjectsService {
newPrebuildSettings.branchStrategy = !!project.settings?.prebuildBranchPattern
? "matched-branches"
: defaults.branchStrategy;
if (newPrebuildSettings.prebuildInterval! < defaults.prebuildInterval!) {
// limiting to default branch for short intervals, to avoid unwanted increase of costs.
newPrebuildSettings.branchStrategy = "default-branch";
}
newPrebuildSettings.branchMatchingPattern =
project.settings?.prebuildBranchPattern || defaults.branchMatchingPattern;
newPrebuildSettings.workspaceClass = project.settings?.workspaceClasses?.prebuild;
@@ -455,6 +451,9 @@ export class ProjectsService {
delete newSettings.prebuildBranchPattern;
delete newSettings.prebuildDefaultBranchOnly;
delete newSettings.prebuildEveryNthCommit;
delete newSettings.allowUsingPreviousPrebuilds;
delete newSettings.keepOutdatedPrebuildsRunning;
delete newSettings.useIncrementalPrebuilds;
delete newSettings.workspaceClasses?.prebuild;
await this.projectDB.updateProject({
id: project.id,