Skip to content

Commit

Permalink
[multi-repos] Allow specifying subrepositories
Browse files Browse the repository at this point in the history
  • Loading branch information
svenefftinge committed Jan 23, 2022
1 parent c3bcf63 commit 711a613
Show file tree
Hide file tree
Showing 10 changed files with 331 additions and 128 deletions.
110 changes: 62 additions & 48 deletions components/content-service-api/go/initializer.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion components/content-service-api/initializer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,11 @@ message SnapshotInitializer {
}

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

// FromBackupInitializer initializes content from a previously made backup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
* Copyright (c) 2022 Gitpod GmbH. All rights reserved.
* Licensed under the GNU Affero General Public License (AGPL).
* See License-AGPL.txt in the project root for license information.
*/
Expand Down Expand Up @@ -281,6 +281,11 @@ export class PrebuildInitializer extends jspb.Message {
getGit(): GitInitializer | undefined;
setGit(value?: GitInitializer): PrebuildInitializer;

hasComposite(): boolean;
clearComposite(): void;
getComposite(): CompositeInitializer | undefined;
setComposite(value?: CompositeInitializer): PrebuildInitializer;

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): PrebuildInitializer.AsObject;
static toObject(includeInstance: boolean, msg: PrebuildInitializer): PrebuildInitializer.AsObject;
Expand All @@ -295,6 +300,7 @@ export namespace PrebuildInitializer {
export type AsObject = {
prebuild?: SnapshotInitializer.AsObject,
git?: GitInitializer.AsObject,
composite?: CompositeInitializer.AsObject,
}
}

Expand Down
55 changes: 53 additions & 2 deletions components/content-service-api/typescript/src/initializer_pb.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
* Copyright (c) 2022 Gitpod GmbH. All rights reserved.
* Licensed under the GNU Affero General Public License (AGPL).
* See License-AGPL.txt in the project root for license information.
*/
Expand Down Expand Up @@ -2118,7 +2118,8 @@ proto.contentservice.PrebuildInitializer.prototype.toObject = function(opt_inclu
proto.contentservice.PrebuildInitializer.toObject = function(includeInstance, msg) {
var f, obj = {
prebuild: (f = msg.getPrebuild()) && proto.contentservice.SnapshotInitializer.toObject(includeInstance, f),
git: (f = msg.getGit()) && proto.contentservice.GitInitializer.toObject(includeInstance, f)
git: (f = msg.getGit()) && proto.contentservice.GitInitializer.toObject(includeInstance, f),
composite: (f = msg.getComposite()) && proto.contentservice.CompositeInitializer.toObject(includeInstance, f)
};

if (includeInstance) {
Expand Down Expand Up @@ -2165,6 +2166,11 @@ proto.contentservice.PrebuildInitializer.deserializeBinaryFromReader = function(
reader.readMessage(value,proto.contentservice.GitInitializer.deserializeBinaryFromReader);
msg.setGit(value);
break;
case 3:
var value = new proto.contentservice.CompositeInitializer;
reader.readMessage(value,proto.contentservice.CompositeInitializer.deserializeBinaryFromReader);
msg.setComposite(value);
break;
default:
reader.skipField();
break;
Expand Down Expand Up @@ -2210,6 +2216,14 @@ proto.contentservice.PrebuildInitializer.serializeBinaryToWriter = function(mess
proto.contentservice.GitInitializer.serializeBinaryToWriter
);
}
f = message.getComposite();
if (f != null) {
writer.writeMessage(
3,
f,
proto.contentservice.CompositeInitializer.serializeBinaryToWriter
);
}
};


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


/**
* optional CompositeInitializer composite = 3;
* @return {?proto.contentservice.CompositeInitializer}
*/
proto.contentservice.PrebuildInitializer.prototype.getComposite = function() {
return /** @type{?proto.contentservice.CompositeInitializer} */ (
jspb.Message.getWrapperField(this, proto.contentservice.CompositeInitializer, 3));
};


/**
* @param {?proto.contentservice.CompositeInitializer|undefined} value
* @return {!proto.contentservice.PrebuildInitializer} returns this
*/
proto.contentservice.PrebuildInitializer.prototype.setComposite = function(value) {
return jspb.Message.setWrapperField(this, 3, value);
};


/**
* Clears the message field making it undefined.
* @return {!proto.contentservice.PrebuildInitializer} returns this
*/
proto.contentservice.PrebuildInitializer.prototype.clearComposite = function() {
return this.setComposite(undefined);
};


/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.contentservice.PrebuildInitializer.prototype.hasComposite = function() {
return jspb.Message.getField(this, 3) != null;
};





Expand Down
30 changes: 28 additions & 2 deletions components/gitpod-protocol/data/gitpod-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,38 @@
},
"additionalProperties": false
},
"subRepositories": {
"type": "array",
"description": "List of sub repositories that are part of this project.",
"items": {
"type": "object",
"required": [
"url"
],
"properties": {
"url": {
"type": ["string"],
"description": "The url of the git repository to clone. Supports any context URLs."
},
"checkoutLocation": {
"type": "string",
"description": "Path to where the repository should be checked out relative to `/workspace`. Defaults to the simple repository name."
}
},
"additionalProperties": false
}
},
"mainRepository": {
"type": "string",
"description": "The main repository, containing the dev environment configuration."
},
"checkoutLocation": {
"type": "string",
"description": "Path to where the repository should be checked out."
"description": "Path to where the repository should be checked out relative to `/workspace`. Defaults to the simple repository name."
},
"workspaceLocation": {
"type": "string",
"description": "Path to where the IDE's workspace should be opened."
"description": "Path to where the IDE's workspace should be opened. Supports vscode's `*.code-workspace` files."
},
"gitConfig": {
"type": [
Expand Down Expand Up @@ -224,6 +249,7 @@
},
"experimentalNetwork": {
"type": "boolean",
"deprecationMessage": "The 'experimentalNetwork' property is deprecated.",
"description": "Experimental network configuration in workspaces (deprecated). Enabled by default"
}
},
Expand Down
20 changes: 19 additions & 1 deletion components/gitpod-protocol/src/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,14 @@ export interface VSCodeConfig {
extensions?: string[];
}

export interface SubRepository {
url: string;
checkoutLocation?: string;
}

export interface WorkspaceConfig {
mainRepository?: string;
subRepositories?: SubRepository[];
image?: ImageConfig;
ports?: PortConfig[];
tasks?: TaskConfig[];
Expand Down Expand Up @@ -956,9 +963,20 @@ export namespace AdditionalContentContext {
}
}

export interface CommitContext extends WorkspaceContext, Commit {
export interface CommitContext extends WorkspaceContext, GitCheckoutInfo {
/** @deprecated Moved to .repository.cloneUrl, left here for backwards-compatibility for old workspace contextes in the DB */
cloneUrl?: string

/**
* The clone and checkout information for the sub-repositories in case of multi-repo projects.
*/
subRepositoryCheckoutInfo?: GitCheckoutInfo[];
}

export interface GitCheckoutInfo extends Commit {
checkoutLocation?: string;
upstreamRemoteURI?: string;
localBranch?: string;
}

export namespace CommitContext {
Expand Down
Loading

0 comments on commit 711a613

Please sign in to comment.