Skip to content

Commit 2e1774e

Browse files
svenefftingeroboquat
authored andcommitted
[multi-repos] Allow specifying subrepositories
1 parent a9715ee commit 2e1774e

File tree

10 files changed

+331
-127
lines changed

10 files changed

+331
-127
lines changed

components/content-service-api/go/initializer.pb.go

Lines changed: 62 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/content-service-api/initializer.proto

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,11 @@ message SnapshotInitializer {
115115
}
116116

117117
// A prebuild initializer combines snapshots with Git: first we try the snapshot, then apply the Git clone target.
118-
// If restoring the snapshot fails, we fall back to a regular Git initializer.
118+
// If restoring the snapshot fails, we fall back to a regular Git initializer, which might be composite git initializer for multi-repo projects.
119119
message PrebuildInitializer {
120120
SnapshotInitializer prebuild = 1;
121121
GitInitializer git = 2;
122+
CompositeInitializer composite = 3;
122123
}
123124

124125
// FromBackupInitializer initializes content from a previously made backup

components/content-service-api/typescript/src/initializer_pb.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
2+
* Copyright (c) 2022 Gitpod GmbH. All rights reserved.
33
* Licensed under the GNU Affero General Public License (AGPL).
44
* See License-AGPL.txt in the project root for license information.
55
*/
@@ -281,6 +281,11 @@ export class PrebuildInitializer extends jspb.Message {
281281
getGit(): GitInitializer | undefined;
282282
setGit(value?: GitInitializer): PrebuildInitializer;
283283

284+
hasComposite(): boolean;
285+
clearComposite(): void;
286+
getComposite(): CompositeInitializer | undefined;
287+
setComposite(value?: CompositeInitializer): PrebuildInitializer;
288+
284289
serializeBinary(): Uint8Array;
285290
toObject(includeInstance?: boolean): PrebuildInitializer.AsObject;
286291
static toObject(includeInstance: boolean, msg: PrebuildInitializer): PrebuildInitializer.AsObject;
@@ -295,6 +300,7 @@ export namespace PrebuildInitializer {
295300
export type AsObject = {
296301
prebuild?: SnapshotInitializer.AsObject,
297302
git?: GitInitializer.AsObject,
303+
composite?: CompositeInitializer.AsObject,
298304
}
299305
}
300306

components/content-service-api/typescript/src/initializer_pb.js

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
2+
* Copyright (c) 2022 Gitpod GmbH. All rights reserved.
33
* Licensed under the GNU Affero General Public License (AGPL).
44
* See License-AGPL.txt in the project root for license information.
55
*/
@@ -2118,7 +2118,8 @@ proto.contentservice.PrebuildInitializer.prototype.toObject = function(opt_inclu
21182118
proto.contentservice.PrebuildInitializer.toObject = function(includeInstance, msg) {
21192119
var f, obj = {
21202120
prebuild: (f = msg.getPrebuild()) && proto.contentservice.SnapshotInitializer.toObject(includeInstance, f),
2121-
git: (f = msg.getGit()) && proto.contentservice.GitInitializer.toObject(includeInstance, f)
2121+
git: (f = msg.getGit()) && proto.contentservice.GitInitializer.toObject(includeInstance, f),
2122+
composite: (f = msg.getComposite()) && proto.contentservice.CompositeInitializer.toObject(includeInstance, f)
21222123
};
21232124

21242125
if (includeInstance) {
@@ -2165,6 +2166,11 @@ proto.contentservice.PrebuildInitializer.deserializeBinaryFromReader = function(
21652166
reader.readMessage(value,proto.contentservice.GitInitializer.deserializeBinaryFromReader);
21662167
msg.setGit(value);
21672168
break;
2169+
case 3:
2170+
var value = new proto.contentservice.CompositeInitializer;
2171+
reader.readMessage(value,proto.contentservice.CompositeInitializer.deserializeBinaryFromReader);
2172+
msg.setComposite(value);
2173+
break;
21682174
default:
21692175
reader.skipField();
21702176
break;
@@ -2210,6 +2216,14 @@ proto.contentservice.PrebuildInitializer.serializeBinaryToWriter = function(mess
22102216
proto.contentservice.GitInitializer.serializeBinaryToWriter
22112217
);
22122218
}
2219+
f = message.getComposite();
2220+
if (f != null) {
2221+
writer.writeMessage(
2222+
3,
2223+
f,
2224+
proto.contentservice.CompositeInitializer.serializeBinaryToWriter
2225+
);
2226+
}
22132227
};
22142228

22152229

@@ -2287,6 +2301,43 @@ proto.contentservice.PrebuildInitializer.prototype.hasGit = function() {
22872301
};
22882302

22892303

2304+
/**
2305+
* optional CompositeInitializer composite = 3;
2306+
* @return {?proto.contentservice.CompositeInitializer}
2307+
*/
2308+
proto.contentservice.PrebuildInitializer.prototype.getComposite = function() {
2309+
return /** @type{?proto.contentservice.CompositeInitializer} */ (
2310+
jspb.Message.getWrapperField(this, proto.contentservice.CompositeInitializer, 3));
2311+
};
2312+
2313+
2314+
/**
2315+
* @param {?proto.contentservice.CompositeInitializer|undefined} value
2316+
* @return {!proto.contentservice.PrebuildInitializer} returns this
2317+
*/
2318+
proto.contentservice.PrebuildInitializer.prototype.setComposite = function(value) {
2319+
return jspb.Message.setWrapperField(this, 3, value);
2320+
};
2321+
2322+
2323+
/**
2324+
* Clears the message field making it undefined.
2325+
* @return {!proto.contentservice.PrebuildInitializer} returns this
2326+
*/
2327+
proto.contentservice.PrebuildInitializer.prototype.clearComposite = function() {
2328+
return this.setComposite(undefined);
2329+
};
2330+
2331+
2332+
/**
2333+
* Returns whether this field is set.
2334+
* @return {boolean}
2335+
*/
2336+
proto.contentservice.PrebuildInitializer.prototype.hasComposite = function() {
2337+
return jspb.Message.getField(this, 3) != null;
2338+
};
2339+
2340+
22902341

22912342

22922343

components/gitpod-protocol/data/gitpod-schema.json

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,38 @@
136136
},
137137
"additionalProperties": false
138138
},
139+
"subRepositories": {
140+
"type": "array",
141+
"description": "List of sub repositories that are part of this project.",
142+
"items": {
143+
"type": "object",
144+
"required": [
145+
"url"
146+
],
147+
"properties": {
148+
"url": {
149+
"type": ["string"],
150+
"description": "The url of the git repository to clone. Supports any context URLs."
151+
},
152+
"checkoutLocation": {
153+
"type": "string",
154+
"description": "Path to where the repository should be checked out relative to `/workspace`. Defaults to the simple repository name."
155+
}
156+
},
157+
"additionalProperties": false
158+
}
159+
},
160+
"mainRepository": {
161+
"type": "string",
162+
"description": "The main repository, containing the dev environment configuration."
163+
},
139164
"checkoutLocation": {
140165
"type": "string",
141-
"description": "Path to where the repository should be checked out."
166+
"description": "Path to where the repository should be checked out relative to `/workspace`. Defaults to the simple repository name."
142167
},
143168
"workspaceLocation": {
144169
"type": "string",
145-
"description": "Path to where the IDE's workspace should be opened."
170+
"description": "Path to where the IDE's workspace should be opened. Supports vscode's `*.code-workspace` files."
146171
},
147172
"gitConfig": {
148173
"type": [
@@ -224,6 +249,7 @@
224249
},
225250
"experimentalNetwork": {
226251
"type": "boolean",
252+
"deprecationMessage": "The 'experimentalNetwork' property is deprecated.",
227253
"description": "Experimental network configuration in workspaces (deprecated). Enabled by default"
228254
}
229255
},

components/gitpod-protocol/src/protocol.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,14 @@ export interface VSCodeConfig {
567567
extensions?: string[];
568568
}
569569

570+
export interface SubRepository {
571+
url: string;
572+
checkoutLocation?: string;
573+
}
574+
570575
export interface WorkspaceConfig {
576+
mainRepository?: string;
577+
subRepositories?: SubRepository[];
571578
image?: ImageConfig;
572579
ports?: PortConfig[];
573580
tasks?: TaskConfig[];
@@ -970,9 +977,20 @@ export namespace AdditionalContentContext {
970977
}
971978
}
972979

973-
export interface CommitContext extends WorkspaceContext, Commit {
980+
export interface CommitContext extends WorkspaceContext, GitCheckoutInfo {
974981
/** @deprecated Moved to .repository.cloneUrl, left here for backwards-compatibility for old workspace contextes in the DB */
975982
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 interface GitCheckoutInfo extends Commit {
991+
checkoutLocation?: string;
992+
upstreamRemoteURI?: string;
993+
localBranch?: string;
976994
}
977995

978996
export namespace CommitContext {

0 commit comments

Comments
 (0)