Skip to content

Update VS Code References (settings sync schema, leeway) #8077

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 1 commit into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class CodeSyncResourceDBSpec {
let manifest = await this.db.getManifest(this.userId);
expect(manifest).to.deep.eq(<IUserDataManifest>{
session: this.userId,
latest: {}
latest: {},
});

let machinesRev = await this.db.insert(this.userId, 'machines', async () => { });
Expand All @@ -94,7 +94,7 @@ export class CodeSyncResourceDBSpec {
session: this.userId,
latest: {
machines: machinesRev
}
},
});

let extensionsRev = await this.db.insert(this.userId, SyncResource.Extensions, async () => { });
Expand All @@ -104,7 +104,7 @@ export class CodeSyncResourceDBSpec {
latest: {
machines: machinesRev,
extensions: extensionsRev
}
},
});

machinesRev = await this.db.insert(this.userId, 'machines', async () => { });
Expand All @@ -114,7 +114,7 @@ export class CodeSyncResourceDBSpec {
latest: {
machines: machinesRev,
extensions: extensionsRev
}
},
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { Entity, Column, PrimaryColumn, Index } from "typeorm";
import { TypeORM } from "../typeorm";

// should be aligned with https://github.com/gitpod-io/vscode/blob/75c71b49cc25554adc408e63b876b76dcc984bc1/src/vs/platform/userDataSync/common/userDataSync.ts#L113-L156
// should be aligned with https://github.com/gitpod-io/openvscode-server/blob/a9286bef87ed21bbf108371aa1f62d9a5bc48fc4/src/vs/platform/userDataSync/common/userDataSync.ts#L110-L160
export interface IUserData {
ref: string;
content: string | null;
Expand All @@ -17,14 +17,20 @@ export const enum SyncResource {
Settings = 'settings',
Keybindings = 'keybindings',
Snippets = 'snippets',
Tasks = 'tasks',
Extensions = 'extensions',
GlobalState = 'globalState'
GlobalState = 'globalState',
}
export const ALL_SYNC_RESOURCES: SyncResource[] = [SyncResource.Settings, SyncResource.Keybindings, SyncResource.Snippets, SyncResource.Extensions, SyncResource.GlobalState];
export const ALL_SYNC_RESOURCES: SyncResource[] = [SyncResource.Settings, SyncResource.Keybindings, SyncResource.Snippets, SyncResource.Tasks, SyncResource.Extensions, SyncResource.GlobalState];

export interface IUserDataManifest {
latest: Record<ServerResource, string>
session: string;
readonly latest?: Record<ServerResource, string>;
readonly session: string;
/**
* This property reflects a weak ETag for caching code sync responses,
* in the server, this is send in the Etag header and it's calculated by Express.js or we can override it manually.
*/
//readonly ref: string;
}

export type ServerResource = SyncResource | 'machines';
Expand Down
4 changes: 2 additions & 2 deletions components/ide/code/leeway.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ARG CODE_COMMIT
RUN mkdir /gp-code \
&& cd /gp-code \
&& git init \
&& git remote add origin https://github.com/gitpod-io/vscode \
&& git remote add origin https://github.com/gitpod-io/openvscode-server \
&& git fetch origin $CODE_COMMIT --depth=1 \
&& git reset --hard FETCH_HEAD
WORKDIR /gp-code
Expand All @@ -34,7 +34,7 @@ ENV ELECTRON_SKIP_BINARY_DOWNLOAD=1
RUN mkdir /gp-code \
&& cd /gp-code \
&& git init \
&& git remote add origin https://github.com/gitpod-io/vscode \
&& git remote add origin https://github.com/gitpod-io/openvscode-server \
&& git fetch origin $CODE_COMMIT --depth=1 \
&& git reset --hard FETCH_HEAD
WORKDIR /gp-code
Expand Down
4 changes: 2 additions & 2 deletions components/server/src/code-sync/code-sync-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ export class CodeSyncService {
return;
}
const manifest = await this.db.getManifest(req.user.id);
if (!manifest.latest.extensions) {
if (manifest.latest && !manifest.latest.extensions) {
manifest.latest.extensions = fromTheiaRev;
}
if (!manifest.latest.settings) {
if (manifest.latest && !manifest.latest.settings) {
manifest.latest.settings = fromTheiaRev;
}
res.json(manifest);
Expand Down