@gitpod/gitpod-protocol 0.1.5-vn-6525.77 → 0.1.5-vn-fix-undefined-context-ref-on-jb-gateway.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/gitpod-schema.json +137 -2
- package/lib/accounting-protocol.d.ts +7 -0
- package/lib/accounting-protocol.d.ts.map +1 -1
- package/lib/accounting-protocol.js +8 -1
- package/lib/accounting-protocol.js.map +1 -1
- package/lib/env.d.ts +0 -5
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +1 -20
- package/lib/env.js.map +1 -1
- package/lib/gitpod-service.d.ts +5 -1
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +8 -7
- package/lib/gitpod-service.js.map +1 -1
- package/lib/license-protocol.d.ts +7 -0
- package/lib/license-protocol.d.ts.map +1 -1
- package/lib/license-protocol.js.map +1 -1
- package/lib/messaging/error.d.ts +1 -0
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +2 -0
- package/lib/messaging/error.js.map +1 -1
- package/lib/protocol.d.ts +34 -4
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +89 -10
- package/lib/protocol.js.map +1 -1
- package/lib/team-subscription-protocol.d.ts +15 -0
- package/lib/team-subscription-protocol.d.ts.map +1 -1
- package/lib/team-subscription-protocol.js +12 -1
- package/lib/team-subscription-protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +4 -0
- package/lib/teams-projects-protocol.d.ts.map +1 -1
- package/lib/teams-projects-protocol.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts +5 -0
- package/lib/util/generate-workspace-id.d.ts.map +1 -1
- package/lib/util/generate-workspace-id.js +12 -8
- package/lib/util/generate-workspace-id.js.map +1 -1
- package/lib/util/generate-workspace-id.spec.js +10 -3
- package/lib/util/generate-workspace-id.spec.js.map +1 -1
- package/lib/util/logging.js +1 -1
- package/lib/util/logging.js.map +1 -1
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +8 -10
- package/lib/util/tracing.js.map +1 -1
- package/lib/workspace-instance.d.ts +6 -1
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/wsready.js +1 -1
- package/package.json +1 -1
- package/pkg-yarn.lock +1 -1
- package/provenance-bundle.jsonl +1 -1
- package/src/accounting-protocol.ts +10 -0
- package/src/env.ts +0 -22
- package/src/gitpod-service.ts +18 -8
- package/src/license-protocol.ts +7 -0
- package/src/messaging/error.ts +3 -0
- package/src/protocol.ts +113 -9
- package/src/team-subscription-protocol.ts +23 -0
- package/src/teams-projects-protocol.ts +5 -0
- package/src/util/generate-workspace-id.spec.ts +10 -3
- package/src/util/generate-workspace-id.ts +9 -3
- package/src/util/logging.ts +0 -1
- package/src/util/tracing.ts +8 -10
- package/src/workspace-instance.ts +13 -1
- package/src/wsready.ts +1 -1
package/src/gitpod-service.ts
CHANGED
|
@@ -47,7 +47,12 @@ import { LicenseService } from "./license-protocol";
|
|
|
47
47
|
import { Emitter } from "./util/event";
|
|
48
48
|
import { AccountStatement, CreditAlert } from "./accounting-protocol";
|
|
49
49
|
import { GithubUpgradeURL, PlanCoupon } from "./payment-protocol";
|
|
50
|
-
import {
|
|
50
|
+
import {
|
|
51
|
+
TeamSubscription,
|
|
52
|
+
TeamSubscription2,
|
|
53
|
+
TeamSubscriptionSlot,
|
|
54
|
+
TeamSubscriptionSlotResolved,
|
|
55
|
+
} from "./team-subscription-protocol";
|
|
51
56
|
import { RemotePageMessage, RemoteTrackMessage, RemoteIdentifyMessage } from "./analytics";
|
|
52
57
|
import { IDEServer } from "./ide-protocol";
|
|
53
58
|
import { InstallationAdminSettings, TelemetryData } from "./installation-admin-protocol";
|
|
@@ -189,6 +194,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
189
194
|
|
|
190
195
|
// misc
|
|
191
196
|
sendFeedback(feedback: string): Promise<string | undefined>;
|
|
197
|
+
isGitHubAppEnabled(): Promise<boolean>;
|
|
192
198
|
registerGithubApp(installationId: string): Promise<void>;
|
|
193
199
|
|
|
194
200
|
/**
|
|
@@ -234,7 +240,9 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
234
240
|
*/
|
|
235
241
|
getChargebeeSiteId(): Promise<string>;
|
|
236
242
|
createPortalSession(): Promise<{}>;
|
|
243
|
+
createTeamPortalSession(teamId: string): Promise<{}>;
|
|
237
244
|
checkout(planId: string, planQuantity?: number): Promise<{}>;
|
|
245
|
+
teamCheckout(teamId: string, planId: string): Promise<{}>;
|
|
238
246
|
getAvailableCoupons(): Promise<PlanCoupon[]>;
|
|
239
247
|
getAppliedCoupons(): Promise<PlanCoupon[]>;
|
|
240
248
|
|
|
@@ -246,6 +254,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
246
254
|
subscriptionCancel(subscriptionId: string): Promise<void>;
|
|
247
255
|
subscriptionCancelDowngrade(subscriptionId: string): Promise<void>;
|
|
248
256
|
|
|
257
|
+
getTeamSubscription(teamId: string): Promise<TeamSubscription2 | undefined>;
|
|
249
258
|
tsGet(): Promise<TeamSubscription[]>;
|
|
250
259
|
tsGetSlots(): Promise<TeamSubscriptionSlotResolved[]>;
|
|
251
260
|
tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined>;
|
|
@@ -529,13 +538,14 @@ const hasWindow = typeof window !== "undefined";
|
|
|
529
538
|
const phasesOrder: Record<WorkspaceInstancePhase, number> = {
|
|
530
539
|
unknown: 0,
|
|
531
540
|
preparing: 1,
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
541
|
+
building: 2,
|
|
542
|
+
pending: 3,
|
|
543
|
+
creating: 4,
|
|
544
|
+
initializing: 5,
|
|
545
|
+
running: 6,
|
|
546
|
+
interrupted: 7,
|
|
547
|
+
stopping: 8,
|
|
548
|
+
stopped: 9,
|
|
539
549
|
};
|
|
540
550
|
export class WorkspaceInstanceUpdateListener {
|
|
541
551
|
private readonly onDidChangeEmitter = new Emitter<void>();
|
package/src/license-protocol.ts
CHANGED
|
@@ -15,9 +15,15 @@ export type LicenseIssue = "seats-exhausted";
|
|
|
15
15
|
export interface LicenseInfo {
|
|
16
16
|
key: string;
|
|
17
17
|
seats: number;
|
|
18
|
+
userCount?: number;
|
|
18
19
|
valid: boolean;
|
|
19
20
|
validUntil: string;
|
|
20
21
|
plan?: string;
|
|
22
|
+
features?: string[];
|
|
23
|
+
enabledFeatures?: string[];
|
|
24
|
+
type?: string;
|
|
25
|
+
errorMsg?: string;
|
|
26
|
+
fallbackAllowed: boolean;
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
export interface GetLicenseInfoResult {
|
|
@@ -33,5 +39,6 @@ export enum LicenseFeature {
|
|
|
33
39
|
export interface LicenseService {
|
|
34
40
|
validateLicense(): Promise<LicenseValidationResult>;
|
|
35
41
|
getLicenseInfo(): Promise<GetLicenseInfoResult>;
|
|
42
|
+
adminGetLicense(): Promise<LicenseInfo>;
|
|
36
43
|
licenseIncludesFeature(feature: LicenseFeature): Promise<boolean>;
|
|
37
44
|
}
|
package/src/messaging/error.ts
CHANGED
package/src/protocol.ts
CHANGED
|
@@ -68,13 +68,19 @@ export namespace User {
|
|
|
68
68
|
});
|
|
69
69
|
return res;
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Tries to return the primaryEmail of the first identity this user signed up with.
|
|
74
|
+
* @param user
|
|
75
|
+
* @returns A primaryEmail, or undefined if there is none.
|
|
76
|
+
*/
|
|
77
|
+
export function getPrimaryEmail(user: User): string | undefined {
|
|
72
78
|
const identities = user.identities.filter((i) => !!i.primaryEmail);
|
|
73
79
|
if (identities.length <= 0) {
|
|
74
|
-
|
|
80
|
+
return undefined;
|
|
75
81
|
}
|
|
76
82
|
|
|
77
|
-
return identities[0].primaryEmail
|
|
83
|
+
return identities[0].primaryEmail || undefined;
|
|
78
84
|
}
|
|
79
85
|
export function getName(user: User): string | undefined {
|
|
80
86
|
const name = user.fullName || user.name;
|
|
@@ -89,6 +95,47 @@ export namespace User {
|
|
|
89
95
|
}
|
|
90
96
|
return undefined;
|
|
91
97
|
}
|
|
98
|
+
|
|
99
|
+
export function hasPreferredIde(user: User) {
|
|
100
|
+
return (
|
|
101
|
+
typeof user?.additionalData?.ideSettings?.defaultIde !== "undefined" ||
|
|
102
|
+
typeof user?.additionalData?.ideSettings?.useLatestVersion !== "undefined"
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function isOnboardingUser(user: User) {
|
|
107
|
+
return !hasPreferredIde(user);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function migrationIDESettings(user: User) {
|
|
111
|
+
if (
|
|
112
|
+
!user?.additionalData?.ideSettings ||
|
|
113
|
+
Object.keys(user.additionalData.ideSettings).length === 0 ||
|
|
114
|
+
user.additionalData.ideSettings.settingVersion === "2.0"
|
|
115
|
+
) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const newIDESettings: IDESettings = {
|
|
119
|
+
settingVersion: "2.0",
|
|
120
|
+
};
|
|
121
|
+
const ideSettings = user.additionalData.ideSettings;
|
|
122
|
+
if (ideSettings.useDesktopIde) {
|
|
123
|
+
if (ideSettings.defaultDesktopIde === "code-desktop") {
|
|
124
|
+
newIDESettings.defaultIde = "code-desktop";
|
|
125
|
+
} else if (ideSettings.defaultDesktopIde === "code-desktop-insiders") {
|
|
126
|
+
newIDESettings.defaultIde = "code-desktop";
|
|
127
|
+
newIDESettings.useLatestVersion = true;
|
|
128
|
+
} else {
|
|
129
|
+
newIDESettings.defaultIde = ideSettings.defaultDesktopIde;
|
|
130
|
+
newIDESettings.useLatestVersion = ideSettings.useLatestVersion;
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
const useLatest = ideSettings.defaultIde === "code-latest";
|
|
134
|
+
newIDESettings.defaultIde = "code";
|
|
135
|
+
newIDESettings.useLatestVersion = useLatest;
|
|
136
|
+
}
|
|
137
|
+
user.additionalData.ideSettings = newIDESettings;
|
|
138
|
+
}
|
|
92
139
|
}
|
|
93
140
|
|
|
94
141
|
export interface AdditionalUserData {
|
|
@@ -115,8 +162,11 @@ export interface EmailNotificationSettings {
|
|
|
115
162
|
}
|
|
116
163
|
|
|
117
164
|
export type IDESettings = {
|
|
165
|
+
settingVersion?: string;
|
|
118
166
|
defaultIde?: string;
|
|
167
|
+
// DEPRECATED: Use defaultIde after `settingVersion: 2.0`, no more specialify desktop or browser.
|
|
119
168
|
useDesktopIde?: boolean;
|
|
169
|
+
// DEPRECATED: Same with useDesktopIde.
|
|
120
170
|
defaultDesktopIde?: string;
|
|
121
171
|
useLatestVersion?: boolean;
|
|
122
172
|
};
|
|
@@ -182,6 +232,45 @@ export interface UserEnvVar extends UserEnvVarValue {
|
|
|
182
232
|
}
|
|
183
233
|
|
|
184
234
|
export namespace UserEnvVar {
|
|
235
|
+
/**
|
|
236
|
+
* @param variable
|
|
237
|
+
* @returns Either a string containing an error message or undefined.
|
|
238
|
+
*/
|
|
239
|
+
export function validate(variable: UserEnvVarValue): string | undefined {
|
|
240
|
+
const name = variable.name;
|
|
241
|
+
const pattern = variable.repositoryPattern;
|
|
242
|
+
if (name.trim() === "") {
|
|
243
|
+
return "Name must not be empty.";
|
|
244
|
+
}
|
|
245
|
+
if (name.length > 255) {
|
|
246
|
+
return "Name too long. Maximum name length is 255 characters.";
|
|
247
|
+
}
|
|
248
|
+
if (!/^[a-zA-Z_]+[a-zA-Z0-9_]*$/.test(name)) {
|
|
249
|
+
return "Name must match /^[a-zA-Z_]+[a-zA-Z0-9_]*$/.";
|
|
250
|
+
}
|
|
251
|
+
if (variable.value.trim() === "") {
|
|
252
|
+
return "Value must not be empty.";
|
|
253
|
+
}
|
|
254
|
+
if (variable.value.length > 32767) {
|
|
255
|
+
return "Value too long. Maximum value length is 32767 characters.";
|
|
256
|
+
}
|
|
257
|
+
if (pattern.trim() === "") {
|
|
258
|
+
return "Scope must not be empty.";
|
|
259
|
+
}
|
|
260
|
+
const split = pattern.split("/");
|
|
261
|
+
if (split.length < 2) {
|
|
262
|
+
return "A scope must use the form 'organization/repo'.";
|
|
263
|
+
}
|
|
264
|
+
for (const name of split) {
|
|
265
|
+
if (name !== "*") {
|
|
266
|
+
if (!/^[a-zA-Z0-9_\-.\*]+$/.test(name)) {
|
|
267
|
+
return "Invalid scope segment. Only ASCII characters, numbers, -, _, . or * are allowed.";
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return undefined;
|
|
272
|
+
}
|
|
273
|
+
|
|
185
274
|
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
186
275
|
export function normalizeRepoPattern(pattern: string) {
|
|
187
276
|
return pattern.toLocaleLowerCase();
|
|
@@ -399,6 +488,12 @@ export interface Snapshot {
|
|
|
399
488
|
message?: string;
|
|
400
489
|
}
|
|
401
490
|
|
|
491
|
+
export interface VolumeSnapshot {
|
|
492
|
+
id: string;
|
|
493
|
+
creationTime: string;
|
|
494
|
+
volumeHandle: string;
|
|
495
|
+
}
|
|
496
|
+
|
|
402
497
|
export type SnapshotState = "pending" | "available" | "error";
|
|
403
498
|
|
|
404
499
|
export interface LayoutData {
|
|
@@ -536,6 +631,19 @@ export interface VSCodeConfig {
|
|
|
536
631
|
extensions?: string[];
|
|
537
632
|
}
|
|
538
633
|
|
|
634
|
+
export interface JetBrainsConfig {
|
|
635
|
+
intellij?: JetBrainsProductConfig;
|
|
636
|
+
goland?: JetBrainsProductConfig;
|
|
637
|
+
pycharm?: JetBrainsProductConfig;
|
|
638
|
+
phpstorm?: JetBrainsProductConfig;
|
|
639
|
+
}
|
|
640
|
+
export interface JetBrainsProductConfig {
|
|
641
|
+
prebuilds?: JetBrainsPrebuilds;
|
|
642
|
+
}
|
|
643
|
+
export interface JetBrainsPrebuilds {
|
|
644
|
+
version?: "stable" | "latest" | "both";
|
|
645
|
+
}
|
|
646
|
+
|
|
539
647
|
export interface RepositoryCloneInformation {
|
|
540
648
|
url: string;
|
|
541
649
|
checkoutLocation?: string;
|
|
@@ -552,6 +660,7 @@ export interface WorkspaceConfig {
|
|
|
552
660
|
gitConfig?: { [config: string]: string };
|
|
553
661
|
github?: GithubAppConfig;
|
|
554
662
|
vscode?: VSCodeConfig;
|
|
663
|
+
jetbrains?: JetBrainsConfig;
|
|
555
664
|
|
|
556
665
|
/** deprecated. Enabled by default **/
|
|
557
666
|
experimentalNetwork?: boolean;
|
|
@@ -769,6 +878,7 @@ export namespace ExternalImageConfigFile {
|
|
|
769
878
|
|
|
770
879
|
export interface WorkspaceContext {
|
|
771
880
|
title: string;
|
|
881
|
+
ref?: string;
|
|
772
882
|
/** This contains the URL portion of the contextURL (which might contain other modifiers as well). It's optional because it's not set for older workspaces. */
|
|
773
883
|
normalizedContextURL?: string;
|
|
774
884
|
forceCreateNewWorkspace?: boolean;
|
|
@@ -1150,12 +1260,6 @@ export interface AuthProviderInfo {
|
|
|
1150
1260
|
};
|
|
1151
1261
|
}
|
|
1152
1262
|
|
|
1153
|
-
export namespace AuthProviderInfo {
|
|
1154
|
-
export function isGitHubEnterprise(info?: AuthProviderInfo): boolean {
|
|
1155
|
-
return !!info && info.authProviderType === "GitHub" && info.host !== "github.com";
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
|
-
|
|
1159
1263
|
export interface AuthProviderEntry {
|
|
1160
1264
|
readonly id: string;
|
|
1161
1265
|
readonly type: AuthProviderEntry.Type;
|
|
@@ -33,6 +33,29 @@ export namespace TeamSubscription {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
export interface TeamSubscription2 {
|
|
37
|
+
id: string;
|
|
38
|
+
teamId: string;
|
|
39
|
+
planId: string;
|
|
40
|
+
startDate: string;
|
|
41
|
+
endDate?: string;
|
|
42
|
+
quantity: number;
|
|
43
|
+
/** The Chargebee subscription id */
|
|
44
|
+
paymentReference: string;
|
|
45
|
+
cancellationDate?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export namespace TeamSubscription2 {
|
|
49
|
+
export const create = (ts2: Omit<TeamSubscription2, "id">): TeamSubscription2 => {
|
|
50
|
+
const withId = ts2 as TeamSubscription2;
|
|
51
|
+
withId.id = uuidv4();
|
|
52
|
+
return withId;
|
|
53
|
+
};
|
|
54
|
+
export const isActive = (ts2: TeamSubscription2, date: string): boolean => {
|
|
55
|
+
return ts2.startDate <= date && (ts2.endDate === undefined || date < ts2.endDate);
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
36
59
|
/**
|
|
37
60
|
* A slot represents one unit of a TeamSubscription that gets assigned to one user at a time
|
|
38
61
|
*/
|
|
@@ -69,6 +69,11 @@ export namespace Project {
|
|
|
69
69
|
|
|
70
70
|
export type PartialProject = DeepPartial<Project> & Pick<Project, "id">;
|
|
71
71
|
|
|
72
|
+
export interface ProjectUsage {
|
|
73
|
+
lastWebhookReceived: string;
|
|
74
|
+
lastWorkspaceStart: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
72
77
|
export interface PrebuildWithStatus {
|
|
73
78
|
info: PrebuildInfo;
|
|
74
79
|
status: PrebuiltWorkspaceState;
|
|
@@ -14,7 +14,7 @@ const expect = chai.expect;
|
|
|
14
14
|
@suite
|
|
15
15
|
class TestGenerateWorkspaceId {
|
|
16
16
|
@test public async testGenerateWorkspaceId() {
|
|
17
|
-
for (let i = 0; i <
|
|
17
|
+
for (let i = 0; i < 10; i++) {
|
|
18
18
|
const id = await generateWorkspaceID();
|
|
19
19
|
expect(new GitpodHostUrl().withWorkspacePrefix(id, "eu").workspaceId).to.equal(id);
|
|
20
20
|
}
|
|
@@ -32,13 +32,20 @@ class TestGenerateWorkspaceId {
|
|
|
32
32
|
["foo", "bar", "foo-bar-"],
|
|
33
33
|
["f", "bar", ".{2,16}-bar-"],
|
|
34
34
|
["gitpod-io", "gitpod", "gitpodio-gitpod-"],
|
|
35
|
+
["breatheco-de", "python-flask-api-tutorial", "breathecode-pythonflask-"],
|
|
36
|
+
["short", "muchlongerthaneleven", "short-muchlongerthanel-"],
|
|
37
|
+
["muchlongerthaneleven", "short", "muchlongerthanel-short-"],
|
|
35
38
|
[
|
|
36
39
|
'this is rather long and has some "§$"% special chars',
|
|
37
40
|
"also here pretty long and needs abbreviation",
|
|
38
|
-
"
|
|
41
|
+
"thisisrathe-alsoherepre-",
|
|
39
42
|
],
|
|
40
|
-
["breatheco-de", "python-flask-api-tutorial", "breathecode-pythonflaska-"],
|
|
41
43
|
["UPPER", "CaSe", "upper-case-"],
|
|
44
|
+
[
|
|
45
|
+
"superlongfirstsegment",
|
|
46
|
+
"---------",
|
|
47
|
+
"superlong" /* we don't mantch for the whole first segment, because it has different length depending on the animal that is used to replace the -------*/,
|
|
48
|
+
],
|
|
42
49
|
];
|
|
43
50
|
for (const d of data) {
|
|
44
51
|
const id = await generateWorkspaceID(d[0], d[1]);
|
|
@@ -3,15 +3,19 @@
|
|
|
3
3
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
4
|
* See License-AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
|
+
|
|
6
7
|
import randomNumber = require("random-number-csprng");
|
|
7
8
|
|
|
8
9
|
export async function generateWorkspaceID(firstSegment?: string, secondSegment?: string): Promise<string> {
|
|
9
10
|
const firstSeg = clean(firstSegment) || (await random(colors));
|
|
10
|
-
const secSeg = clean(secondSegment
|
|
11
|
-
|
|
11
|
+
const secSeg = clean(secondSegment) || (await random(animals));
|
|
12
|
+
function fit(makeFit: string, otherSeg: string) {
|
|
13
|
+
return makeFit.substring(0, Math.max(segLength, 2 * segLength - otherSeg.length));
|
|
14
|
+
}
|
|
15
|
+
return fit(firstSeg, secSeg) + "-" + fit(secSeg, firstSeg) + "-" + (await random(characters, segLength));
|
|
12
16
|
}
|
|
13
17
|
|
|
14
|
-
function clean(segment: string | undefined, maxChars: number =
|
|
18
|
+
function clean(segment: string | undefined, maxChars: number = 16) {
|
|
15
19
|
if (!segment) {
|
|
16
20
|
return undefined;
|
|
17
21
|
}
|
|
@@ -35,6 +39,8 @@ async function random(array: string[], length: number = 1): Promise<string> {
|
|
|
35
39
|
return result;
|
|
36
40
|
}
|
|
37
41
|
|
|
42
|
+
const segLength = 11;
|
|
43
|
+
|
|
38
44
|
const characters = "abcdefghijklmnopqrstuvwxyz0123456789".split("");
|
|
39
45
|
|
|
40
46
|
export const colors = [
|
package/src/util/logging.ts
CHANGED
package/src/util/tracing.ts
CHANGED
|
@@ -22,17 +22,15 @@ export type TraceContextWithSpan = TraceContext & {
|
|
|
22
22
|
export namespace TraceContext {
|
|
23
23
|
export function startSpan(operation: string, parentCtx?: TraceContext): opentracing.Span {
|
|
24
24
|
const options: opentracing.SpanOptions = {};
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
|
|
26
|
+
// references should contain span id.
|
|
27
|
+
// cf. https://github.com/jaegertracing/jaeger-client-node/issues/432
|
|
28
|
+
if (!!parentCtx?.span) {
|
|
29
|
+
const ctx = parentCtx?.span?.context();
|
|
30
|
+
if (ctx && !!ctx.toTraceId() && !!ctx.toSpanId()) {
|
|
31
|
+
options.references = [opentracing.followsFrom(ctx)];
|
|
32
|
+
}
|
|
27
33
|
}
|
|
28
|
-
// TODO(gpl) references lead to a huge amount of errors in prod logs. Avoid those until we have time to figure out how to fix it.
|
|
29
|
-
// if (referencedSpans) {
|
|
30
|
-
// // note: allthough followsForm's type says it takes 'opentracing.Span | opentracing.SpanContext', it only works with SpanContext (typing mismatch)
|
|
31
|
-
// // note2: we need to filter out debug spans (spanId === "")
|
|
32
|
-
// options.references = referencedSpans.filter(s => s !== undefined)
|
|
33
|
-
// .filter(s => !!s!.context().toSpanId())
|
|
34
|
-
// .map(s => followsFrom(s!.context()));
|
|
35
|
-
// }
|
|
36
34
|
|
|
37
35
|
return opentracing.globalTracer().startSpan(operation, options);
|
|
38
36
|
}
|
|
@@ -98,9 +98,13 @@ export type WorkspaceInstancePhase =
|
|
|
98
98
|
| "unknown"
|
|
99
99
|
|
|
100
100
|
// Preparing means that we haven't actually started the workspace instance just yet, but rather
|
|
101
|
-
// are still preparing for launch.
|
|
101
|
+
// are still preparing for launch.
|
|
102
102
|
| "preparing"
|
|
103
103
|
|
|
104
|
+
// Building means that we are building the Docker image for the workspace. A workspace will enter this phase only
|
|
105
|
+
// if an image build is required for that workspace.
|
|
106
|
+
| "building"
|
|
107
|
+
|
|
104
108
|
// Pending means the workspace does not yet consume resources in the cluster, but rather is looking for
|
|
105
109
|
// some space within the cluster. If for example the cluster needs to scale up to accomodate the
|
|
106
110
|
// workspace, the workspace will be in Pending state until that happened.
|
|
@@ -204,6 +208,12 @@ export interface WorkspaceInstanceRepoStatus {
|
|
|
204
208
|
totalUnpushedCommits?: number;
|
|
205
209
|
}
|
|
206
210
|
|
|
211
|
+
// ConfigurationIdeConfig ide config of WorkspaceInstanceConfiguration
|
|
212
|
+
export interface ConfigurationIdeConfig {
|
|
213
|
+
useLatest?: boolean;
|
|
214
|
+
desktopIdeAlias?: string;
|
|
215
|
+
}
|
|
216
|
+
|
|
207
217
|
// WorkspaceInstanceConfiguration contains all per-instance configuration
|
|
208
218
|
export interface WorkspaceInstanceConfiguration {
|
|
209
219
|
// theiaVersion is the version of Theia this workspace instance uses
|
|
@@ -221,6 +231,8 @@ export interface WorkspaceInstanceConfiguration {
|
|
|
221
231
|
|
|
222
232
|
// supervisorImage is the ref of the supervisor image this instance uses.
|
|
223
233
|
supervisorImage?: string;
|
|
234
|
+
|
|
235
|
+
ideConfig?: ConfigurationIdeConfig;
|
|
224
236
|
}
|
|
225
237
|
|
|
226
238
|
/**
|
package/src/wsready.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* See License-AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
// generated using github.com/32leaves/bel on 2022-
|
|
7
|
+
// generated using github.com/32leaves/bel on 2022-05-18 18:19:49.011672619 +0000 UTC m=+0.006607361
|
|
8
8
|
// DO NOT MODIFY
|
|
9
9
|
|
|
10
10
|
export enum WorkspaceInitSource {
|