Skip to content

Commit e83c1f4

Browse files
committed
WIP: [image-builder, et. al] Switch image build logs to work server-to-imagebuild workspace instead of server-to-imagebuilder
The goal here is to make image build logs accessible from all meta clusters. This helps to move forward with removing the cross-cluster messagebus dependency while image-builder(s) still runs in the meta cluster(s).
1 parent 1f259aa commit e83c1f4

File tree

16 files changed

+232
-75
lines changed

16 files changed

+232
-75
lines changed

components/gitpod-db/src/typeorm/entity/db-workspace.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import { PrimaryColumn, Column, Entity, Index } from "typeorm";
88

9-
import { Workspace, WorkspaceConfig, WorkspaceContext, WorkspaceImageSource, WorkspaceType, WorkspaceSoftDeletion } from "@gitpod/gitpod-protocol";
9+
import { Workspace, WorkspaceConfig, WorkspaceContext, WorkspaceImageSource, WorkspaceType, WorkspaceSoftDeletion, ImageBuildLogInfo } from "@gitpod/gitpod-protocol";
1010
import { TypeORM } from "../typeorm";
1111
import { Transformer } from "../transformer";
1212

@@ -105,4 +105,7 @@ export class DBWorkspace implements Workspace {
105105
})
106106
@Index('ind_basedOnSnapshotId')
107107
basedOnSnapshotId?: string;
108+
109+
@Column("simple-json", { nullable: true })
110+
imageBuildLogInfo?: ImageBuildLogInfo;
108111
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import {MigrationInterface, QueryRunner} from "typeorm";
2+
import { columnExists } from "./helper/helper";
3+
4+
export class WorkspaceImageBuildLogInfo1642088620203 implements MigrationInterface {
5+
6+
public async up(queryRunner: QueryRunner): Promise<void> {
7+
if (!(await columnExists(queryRunner, "d_b_workspace", "imageBuildLogInfo"))) {
8+
await queryRunner.query("ALTER TABLE d_b_workspace ADD COLUMN `imageBuildLogInfo` text NULL");
9+
}
10+
}
11+
12+
public async down(queryRunner: QueryRunner): Promise<void> {
13+
}
14+
15+
}

components/gitpod-db/src/typeorm/workspace-db-impl.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { DBPrebuiltWorkspace } from "./entity/db-prebuilt-workspace";
2020
import { DBPrebuiltWorkspaceUpdatable } from "./entity/db-prebuilt-workspace-updatable";
2121
import { BUILTIN_WORKSPACE_PROBE_USER_ID } from "../user-db";
2222
import { DBPrebuildInfo } from "./entity/db-prebuild-info-entry";
23-
import { FindInstanceOptions } from "..";
2423

2524
type RawTo<T> = (instance: WorkspaceInstance, ws: Workspace) => T;
2625
interface OrderBy {

components/gitpod-db/src/workspace-db.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@ export interface PrebuildWithWorkspace {
4646
workspace: Workspace;
4747
}
4848

49-
export type FindInstanceOptions = Partial<Pick<
50-
WorkspaceInstance, "region"> & {
51-
phasePersisted: WorkspaceInstancePhase;
52-
}>;
53-
5449
export type WorkspaceAndOwner = Pick<Workspace, "id" | "ownerId">;
5550
export type WorkspaceOwnerAndSoftDeleted = Pick<Workspace, "id" | "ownerId" | "softDeleted">;
5651

components/gitpod-protocol/src/protocol.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,12 +448,19 @@ export interface Workspace {
448448
basedOnPrebuildId?: string;
449449

450450
basedOnSnapshotId?: string;
451+
452+
imageBuildLogInfo?: ImageBuildLogInfo;
451453
}
452454

453455
export type WorkspaceSoftDeletion = "user" | "gc";
454456

455457
export type WorkspaceType = "regular" | "prebuild" | "probe";
456458

459+
export interface ImageBuildLogInfo {
460+
url: string,
461+
headers: { [key: string]: string },
462+
}
463+
457464
export namespace Workspace {
458465

459466
export function getFullRepositoryName(ws: Workspace): string | undefined {

components/image-builder-api/go/imgbuilder.pb.go

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

components/image-builder-api/go/imgbuilder_grpc.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/image-builder-api/go/mock/mock.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/image-builder-api/imgbuilder.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,6 @@ message BuildInfo {
128128
BuildStatus status = 2;
129129
int64 started_at = 3;
130130
string build_id = 5;
131+
string log_url = 6;
132+
map<string, string> log_url_extra_headers = 7;
131133
}

components/image-builder-api/typescript/src/imgbuilder_grpc_pb.d.ts

Lines changed: 1 addition & 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
*/

0 commit comments

Comments
 (0)