@gitpod/gitpod-protocol 0.1.5-se-github-app-check-7518.1 → 0.1.5-se-multi-repo.11

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.
Files changed (86) hide show
  1. package/data/gitpod-schema.json +28 -2
  2. package/lib/admin-protocol.d.ts +10 -0
  3. package/lib/admin-protocol.d.ts.map +1 -1
  4. package/lib/admin-protocol.js.map +1 -1
  5. package/lib/context-url.d.ts +1 -0
  6. package/lib/context-url.d.ts.map +1 -1
  7. package/lib/context-url.js +3 -1
  8. package/lib/context-url.js.map +1 -1
  9. package/lib/gitpod-service.d.ts +13 -2
  10. package/lib/gitpod-service.d.ts.map +1 -1
  11. package/lib/gitpod-service.js +4 -2
  12. package/lib/gitpod-service.js.map +1 -1
  13. package/lib/ide-protocol.d.ts +20 -0
  14. package/lib/ide-protocol.d.ts.map +1 -1
  15. package/lib/index.d.ts +1 -0
  16. package/lib/index.d.ts.map +1 -1
  17. package/lib/index.js +1 -0
  18. package/lib/index.js.map +1 -1
  19. package/lib/installation-admin-protocol.d.ts +21 -0
  20. package/lib/installation-admin-protocol.d.ts.map +1 -0
  21. package/lib/installation-admin-protocol.js +30 -0
  22. package/lib/installation-admin-protocol.js.map +1 -0
  23. package/lib/messaging/error.d.ts +1 -0
  24. package/lib/messaging/error.d.ts.map +1 -1
  25. package/lib/messaging/error.js +2 -0
  26. package/lib/messaging/error.js.map +1 -1
  27. package/lib/messaging/node/connection.d.ts +1 -7
  28. package/lib/messaging/node/connection.d.ts.map +1 -1
  29. package/lib/messaging/node/connection.js +20 -18
  30. package/lib/messaging/node/connection.js.map +1 -1
  31. package/lib/permission.d.ts +4 -1
  32. package/lib/permission.d.ts.map +1 -1
  33. package/lib/permission.js +4 -0
  34. package/lib/permission.js.map +1 -1
  35. package/lib/protocol.d.ts +52 -37
  36. package/lib/protocol.d.ts.map +1 -1
  37. package/lib/protocol.js +42 -3
  38. package/lib/protocol.js.map +1 -1
  39. package/lib/teams-projects-protocol.d.ts +3 -0
  40. package/lib/teams-projects-protocol.d.ts.map +1 -1
  41. package/lib/teams-projects-protocol.js +7 -0
  42. package/lib/teams-projects-protocol.js.map +1 -1
  43. package/lib/util/generate-workspace-id.d.ts.map +1 -1
  44. package/lib/util/generate-workspace-id.js +1 -0
  45. package/lib/util/generate-workspace-id.js.map +1 -1
  46. package/lib/util/generate-workspace-id.spec.js +1 -0
  47. package/lib/util/generate-workspace-id.spec.js.map +1 -1
  48. package/lib/util/gitpod-host-url.d.ts +0 -1
  49. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  50. package/lib/util/gitpod-host-url.js +0 -3
  51. package/lib/util/gitpod-host-url.js.map +1 -1
  52. package/lib/util/tracing.d.ts +1 -0
  53. package/lib/util/tracing.d.ts.map +1 -1
  54. package/lib/util/tracing.js +24 -2
  55. package/lib/util/tracing.js.map +1 -1
  56. package/lib/workspace-cluster.d.ts +3 -6
  57. package/lib/workspace-cluster.d.ts.map +1 -1
  58. package/lib/workspace-cluster.js.map +1 -1
  59. package/lib/workspace-instance.d.ts +19 -0
  60. package/lib/workspace-instance.d.ts.map +1 -1
  61. package/lib/wsready.d.ts +4 -4
  62. package/lib/wsready.d.ts.map +1 -1
  63. package/lib/wsready.js +1 -3
  64. package/lib/wsready.js.map +1 -1
  65. package/package.json +1 -1
  66. package/pkg-yarn.lock +1 -1
  67. package/provenance-bundle.jsonl +1 -1
  68. package/src/admin-protocol.ts +17 -4
  69. package/src/context-url.ts +3 -1
  70. package/src/gitpod-service.ts +21 -6
  71. package/src/ide-frontend-service.ts +1 -1
  72. package/src/ide-protocol.ts +22 -0
  73. package/src/index.ts +1 -0
  74. package/src/installation-admin-protocol.ts +35 -0
  75. package/src/messaging/error.ts +3 -0
  76. package/src/messaging/node/connection.ts +20 -23
  77. package/src/permission.ts +5 -0
  78. package/src/protocol.ts +81 -40
  79. package/src/teams-projects-protocol.ts +7 -1
  80. package/src/util/generate-workspace-id.spec.ts +1 -0
  81. package/src/util/generate-workspace-id.ts +1 -0
  82. package/src/util/gitpod-host-url.ts +1 -5
  83. package/src/util/tracing.ts +23 -2
  84. package/src/workspace-cluster.ts +2 -7
  85. package/src/workspace-instance.ts +20 -0
  86. package/src/wsready.ts +6 -5
@@ -7,7 +7,7 @@
7
7
  import { Event } from "./util/event";
8
8
  import { Disposable } from "./util/disposable";
9
9
 
10
- export type IDEFrontendState = 'init' | 'ready' | 'terminated';
10
+ export type IDEFrontendState = 'init' | 'ready' | 'terminated';
11
11
 
12
12
  export interface IDEFrontendService {
13
13
  readonly state: IDEFrontendState;
@@ -29,6 +29,28 @@ export interface IDEOptions {
29
29
  * The default desktop IDE when the user has not specified one.
30
30
  */
31
31
  defaultDesktopIde: string;
32
+
33
+ /**
34
+ * Client specific IDE options.
35
+ */
36
+ clients?: { [id: string]: IDEClient };
37
+ }
38
+
39
+ export interface IDEClient {
40
+ /**
41
+ * The default desktop IDE when the user has not specified one.
42
+ */
43
+ defaultDesktopIDE?: string;
44
+
45
+ /**
46
+ * Desktop IDEs supported by the client.
47
+ */
48
+ desktopIDEs?: string[]
49
+
50
+ /**
51
+ * Steps to install the client on user machine.
52
+ */
53
+ installationSteps?: string[]
32
54
  }
33
55
 
34
56
  export interface IDEOption {
package/src/index.ts CHANGED
@@ -19,3 +19,4 @@ export * from './context-url';
19
19
  export * from './teams-projects-protocol';
20
20
  export * from './snapshot-url';
21
21
  export * from './oss-allowlist';
22
+ export * from './installation-admin-protocol';
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Copyright (c) 2022 Gitpod GmbH. All rights reserved.
3
+ * Licensed under the GNU Affero General Public License (AGPL).
4
+ * See License-AGPL.txt in the project root for license information.
5
+ */
6
+
7
+ import { v4 as uuidv4 } from 'uuid';
8
+
9
+ const InstallationAdminSettingsPrototype = {
10
+ sendTelemetry: true
11
+ }
12
+
13
+ export type InstallationAdminSettings = typeof InstallationAdminSettingsPrototype;
14
+
15
+ export namespace InstallationAdminSettings {
16
+ export function fields(): (keyof InstallationAdminSettings)[] {
17
+ return Object.keys(InstallationAdminSettingsPrototype) as (keyof InstallationAdminSettings)[];
18
+ }
19
+ }
20
+
21
+ export interface InstallationAdmin {
22
+ id: string;
23
+ settings: InstallationAdminSettings;
24
+ }
25
+
26
+ export namespace InstallationAdmin {
27
+ export function createDefault(): InstallationAdmin {
28
+ return {
29
+ id: uuidv4(),
30
+ settings: {
31
+ ...InstallationAdminSettingsPrototype,
32
+ }
33
+ };
34
+ }
35
+ }
@@ -78,4 +78,7 @@ export namespace ErrorCodes {
78
78
 
79
79
  // 630 Snapshot Error
80
80
  export const SNAPSHOT_ERROR = 630;
81
+
82
+ // 640 Headless logs are not available (yet)
83
+ export const HEADLESS_LOG_NOT_YET_AVAILABLE = 640;
81
84
  }
@@ -6,37 +6,34 @@
6
6
  */
7
7
 
8
8
  import * as ws from "ws";
9
- import * as http from "http";
10
- import * as net from "net";
11
9
  import { IWebSocket } from "vscode-ws-jsonrpc";
12
- import { log } from '../../util/logging';
13
10
 
14
- export interface OnOpen {
15
- (webSocket: ws, request: http.IncomingMessage, socket: net.Socket, head: Buffer): void;
16
- }
17
-
18
- export function toIWebSocket(webSocket: ws) {
19
- let sendsAfterOpen = 0;
11
+ export function toIWebSocket(ws: ws) {
20
12
  return <IWebSocket>{
21
13
  send: content => {
22
- if (webSocket.readyState !== ws.OPEN) {
23
- if (sendsAfterOpen++ > 3) {
24
- //log.debug(`Repeated try to send on closed web socket (readyState was ${webSocket.readyState})`, { ws });
25
- }
14
+ if (ws.readyState >= ws.CLOSING) {
15
+ // ws is already CLOSING/CLOSED, send() would just return an error.
26
16
  return;
27
17
  }
28
- webSocket.send(content, err => {
29
- if (err) {
30
- log.error('error in ws.send()', err, { ws });
31
- }
32
- })
18
+
19
+ // in general send-errors should trigger an 'error' event already, we just make sure it actually happens.
20
+ try {
21
+ ws.send(content, err => {
22
+ if (!err) {
23
+ return;
24
+ }
25
+ ws.emit('error', err);
26
+ });
27
+ } catch (err) {
28
+ ws.emit('error', err);
29
+ }
33
30
  },
34
- onMessage: cb => webSocket.on('message', cb),
35
- onError: cb => webSocket.on('error', cb),
36
- onClose: cb => webSocket.on('close', cb),
31
+ onMessage: cb => ws.on('message', cb),
32
+ onError: cb => ws.on('error', cb),
33
+ onClose: cb => ws.on('close', cb),
37
34
  dispose: () => {
38
- if (webSocket.readyState < ws.CLOSING) {
39
- webSocket.close();
35
+ if (ws.readyState < ws.CLOSING) {
36
+ ws.close();
40
37
  }
41
38
  }
42
39
  };
package/src/permission.ts CHANGED
@@ -13,6 +13,7 @@ export const Permissions = {
13
13
  "registry-access": undefined,
14
14
  "admin-users": undefined,
15
15
  "admin-workspaces": undefined,
16
+ "admin-projects": undefined,
16
17
  "admin-api": undefined,
17
18
  "ide-settings": undefined,
18
19
  "new-workspace-cluster": undefined,
@@ -50,6 +51,9 @@ export namespace Permission {
50
51
  /** The permission for accessing all workspace data */
51
52
  export const ADMIN_WORKSPACES: PermissionName = "admin-workspaces";
52
53
 
54
+ /** The permission for accessing all projects data */
55
+ export const ADMIN_PROJECTS: PermissionName = "admin-projects";
56
+
53
57
  /** The permission to access the admin API */
54
58
  export const ADMIN_API: PermissionName = "admin-api";
55
59
 
@@ -94,6 +98,7 @@ export namespace Role {
94
98
  permissions: [
95
99
  Permission.ADMIN_USERS,
96
100
  Permission.ADMIN_WORKSPACES,
101
+ Permission.ADMIN_PROJECTS,
97
102
  Permission.ADMIN_API,
98
103
  Permission.ENFORCEMENT,
99
104
  ]
package/src/protocol.ts CHANGED
@@ -154,12 +154,23 @@ export interface UserFeatureSettings {
154
154
  export const WorkspaceFeatureFlags = { "full_workspace_backup": undefined, "fixed_resources": undefined };
155
155
  export type NamedWorkspaceFeatureFlag = keyof (typeof WorkspaceFeatureFlags);
156
156
 
157
- export interface UserEnvVarValue {
158
- id?: string;
157
+ export interface EnvVarWithValue {
159
158
  name: string;
160
- repositoryPattern: string;
161
159
  value: string;
162
160
  }
161
+
162
+ export interface ProjectEnvVarWithValue extends EnvVarWithValue {
163
+ id: string;
164
+ projectId: string;
165
+ censored: boolean;
166
+ }
167
+
168
+ export type ProjectEnvVar = Omit<ProjectEnvVarWithValue, 'value'>;
169
+
170
+ export interface UserEnvVarValue extends EnvVarWithValue {
171
+ id?: string;
172
+ repositoryPattern: string; // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
173
+ }
163
174
  export interface UserEnvVar extends UserEnvVarValue {
164
175
  id: string;
165
176
  userId: string;
@@ -168,10 +179,12 @@ export interface UserEnvVar extends UserEnvVarValue {
168
179
 
169
180
  export namespace UserEnvVar {
170
181
 
182
+ // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
171
183
  export function normalizeRepoPattern(pattern: string) {
172
184
  return pattern.toLocaleLowerCase();
173
185
  }
174
186
 
187
+ // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
175
188
  export function score(value: UserEnvVarValue): number {
176
189
  // We use a score to enforce precedence:
177
190
  // value/value = 0
@@ -194,6 +207,7 @@ export namespace UserEnvVar {
194
207
  return score;
195
208
  }
196
209
 
210
+ // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
197
211
  export function filter<T extends UserEnvVarValue>(vars: T[], owner: string, repo: string): T[] {
198
212
  let result = vars.filter(e => {
199
213
  const [ownerPattern, repoPattern] = splitRepositoryPattern(e.repositoryPattern);
@@ -241,10 +255,11 @@ export namespace UserEnvVar {
241
255
  return result;
242
256
  }
243
257
 
258
+ // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
244
259
  export function splitRepositoryPattern(repositoryPattern: string): string[] {
245
260
  const patterns = repositoryPattern.split('/');
246
- const repoPattern = patterns.pop() || "";
247
- const ownerPattern = patterns.join('/');
261
+ const repoPattern = patterns.slice(1).join('/')
262
+ const ownerPattern = patterns[0];
248
263
  return [ownerPattern, repoPattern];
249
264
  }
250
265
  }
@@ -551,7 +566,14 @@ export interface VSCodeConfig {
551
566
  extensions?: string[];
552
567
  }
553
568
 
569
+ export interface SubRepository {
570
+ url: string;
571
+ checkoutLocation?: string;
572
+ }
573
+
554
574
  export interface WorkspaceConfig {
575
+ mainRepository?: string;
576
+ subRepositories?: SubRepository[];
555
577
  image?: ImageConfig;
556
578
  ports?: PortConfig[];
557
579
  tasks?: TaskConfig[];
@@ -670,6 +692,7 @@ export interface PrebuiltWorkspaceUpdatable {
670
692
  repo: string;
671
693
  isResolved: boolean;
672
694
  installationId: string;
695
+ commitSHA?: string;
673
696
  issue?: string;
674
697
  contextUrl?: string;
675
698
  }
@@ -851,6 +874,7 @@ export namespace SnapshotContext {
851
874
  export interface StartPrebuildContext extends WorkspaceContext {
852
875
  actual: WorkspaceContext;
853
876
  commitHistory?: string[];
877
+ subRepoCommitHistories?: string[][];
854
878
  project?: Project;
855
879
  branch?: string;
856
880
  }
@@ -876,8 +900,20 @@ export namespace PrebuiltWorkspaceContext {
876
900
  }
877
901
  }
878
902
 
903
+ export interface WithReferrerContext extends WorkspaceContext {
904
+ referrer: string
905
+ referrerIde?: string
906
+ }
907
+
908
+ export namespace WithReferrerContext {
909
+ export function is(context: any): context is WithReferrerContext {
910
+ return context
911
+ && 'referrer' in context;
912
+ }
913
+ }
914
+
879
915
  export interface WithEnvvarsContext extends WorkspaceContext {
880
- envvars: UserEnvVarValue[];
916
+ envvars: EnvVarWithValue[];
881
917
  }
882
918
 
883
919
  export namespace WithEnvvarsContext {
@@ -941,9 +977,47 @@ export namespace AdditionalContentContext {
941
977
  }
942
978
  }
943
979
 
944
- export interface CommitContext extends WorkspaceContext, Commit {
980
+ export interface CommitContext extends WorkspaceContext, GitCheckoutInfo {
945
981
  /** @deprecated Moved to .repository.cloneUrl, left here for backwards-compatibility for old workspace contextes in the DB */
946
982
  cloneUrl?: string
983
+
984
+ /**
985
+ * The clone and checkout information for the sub-repositories in case of multi-repo projects.
986
+ */
987
+ subRepositoryCheckoutInfo?: GitCheckoutInfo[];
988
+ }
989
+
990
+ export namespace CommitContext {
991
+ /**
992
+ * Creates an identifier pointing to the commits of the CommitContext and all sub-repo commit infos.
993
+ * The identifier is max 255 chars long.
994
+ * @param commitContext
995
+ * @returns identifier for set of commits
996
+ */
997
+ export function getCommitSHAs(commitContext: CommitContext): string {
998
+ if (!commitContext.subRepositoryCheckoutInfo || commitContext.subRepositoryCheckoutInfo.length === 0) {
999
+ return commitContext.revision;
1000
+ }
1001
+ // it's a multi-repo project, we need to store all commit shas and that needs to fit into 255 chars. Let's only store at most first seven.
1002
+ const commits = [commitContext.revision, ... commitContext.subRepositoryCheckoutInfo.map(i => i.revision)];
1003
+ const maxLength = Math.min(7, 255 / commits.length);
1004
+ return commits.map( r => r.substring(0, maxLength)).join(',');
1005
+ }
1006
+
1007
+ /**
1008
+ * unparses the commitShaIdentifier into an array of commit SHAs.
1009
+ * @param commitSHAIdentifier
1010
+ * @returns the array of commit SHAs
1011
+ */
1012
+ export function parseCommitSHAs(commitSHAIdentifier: string): string[] {
1013
+ return commitSHAIdentifier.split(',');
1014
+ }
1015
+ }
1016
+
1017
+ export interface GitCheckoutInfo extends Commit {
1018
+ checkoutLocation?: string;
1019
+ upstreamRemoteURI?: string;
1020
+ localBranch?: string;
947
1021
  }
948
1022
 
949
1023
  export namespace CommitContext {
@@ -1175,39 +1249,6 @@ export namespace AuthProviderEntry {
1175
1249
  }
1176
1250
  }
1177
1251
 
1178
- export interface Branding {
1179
- readonly name: string;
1180
- readonly favicon?: string;
1181
- /** Either including domain OR absolute path (interpreted relative to host URL) */
1182
- readonly logo: string;
1183
- readonly startupLogo: string;
1184
- readonly showProductivityTips: boolean;
1185
- readonly redirectUrlIfNotAuthenticated?: string;
1186
- readonly redirectUrlAfterLogout?: string;
1187
- readonly homepage: string;
1188
- readonly ide?: {
1189
- readonly logo: string;
1190
- readonly showReleaseNotes: boolean;
1191
- readonly helpMenu: Branding.Link[];
1192
- }
1193
- readonly links: {
1194
- readonly header: Branding.Link[];
1195
- readonly footer: Branding.Link[];
1196
- readonly social: Branding.SocialLink[];
1197
- readonly legal: Branding.Link[];
1198
- }
1199
- }
1200
- export namespace Branding {
1201
- export interface Link {
1202
- readonly name: string;
1203
- readonly url: string;
1204
- }
1205
- export interface SocialLink {
1206
- readonly type: string;
1207
- readonly url: string;
1208
- }
1209
- }
1210
-
1211
1252
  export interface Configuration {
1212
1253
  readonly daysBeforeGarbageCollection: number;
1213
1254
  readonly garbageCollectionStartDate: number;
@@ -42,7 +42,13 @@ export namespace Project {
42
42
  }
43
43
 
44
44
  export interface Overview {
45
- branches: BranchDetails[]
45
+ branches: BranchDetails[];
46
+ }
47
+
48
+ export namespace Overview {
49
+ export function is(data?: any): data is Project.Overview {
50
+ return Array.isArray(data?.branches);
51
+ }
46
52
  }
47
53
 
48
54
  export interface BranchDetails {
@@ -34,6 +34,7 @@ const expect = chai.expect
34
34
  ['gitpod-io','gitpod','gitpodio-gitpod-'],
35
35
  ['this is rather long and has some "§$"% special chars','also here pretty long and needs abbreviation','thisisratherlon-alsohere-'],
36
36
  ['breatheco-de', 'python-flask-api-tutorial', 'breathecode-pythonflaska-'],
37
+ ['UPPER', "CaSe", "upper-case-"]
37
38
  ]
38
39
  for (const d of data) {
39
40
  const id = await generateWorkspaceID(d[0], d[1]);
@@ -15,6 +15,7 @@ function clean(segment: string | undefined, maxChars: number = 15) {
15
15
  if (!segment) {
16
16
  return undefined;
17
17
  }
18
+ segment = segment.toLowerCase();
18
19
  let result = '';
19
20
  for (let i =0; i < segment.length; i++) {
20
21
  if (characters.indexOf(segment[i]) !== -1) {
@@ -108,10 +108,6 @@ export class GitpodHostUrl {
108
108
  return this.with(url => ({ pathname: '/preferences' }));
109
109
  }
110
110
 
111
- asGraphQLApi(): GitpodHostUrl {
112
- return this.with(url => ({ pathname: '/graphql/' }));
113
- }
114
-
115
111
  asStart(workspaceId = this.workspaceId): GitpodHostUrl {
116
112
  return this.withoutWorkspacePrefix().with({
117
113
  pathname: '/start/',
@@ -154,7 +150,7 @@ export class GitpodHostUrl {
154
150
  return undefined;
155
151
  }
156
152
 
157
- get blobServe(): boolean {
153
+ get blobServe(): boolean {
158
154
  const hostSegments = this.url.host.split(".");
159
155
  if (hostSegments[0] === 'blobserve') {
160
156
  return true;
@@ -24,12 +24,15 @@ export type TraceContextWithSpan = TraceContext & {
24
24
  export namespace TraceContext {
25
25
  export function startSpan(operation: string, parentCtx?: TraceContext, ...referencedSpans: (opentracing.Span | undefined)[]): opentracing.Span {
26
26
  const options: opentracing.SpanOptions = {};
27
- if (parentCtx) {
27
+ if (parentCtx && parentCtx.span && !!parentCtx.span.context().toSpanId()) {
28
28
  options.childOf = parentCtx.span;
29
29
  }
30
30
  if (referencedSpans) {
31
31
  // note: allthough followsForm's type says it takes 'opentracing.Span | opentracing.SpanContext', it only works with SpanContext (typing mismatch)
32
- options.references = referencedSpans.filter(s => s !== undefined).map(s => followsFrom(s!.context()));
32
+ // note2: we need to filter out debug spans (spanId === "")
33
+ options.references = referencedSpans.filter(s => s !== undefined)
34
+ .filter(s => !!s!.context().toSpanId())
35
+ .map(s => followsFrom(s!.context()));
33
36
  }
34
37
 
35
38
  return opentracing.globalTracer().startSpan(operation, options);
@@ -40,6 +43,24 @@ export namespace TraceContext {
40
43
  return { span };
41
44
  }
42
45
 
46
+ export function withSpan(operation: string, callback: () => void, ctx?: TraceContext, ...referencedSpans: (opentracing.Span | undefined)[]): void {
47
+ // if we don't have a parent span, don't create a trace here as those <trace-without-root-spans> are not useful.
48
+ if (!ctx || !ctx.span || !ctx.span.context()) {
49
+ callback();
50
+ return;
51
+ }
52
+
53
+ const span = TraceContext.startSpan(operation, ctx, ...referencedSpans);
54
+ try {
55
+ callback();
56
+ } catch (e) {
57
+ TraceContext.setError({span}, e);
58
+ throw e;
59
+ } finally {
60
+ span.finish();
61
+ }
62
+ }
63
+
43
64
  export function setError(ctx: TraceContext, err: Error) {
44
65
  if (!ctx.span) {
45
66
  return;
@@ -35,9 +35,6 @@ export interface WorkspaceCluster {
35
35
 
36
36
  // An optional set of constraints that limit who can start workspaces on the cluster
37
37
  admissionConstraints?: AdmissionConstraint[];
38
-
39
- // An optional set of admission preferences that guide cluster selection
40
- admissionPreferences?: AdmissionPreference[];
41
38
  }
42
39
 
43
40
  export type WorkspaceClusterState = "available" | "cordoned" | "draining";
@@ -55,13 +52,11 @@ export namespace TLSConfig {
55
52
  export type WorkspaceClusterWoTLS = Omit<WorkspaceCluster, "tls">;
56
53
  export type WorkspaceManagerConnectionInfo = Pick<WorkspaceCluster, "name" | "url" | "tls">;
57
54
 
58
- export type AdmissionConstraint = AdmissionConstraintFeaturePreview | AdmissionConstraintHasRole | AdmissionConstraintHasUserLevel;
55
+ export type AdmissionConstraint = AdmissionConstraintFeaturePreview | AdmissionConstraintHasRole | AdmissionConstraintHasUserLevel | AdmissionConstraintHasMoreResources;
59
56
  export type AdmissionConstraintFeaturePreview = { type: "has-feature-preview" };
60
57
  export type AdmissionConstraintHasRole = { type: "has-permission", permission: PermissionName };
61
58
  export type AdmissionConstraintHasUserLevel = { type: "has-user-level", level: string };
62
-
63
- export type AdmissionPreference = AdmissionPreferenceUserLevel;
64
- export type AdmissionPreferenceUserLevel = { type: 'user-level', level: string };
59
+ export type AdmissionConstraintHasMoreResources = { type: "has-more-resources" };
65
60
 
66
61
 
67
62
  export const WorkspaceClusterDB = Symbol("WorkspaceClusterDB");
@@ -51,6 +51,11 @@ export interface WorkspaceInstance {
51
51
 
52
52
  // instance is hard-deleted on the database and about to be collected by db-sync
53
53
  readonly deleted?: boolean;
54
+
55
+ /**
56
+ * Contains information about the image build, if there was any
57
+ */
58
+ imageBuildInfo?: ImageBuildInfo;
54
59
  }
55
60
 
56
61
  // WorkspaceInstanceStatus describes the current state of a workspace instance
@@ -213,3 +218,18 @@ export interface WorkspaceInstanceConfiguration {
213
218
  // supervisorImage is the ref of the supervisor image this instance uses.
214
219
  supervisorImage?: string;
215
220
  }
221
+
222
+ /**
223
+ * Holds information about the image build (if there was one) for this WorkspaceInstance
224
+ */
225
+ export interface ImageBuildInfo {
226
+ log?: ImageBuildLogInfo,
227
+ }
228
+
229
+ /**
230
+ * Holds information about how to access logs for this an image build
231
+ */
232
+ export interface ImageBuildLogInfo {
233
+ url: string,
234
+ headers: { [key: string]: string },
235
+ }
package/src/wsready.ts CHANGED
@@ -1,17 +1,18 @@
1
1
  /**
2
- * Copyright (c) 2021 Gitpod GmbH. All rights reserved.
2
+ * Copyright (c) 2022 Gitpod GmbH. All rights reserved.
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
- // generated using github.com/32leaves/bel on 2021-11-04 12:16:53.917570766 +0000 UTC m=+0.006002884
7
+ // generated using github.com/32leaves/bel on 2022-01-18 11:58:21.410853112 +0000 UTC m=+0.010268211
8
8
  // DO NOT MODIFY
9
9
 
10
+ export interface WorkspaceReadyMessage {
11
+ source: WorkspaceInitSource
12
+ }
13
+
10
14
  export enum WorkspaceInitSource {
11
15
  WorkspaceInitFromBackup = "from-backup",
12
16
  WorkspaceInitFromPrebuild = "from-prebuild",
13
17
  WorkspaceInitFromOther = "from-other",
14
18
  }
15
- export interface WorkspaceReadyMessage {
16
- source: WorkspaceInitSource
17
- }