@gitpod/gitpod-protocol 0.1.5-se-github-app-check-7518.0 → 0.1.5-se-multi-repo.7
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 +30 -4
- package/lib/gitpod-service.d.ts +4 -2
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +4 -2
- package/lib/gitpod-service.js.map +1 -1
- package/lib/messaging/node/connection.d.ts +1 -7
- package/lib/messaging/node/connection.d.ts.map +1 -1
- package/lib/messaging/node/connection.js +20 -18
- package/lib/messaging/node/connection.js.map +1 -1
- package/lib/protocol.d.ts +28 -37
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +4 -0
- package/lib/protocol.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts.map +1 -1
- package/lib/util/generate-workspace-id.js +1 -0
- package/lib/util/generate-workspace-id.js.map +1 -1
- package/lib/util/generate-workspace-id.spec.js +1 -0
- package/lib/util/generate-workspace-id.spec.js.map +1 -1
- package/lib/util/gitpod-host-url.d.ts +0 -1
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +0 -3
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/tracing.d.ts +1 -0
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +24 -2
- package/lib/util/tracing.js.map +1 -1
- package/package.json +1 -1
- package/pkg-yarn.lock +1 -1
- package/provenance-bundle.jsonl +1 -1
- package/src/gitpod-service.ts +10 -6
- package/src/ide-frontend-service.ts +1 -1
- package/src/messaging/node/connection.ts +20 -23
- package/src/protocol.ts +38 -38
- package/src/util/generate-workspace-id.spec.ts +1 -0
- package/src/util/generate-workspace-id.ts +1 -0
- package/src/util/gitpod-host-url.ts +1 -5
- package/src/util/tracing.ts +23 -2
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
|
|
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,6 +255,7 @@ 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
261
|
const repoPattern = patterns.pop() || "";
|
|
@@ -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[];
|
|
@@ -877,7 +899,7 @@ export namespace PrebuiltWorkspaceContext {
|
|
|
877
899
|
}
|
|
878
900
|
|
|
879
901
|
export interface WithEnvvarsContext extends WorkspaceContext {
|
|
880
|
-
envvars:
|
|
902
|
+
envvars: EnvVarWithValue[];
|
|
881
903
|
}
|
|
882
904
|
|
|
883
905
|
export namespace WithEnvvarsContext {
|
|
@@ -941,9 +963,20 @@ export namespace AdditionalContentContext {
|
|
|
941
963
|
}
|
|
942
964
|
}
|
|
943
965
|
|
|
944
|
-
export interface CommitContext extends WorkspaceContext,
|
|
966
|
+
export interface CommitContext extends WorkspaceContext, GitCheckoutInfo {
|
|
945
967
|
/** @deprecated Moved to .repository.cloneUrl, left here for backwards-compatibility for old workspace contextes in the DB */
|
|
946
968
|
cloneUrl?: string
|
|
969
|
+
|
|
970
|
+
/**
|
|
971
|
+
* The clone and checkout information for the sub-repositories in case of multi-repo projects.
|
|
972
|
+
*/
|
|
973
|
+
subRepositoryCheckoutInfo?: GitCheckoutInfo[];
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
export interface GitCheckoutInfo extends Commit {
|
|
977
|
+
checkoutLocation?: string;
|
|
978
|
+
upstreamRemoteURI?: string;
|
|
979
|
+
localBranch?: string;
|
|
947
980
|
}
|
|
948
981
|
|
|
949
982
|
export namespace CommitContext {
|
|
@@ -1175,39 +1208,6 @@ export namespace AuthProviderEntry {
|
|
|
1175
1208
|
}
|
|
1176
1209
|
}
|
|
1177
1210
|
|
|
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
1211
|
export interface Configuration {
|
|
1212
1212
|
readonly daysBeforeGarbageCollection: number;
|
|
1213
1213
|
readonly garbageCollectionStartDate: number;
|
|
@@ -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;
|
package/src/util/tracing.ts
CHANGED
|
@@ -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
|
-
|
|
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;
|