Skip to content

Commit 1ac8fbe

Browse files
authored
[server] Bump dependencies avoid pulling 'agent-base' < 6.0.0 (#2388)
* [server] Bump dependencies avoid pulling 'agent-base' < 6.0.0 * [server] Remove patch-agent-base and references * [server] Cleanup: yarn.lock
1 parent a495679 commit 1ac8fbe

File tree

9 files changed

+2567
-1723
lines changed

9 files changed

+2567
-1723
lines changed

components/server/ee/src/container-module.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import { WorkspaceFactoryEE } from "./workspace/workspace-factory";
3636
import { MonitoringEndpointsAppEE } from "./monitoring-endpoint-ee";
3737
import { MonitoringEndpointsApp } from "../../src/monitoring-endpoints";
3838
import { WorkspaceHealthMonitoring } from "./workspace/workspace-health-monitoring";
39+
import { Env } from "../../src/env";
3940

4041
export const productionEEContainerModule = new ContainerModule((bind, unbind, isBound, rebind) => {
4142
rebind(Server).to(ServerEE).inSingletonScope();
@@ -52,7 +53,11 @@ export const productionEEContainerModule = new ContainerModule((bind, unbind, is
5253
bind(PrebuildRateLimiter).toSelf().inSingletonScope();
5354
bind(PrebuildQueueMaintainer).toSelf().inSingletonScope();
5455
bind(IPrefixContextParser).to(StartPrebuildContextParser).inSingletonScope();
55-
bind(GithubApp).toSelf().inSingletonScope();
56+
bind(GithubApp).toDynamicValue(ctx => {
57+
const env = ctx.container.get<Env>(Env);
58+
const prebuildStatusMaintainer = ctx.container.get<PrebuildStatusMaintainer>(PrebuildStatusMaintainer);
59+
return new GithubApp(env, prebuildStatusMaintainer);
60+
}).inSingletonScope();
5661
bind(GithubAppRules).toSelf().inSingletonScope();
5762
bind(PrebuildStatusMaintainer).toSelf().inSingletonScope();
5863
bind(GitLabApp).toSelf().inSingletonScope();

components/server/ee/src/prebuilds/github-app.ts

+15-11
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* See License.enterprise.txt in the project root folder.
55
*/
66

7-
import { Probot, Application, Context } from 'probot';
8-
import { findPrivateKey } from 'probot/lib/private-key';
7+
import { Probot, Context } from 'probot';
8+
import { getPrivateKey } from '@probot/get-private-key';
99
import * as fs from 'fs-extra';
1010
import { injectable, inject, decorate } from 'inversify';
1111
import { Env } from '../../../src/env';
@@ -24,6 +24,7 @@ import { TraceContext } from '@gitpod/gitpod-protocol/lib/util/tracing';
2424
import { TracedWorkspaceDB, DBWithTracing } from '@gitpod/gitpod-db/lib/traced-db';
2525
import { PrebuildManager } from './prebuild-manager';
2626
import { PrebuildStatusMaintainer } from './prebuilt-status-maintainer';
27+
import { ApplicationFunctionOptions } from 'probot/lib/types';
2728

2829
/**
2930
* GitHub app urls:
@@ -53,7 +54,7 @@ export class GithubApp extends Probot {
5354
) {
5455
super({
5556
id: env.githubAppAppID,
56-
cert: GithubApp.loadPrivateKey(env.githubAppCertPath),
57+
privateKey: GithubApp.loadPrivateKey(env.githubAppCertPath),
5758
secret: env.githubAppWebhookSecret
5859
});
5960
log.debug("Starting GitHub app integration", {
@@ -65,7 +66,8 @@ export class GithubApp extends Probot {
6566
this.load(this.buildApp.bind(this));
6667
}
6768

68-
protected async buildApp(app: Application) {
69+
protected async buildApp(options: ApplicationFunctionOptions) {
70+
const app = options.app;
6971
this.statusMaintainer.start(async id => (await app.auth(parseInt(id))) as any as Octokit);
7072
// this.queueMaintainer.start();
7173

@@ -105,14 +107,17 @@ export class GithubApp extends Probot {
105107
});
106108

107109
app.on('installation.created', async ctx => {
108-
const authId: string = ctx.payload.installation.account.id;
109-
const user = await this.userDB.findUserByIdentity({ authProviderId: this.env.githubAppAuthProviderId, authId });
110+
const accountId: string = `${ctx.payload.installation.account.id}`;
111+
const installationId = `${ctx.payload.installation.id}`;
112+
const senderId = `${ctx.payload.sender.id}`;
113+
const user = await this.userDB.findUserByIdentity({ authProviderId: this.env.githubAppAuthProviderId, authId: accountId });
110114
const userId = user ? user.id : undefined;
111-
await this.appInstallationDB.recordNewInstallation("github", 'platform', ctx.payload.installation.id, userId, ctx.payload.sender.id);
115+
await this.appInstallationDB.recordNewInstallation("github", 'platform', installationId, userId, senderId);
112116
log.debug({ userId }, "New installation recorded", { userId, platformUserId: ctx.payload.sender.id })
113117
});
114118
app.on('installation.deleted', async ctx => {
115-
await this.appInstallationDB.recordUninstallation("github", 'platform', ctx.payload.installation.id);
119+
const installationId = `${ctx.payload.installation.id}`;
120+
await this.appInstallationDB.recordUninstallation("github", 'platform', installationId);
116121
});
117122

118123
app.on('push', async ctx => {
@@ -412,14 +417,13 @@ export namespace GithubApp {
412417
}
413418

414419
// loadPrivateKey is used in super call - must not be async
415-
if (filename && fs.existsSync(filename)) {
416-
const key = findPrivateKey(filename);
420+
if (fs.existsSync(filename)) {
421+
const key = getPrivateKey({ filepath: filename });
417422
if (key) {
418423
return key.toString();
419424
}
420425
}
421426
}
422-
423427
}
424428

425429
class PrebuildListener {

components/server/package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,17 @@
2727
"/dist"
2828
],
2929
"dependencies": {
30+
"@gitbeaker/node": "^25.6.0",
3031
"@gitpod/content-service": "0.1.5",
3132
"@gitpod/gitpod-db": "0.1.5",
3233
"@gitpod/gitpod-messagebus": "0.1.5",
3334
"@gitpod/gitpod-protocol": "0.1.5",
3435
"@gitpod/image-builder": "0.1.5",
3536
"@gitpod/licensor": "0.1.5",
3637
"@gitpod/ws-manager": "0.1.5",
37-
"@google-cloud/storage": "^2.5.0",
38+
"@google-cloud/storage": "^5.6.0",
3839
"@octokit/rest": "16.35.0",
39-
"agent-base": "4.2.1",
40+
"@probot/get-private-key": "^1.1.0",
4041
"amqplib": "^0.5.2",
4142
"base-64": "^0.1.0",
4243
"bitbucket": "^2.4.2",
@@ -50,7 +51,6 @@
5051
"express-mysql-session": "^2.1.0",
5152
"express-session": "^1.15.6",
5253
"fs-extra": "^6.0.1",
53-
"@gitbeaker/node": "^25.6.0",
5454
"google-protobuf": "^3.8.0-rc.1",
5555
"graphql": "^14.6.0",
5656
"graphql-tools": "^4.0.7",
@@ -69,7 +69,7 @@
6969
"passport-dummy": "^0.0.1",
7070
"passport-gitlab2": "5.0.0",
7171
"passport-http": "^0.3.0",
72-
"probot": "^7.4.0",
72+
"probot": "^10.17.2",
7373
"prom-client": "^10.2.0",
7474
"rasha": "^1.2.5",
7575
"reflect-metadata": "^0.1.10",
@@ -81,10 +81,10 @@
8181
"ws": "^5.2.2"
8282
},
8383
"devDependencies": {
84-
"@graphql-codegen/cli": "^1.13.1",
85-
"@graphql-codegen/introspection": "^1.13.1",
86-
"@graphql-codegen/typescript": "^1.13.1",
87-
"@graphql-codegen/typescript-resolvers": "^1.13.1",
84+
"@graphql-codegen/cli": "^1.19.4",
85+
"@graphql-codegen/introspection": "^1.18.1",
86+
"@graphql-codegen/typescript": "^1.19.0",
87+
"@graphql-codegen/typescript-resolvers": "^1.18.0",
8888
"@types/amqplib": "^0.5.7",
8989
"@types/assert": "^0.0.31",
9090
"@types/base-64": "^0.1.2",

components/server/src/gitlab/gitlab-context-parser.spec.ts

-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ import { HostContextProvider } from "../auth/host-context-provider";
2121
import { skipIfEnvVarNotSet } from "@gitpod/gitpod-protocol/lib/util/skip-if";
2222

2323

24-
import "../patch-agent-base";
25-
2624
@suite(timeout(10000), retries(2), skipIfEnvVarNotSet("GITPOD_TEST_TOKEN_GITLAB"))
2725
class TestGitlabContextParser {
2826

components/server/src/init.ts

-4
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,3 @@ export async function start(container: Container) {
8989
await server.stop();
9090
});
9191
}
92-
93-
// The module `[email protected]` contains a bad patch for nodejs, this should fix it.
94-
// cf. https://github.com/gitpod-io/gitpod/pull/2375
95-
import "./patch-agent-base";

components/server/src/patch-agent-base.ts

-22
This file was deleted.

components/server/src/storage/gcloud-storage-client.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import { injectable } from "inversify";
88
import { Storage, GetSignedUrlConfig } from "@google-cloud/storage";
9-
import { Response } from 'request';
9+
import { Response } from 'teeny-request';
1010
import { log } from '@gitpod/gitpod-protocol/lib/util/logging';
1111
import { StorageClient, CreateSignedUrlOptions } from "./storage-client";
1212
import { getBucketNamePrefix } from "./commons";

components/server/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"downlevelIteration": true,
1616
"module": "commonjs",
1717
"moduleResolution": "node",
18-
"target": "es5",
18+
"target": "es6",
1919
"jsx": "react",
2020
"sourceMap": true,
2121
"declaration": true,

0 commit comments

Comments
 (0)