@gitpod/gitpod-protocol 0.1.5-se-multi-repo.7 → 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.
- package/lib/admin-protocol.d.ts +10 -0
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js.map +1 -1
- package/lib/context-url.d.ts +1 -0
- package/lib/context-url.d.ts.map +1 -1
- package/lib/context-url.js +3 -1
- package/lib/context-url.js.map +1 -1
- package/lib/gitpod-service.d.ts +9 -0
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js.map +1 -1
- package/lib/ide-protocol.d.ts +20 -0
- package/lib/ide-protocol.d.ts.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/installation-admin-protocol.d.ts +21 -0
- package/lib/installation-admin-protocol.d.ts.map +1 -0
- package/lib/installation-admin-protocol.js +30 -0
- package/lib/installation-admin-protocol.js.map +1 -0
- 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/permission.d.ts +4 -1
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +4 -0
- package/lib/permission.js.map +1 -1
- package/lib/protocol.d.ts +24 -0
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +38 -3
- package/lib/protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +3 -0
- package/lib/teams-projects-protocol.d.ts.map +1 -1
- package/lib/teams-projects-protocol.js +7 -0
- package/lib/teams-projects-protocol.js.map +1 -1
- package/lib/workspace-cluster.d.ts +3 -6
- package/lib/workspace-cluster.d.ts.map +1 -1
- package/lib/workspace-cluster.js.map +1 -1
- package/lib/workspace-instance.d.ts +19 -0
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/wsready.d.ts +4 -4
- package/lib/wsready.d.ts.map +1 -1
- package/lib/wsready.js +1 -3
- package/lib/wsready.js.map +1 -1
- package/package.json +1 -1
- package/pkg-yarn.lock +1 -1
- package/provenance-bundle.jsonl +1 -1
- package/src/admin-protocol.ts +17 -4
- package/src/context-url.ts +3 -1
- package/src/gitpod-service.ts +11 -0
- package/src/ide-protocol.ts +22 -0
- package/src/index.ts +1 -0
- package/src/installation-admin-protocol.ts +35 -0
- package/src/messaging/error.ts +3 -0
- package/src/permission.ts +5 -0
- package/src/protocol.ts +43 -2
- package/src/teams-projects-protocol.ts +7 -1
- package/src/workspace-cluster.ts +2 -7
- package/src/workspace-instance.ts +20 -0
- package/src/wsready.ts +6 -5
|
@@ -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
|
+
}
|
package/src/messaging/error.ts
CHANGED
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
|
@@ -258,8 +258,8 @@ export namespace UserEnvVar {
|
|
|
258
258
|
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
259
259
|
export function splitRepositoryPattern(repositoryPattern: string): string[] {
|
|
260
260
|
const patterns = repositoryPattern.split('/');
|
|
261
|
-
const repoPattern = patterns.
|
|
262
|
-
const ownerPattern = patterns
|
|
261
|
+
const repoPattern = patterns.slice(1).join('/')
|
|
262
|
+
const ownerPattern = patterns[0];
|
|
263
263
|
return [ownerPattern, repoPattern];
|
|
264
264
|
}
|
|
265
265
|
}
|
|
@@ -692,6 +692,7 @@ export interface PrebuiltWorkspaceUpdatable {
|
|
|
692
692
|
repo: string;
|
|
693
693
|
isResolved: boolean;
|
|
694
694
|
installationId: string;
|
|
695
|
+
commitSHA?: string;
|
|
695
696
|
issue?: string;
|
|
696
697
|
contextUrl?: string;
|
|
697
698
|
}
|
|
@@ -873,6 +874,7 @@ export namespace SnapshotContext {
|
|
|
873
874
|
export interface StartPrebuildContext extends WorkspaceContext {
|
|
874
875
|
actual: WorkspaceContext;
|
|
875
876
|
commitHistory?: string[];
|
|
877
|
+
subRepoCommitHistories?: string[][];
|
|
876
878
|
project?: Project;
|
|
877
879
|
branch?: string;
|
|
878
880
|
}
|
|
@@ -898,6 +900,18 @@ export namespace PrebuiltWorkspaceContext {
|
|
|
898
900
|
}
|
|
899
901
|
}
|
|
900
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
|
+
|
|
901
915
|
export interface WithEnvvarsContext extends WorkspaceContext {
|
|
902
916
|
envvars: EnvVarWithValue[];
|
|
903
917
|
}
|
|
@@ -973,6 +987,33 @@ export interface CommitContext extends WorkspaceContext, GitCheckoutInfo {
|
|
|
973
987
|
subRepositoryCheckoutInfo?: GitCheckoutInfo[];
|
|
974
988
|
}
|
|
975
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
|
+
|
|
976
1017
|
export interface GitCheckoutInfo extends Commit {
|
|
977
1018
|
checkoutLocation?: string;
|
|
978
1019
|
upstreamRemoteURI?: string;
|
|
@@ -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 {
|
package/src/workspace-cluster.ts
CHANGED
|
@@ -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)
|
|
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
|
|
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
|
-
}
|