Skip to content

Commit

Permalink
Remove Prebuild Events page and jsonrpc methods (#19069)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexTugarev authored Nov 14, 2023
1 parent 0ec0037 commit aa691dd
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 286 deletions.
2 changes: 0 additions & 2 deletions components/dashboard/src/app/AppRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ const TeamGitIntegrations = React.lazy(() => import(/* webpackPrefetch: true */
const NewProject = React.lazy(() => import(/* webpackPrefetch: true */ "../projects/NewProject"));
const Projects = React.lazy(() => import(/* webpackPrefetch: true */ "../projects/Projects"));
const Project = React.lazy(() => import(/* webpackPrefetch: true */ "../projects/Project"));
const Events = React.lazy(() => import(/* webpackPrefetch: true */ "../projects/Events"));
const ProjectSettings = React.lazy(() => import(/* webpackPrefetch: true */ "../projects/ProjectSettings"));
const ProjectVariables = React.lazy(() => import(/* webpackPrefetch: true */ "../projects/ProjectVariables"));
const Prebuilds = React.lazy(() => import(/* webpackPrefetch: true */ "../projects/Prebuilds"));
Expand Down Expand Up @@ -210,7 +209,6 @@ export const AppRoutes = () => {
<Route exact path="/sso" component={SSO} />

<Route exact path={`/projects/:projectSlug`} component={Project} />
<Route exact path={`/projects/:projectSlug/events`} component={Events} />
<Route exact path={`/projects/:projectSlug/prebuilds`} component={Prebuilds} />
<Route exact path={`/projects/:projectSlug/settings`} component={ProjectSettings} />
<Route exact path={`/projects/:projectSlug/variables`} component={ProjectVariables} />
Expand Down
236 changes: 0 additions & 236 deletions components/dashboard/src/projects/Events.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions components/gitpod-protocol/src/gitpod-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import {
PrebuildWithStatus,
StartPrebuildResult,
PartialProject,
PrebuildEvent,
OrganizationSettings,
} from "./teams-projects-protocol";
import { JsonRpcProxy, JsonRpcServer } from "./messaging/proxy-factory";
Expand Down Expand Up @@ -197,7 +196,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
deleteProject(projectId: string): Promise<void>;
getTeamProjects(teamId: string): Promise<Project[]>;
getProjectOverview(projectId: string): Promise<Project.Overview | undefined>;
getPrebuildEvents(projectId: string): Promise<PrebuildEvent[]>;
findPrebuilds(params: FindPrebuildsParams): Promise<PrebuildWithStatus[]>;
findPrebuildByWorkspaceID(workspaceId: string): Promise<PrebuiltWorkspace | undefined>;
getPrebuild(prebuildId: string): Promise<PrebuildWithStatus | undefined>;
Expand Down
13 changes: 0 additions & 13 deletions components/gitpod-protocol/src/teams-projects-protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import { PrebuiltWorkspaceState, WorkspaceClasses } from "./protocol";
import { v4 as uuidv4 } from "uuid";
import { DeepPartial } from "./util/deep-partial";
import { WebhookEvent } from "./webhook-event";

export interface ProjectConfig {
".gitpod.yml": string;
Expand Down Expand Up @@ -230,15 +229,3 @@ export interface TeamMembershipInvite {
/** This is a flag that triggers the HARD DELETION of this entity */
deleted?: boolean;
}

export interface PrebuildEvent {
id: string;
creationTime: string;
status: WebhookEvent.Status | WebhookEvent.PrebuildStatus;
message?: string;
prebuildId?: string;
projectId?: string;
cloneUrl?: string;
branch?: string;
commit?: string;
}
1 change: 0 additions & 1 deletion components/server/src/auth/rate-limiter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ const defaultFunctions: FunctionsConfig = {
trackLocation: { group: "default", points: 1 },
identifyUser: { group: "default", points: 1 },
getIDEOptions: { group: "default", points: 1 },
getPrebuildEvents: { group: "default", points: 1 },
getCostCenter: { group: "default", points: 1 },
setUsageLimit: { group: "default", points: 1 },
getSupportedWorkspaceClasses: { group: "default", points: 1 },
Expand Down
20 changes: 1 addition & 19 deletions components/server/src/projects/projects-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
*/

import { inject, injectable } from "inversify";
import { DBWithTracing, ProjectDB, TracedWorkspaceDB, WebhookEventDB, WorkspaceDB } from "@gitpod/gitpod-db/lib";
import { DBWithTracing, ProjectDB, TracedWorkspaceDB, WorkspaceDB } from "@gitpod/gitpod-db/lib";
import {
Branch,
PrebuildWithStatus,
CreateProjectParams,
FindPrebuildsParams,
Project,
User,
PrebuildEvent,
} from "@gitpod/gitpod-protocol";
import { HostContextProvider } from "../auth/host-context-provider";
import { RepoURL } from "../repohost";
Expand Down Expand Up @@ -41,7 +40,6 @@ export class ProjectsService {
@inject(TracedWorkspaceDB) private readonly workspaceDb: DBWithTracing<WorkspaceDB>,
@inject(HostContextProvider) private readonly hostContextProvider: HostContextProvider,
@inject(IAnalyticsWriter) private readonly analytics: IAnalyticsWriter,
@inject(WebhookEventDB) private readonly webhookEventDB: WebhookEventDB,
@inject(Authorizer) private readonly auth: Authorizer,
@inject(ScmService) private readonly scmService: ScmService,
) {}
Expand Down Expand Up @@ -426,22 +424,6 @@ export class ProjectsService {
return isOlderThan7Days(usage.lastWorkspaceStart);
}

async getPrebuildEvents(userId: string, projectId: string): Promise<PrebuildEvent[]> {
const project = await this.getProject(userId, projectId);
const events = await this.webhookEventDB.findByCloneUrl(project.cloneUrl, 100);
return events.map((we) => ({
id: we.id,
creationTime: we.creationTime,
cloneUrl: we.cloneUrl,
branch: we.branch,
commit: we.commit,
prebuildId: we.prebuildId,
projectId: we.projectId,
status: we.prebuildStatus || we.status,
message: we.message,
}));
}

private async migratePrebuildSettingsOnDemand(project: Project): Promise<Project> {
if (!!project.settings?.prebuilds) {
return project; // already migrated
Expand Down
13 changes: 0 additions & 13 deletions components/server/src/workspace/gitpod-server-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ import {
SnapshotContext,
SSHPublicKeyValue,
UserSSHPublicKeyValue,
PrebuildEvent,
RoleOrPermission,
WorkspaceInstanceRepoStatus,
GetProviderRepositoriesParams,
Expand Down Expand Up @@ -1310,18 +1309,6 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
return repositories;
}

public async getPrebuildEvents(ctx: TraceContext, projectId: string): Promise<PrebuildEvent[]> {
traceAPIParams(ctx, { projectId });
const user = await this.checkAndBlockUser("getPrebuildEvents");

const project = await this.projectsService.getProject(user.id, projectId);
await this.guardProjectOperation(user, projectId, "get");
await this.auth.checkPermissionOnProject(user.id, "read_prebuild", projectId);

const events = await this.projectsService.getPrebuildEvents(user.id, project.id);
return events;
}

async triggerPrebuild(
ctx: TraceContext,
projectId: string,
Expand Down

0 comments on commit aa691dd

Please sign in to comment.