-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,9 +24,21 @@ export class DBWorkspace implements Workspace { | |
@Index() | ||
ownerId: string; | ||
|
||
@Column({ | ||
default: '', | ||
transformer: Transformer.MAP_EMPTY_STR_TO_UNDEFINED | ||
}) | ||
projectId?: string; | ||
|
||
@Column("text") | ||
contextURL: string; | ||
|
||
@Column({ | ||
default: '', | ||
transformer: Transformer.MAP_EMPTY_STR_TO_UNDEFINED | ||
}) | ||
branch?: string; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
AlexTugarev
Author
Member
|
||
|
||
@Column() | ||
description: string; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* Copyright (c) 2021 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. | ||
*/ | ||
|
||
import {MigrationInterface, QueryRunner} from "typeorm"; | ||
import { tableExists, columnExists } from "./helper/helper"; | ||
|
||
export class AddProjectIdToWorkspace1624962141719 implements MigrationInterface { | ||
|
||
public async up(queryRunner: QueryRunner): Promise<any> { | ||
if (await tableExists(queryRunner, "d_b_workspace")) { | ||
if (!(await columnExists(queryRunner, "d_b_workspace", "projectId"))) { | ||
await queryRunner.query("ALTER TABLE d_b_workspace ADD COLUMN `projectId` char(36) DEFAULT NULL, ADD COLUMN `branch` varchar(255) DEFAULT NULL"); | ||
} | ||
} | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<any> { | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -285,6 +285,8 @@ export namespace GitpodServer { | |||||||||
} | ||||||||||
export interface CreateWorkspaceOptions { | ||||||||||
contextUrl: string; | ||||||||||
branch?: string; | ||||||||||
projectId?: string; | ||||||||||
This comment has been minimized.
Sorry, something went wrong.
jankeromnes
Contributor
|
const result = await getGitpodService().server.createWorkspace({ | |
contextUrl: this.props.contextUrl, | |
mode | |
}); |
I don't think the front-end / dashboard should be responsible for first resolving a project ID before requesting a workspace creation. However, we still wanted created workspaces to be linked to a project (e.g. so that any out-of-repo configuration can be applied).
Instead, I think the project ID should be resolved during the workspace's creation, for example during the context parsing.
This comment has been minimized.
This comment has been minimized.
Sorry, something went wrong.
AlexTugarev
Jul 6, 2021
Author
Member
I'm happy do discuss this, @jankeromnes!
Again, this is not how I read #4422.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -392,11 +392,14 @@ export interface Workspace { | |
id: string; | ||
creationTime: string; | ||
contextURL: string; | ||
branch?: string; | ||
This comment has been minimized.
Sorry, something went wrong.
jankeromnes
Contributor
|
||
description: string; | ||
ownerId: string; | ||
context: WorkspaceContext; | ||
config: WorkspaceConfig; | ||
|
||
projectId?: string; | ||
|
||
/** | ||
* The source where to get the workspace base image from. This source is resolved | ||
* during workspace creation. Once a base image has been built the information in here | ||
|
@@ -631,6 +634,7 @@ export type PrebuiltWorkspaceState | |
export interface PrebuiltWorkspace { | ||
id: string; | ||
cloneURL: string; | ||
branch?: string; | ||
commit: string; | ||
buildWorkspaceId: string; | ||
creationTime: string; | ||
|
@@ -765,6 +769,8 @@ export namespace ExternalImageConfigFile { | |
export interface WorkspaceContext { | ||
title: string; | ||
normalizedContextURL?: string; | ||
branch?: string; | ||
projectId?: string; | ||
forceCreateNewWorkspace?: boolean; | ||
forceImageBuild?: boolean; | ||
} | ||
|
@@ -814,6 +820,7 @@ export namespace SnapshotContext { | |
|
||
export interface StartPrebuildContext extends WorkspaceContext { | ||
actual: WorkspaceContext; | ||
branch?: string; | ||
commitHistory?: string[]; | ||
} | ||
|
||
|
Nit: Why add
branch
information to all workspaces? Isn't this something we need only for prebuilds?To me, this would make more sense if added to
DBPrebuiltWorkspace
instead of here:E.g. you'll note that
cloneURL
andcommit
also live inDBPrebuiltWorkspace
, not in workspacesAlso, I can't imagine what other workspace types like probes or ghosts would do with a
branch
info?