Skip to content

Commit 6de1f95

Browse files
authored
feat: gdb support (#685)
1 parent 3bc2bc6 commit 6de1f95

255 files changed

Lines changed: 12570 additions & 5800 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/aurora_performance.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,25 @@ jobs:
1818

1919
steps:
2020
- name: Clone repository
21-
uses: actions/checkout@v4
21+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
2222
with:
2323
fetch-depth: 50
2424

2525
- name: "Set up JDK 8"
26-
uses: actions/setup-java@v3
26+
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
2727
with:
2828
distribution: "corretto"
2929
java-version: 8
3030
- name: Set up Node.js
31-
uses: actions/setup-node@v4
31+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
3232
with:
3333
node-version: "22.x"
3434
- name: Install dependencies
3535
run: npm install --no-save
3636

3737
- name: Configure AWS Credentials
3838
id: creds
39-
uses: aws-actions/configure-aws-credentials@v4
39+
uses: aws-actions/configure-aws-credentials@e7f100cf4c008499ea8adda475de1042d6975c7b # v6
4040
with:
4141
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_DEPLOY_ROLE }}
4242
role-session-name: nodejs_aurora_perf_tests
@@ -59,7 +59,7 @@ jobs:
5959
- name: "Get Github Action IP"
6060
if: always()
6161
id: ip
62-
uses: haythem/public-ip@v1.3
62+
uses: haythem/public-ip@bdddd92c198b0955f0b494a8ebeac529754262ff # v1.3
6363

6464
- name: "Remove Github Action IP"
6565
if: always()
@@ -73,7 +73,7 @@ jobs:
7373
7474
- name: Archive Performance results
7575
if: always()
76-
uses: actions/upload-artifact@v4
76+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
7777
with:
7878
name: ${{ matrix.db }}-performance-results
7979
path: ./tests/integration/container/reports

.github/workflows/dependabot_auto_merge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
steps:
1818
- name: Dependabot metadata
1919
id: metadata
20-
uses: dependabot/fetch-metadata@v1
20+
uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v2
2121
with:
2222
github-token: "${{ secrets.GITHUB_TOKEN }}"
2323
- name: Approve PR

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ jobs:
1515
run-checks-and-unit-tests:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
1919
- name: Set up Node.js
20-
uses: actions/setup-node@v4
20+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
2121
with:
2222
node-version: "22.x"
2323
- name: Install dependencies

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ jobs:
1111
contents: read
1212
steps:
1313
- name: "Clone Repository"
14-
uses: actions/checkout@v4
14+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
1515
- name: "Set up Node.js"
16-
uses: actions/setup-node@v4
16+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
1717
with:
1818
node-version: "24"
1919
registry-url: "https://registry.npmjs.org"

.github/workflows/release_draft.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ jobs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- name: "Clone Repository"
22-
uses: actions/checkout@v4
22+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
2323
- name: "Set up Node.js"
24-
uses: actions/setup-node@v4
24+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
2525
with:
2626
node-version: "22.x"
2727
- name: "Install dependencies"
@@ -46,7 +46,7 @@ jobs:
4646
touch RELEASE_DETAILS.md
4747
echo "$RELEASE_DETAILS" > RELEASE_DETAILS.md
4848
- name: "Upload to Draft Release"
49-
uses: ncipollo/release-action@v1
49+
uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1
5050
with:
5151
draft: true
5252
name: "AWS Advanced NodeJS Wrapper - v${{ env.RELEASE_VERSION }}"

.github/workflows/remove-old-artifacts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
steps:
1717
- name: Remove Old Artifacts
18-
uses: c-hive/gha-remove-artifacts@v1
18+
uses: c-hive/gha-remove-artifacts@44fc7acaf1b3d0987da0e8d4707a989d80e9554b # v1
1919
with:
2020
age: "1 week"
2121
skip-tags: true

.github/workflows/run-autoscaling-tests.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,21 @@ jobs:
2121
dbEngine: [ "mysql", "postgres" ]
2222
steps:
2323
- name: Clone repository
24-
uses: actions/checkout@v4
24+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
2525
with:
2626
fetch-depth: 50
2727
- name: "Set up JDK 8"
28-
uses: actions/setup-java@v3
28+
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
2929
with:
3030
distribution: "corretto"
3131
java-version: 8
3232
- name: Set up Node.js
33-
uses: actions/setup-node@v4
33+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
3434
with:
3535
node-version: "22.x"
3636
- name: Configure AWS credentials
3737
id: creds
38-
uses: aws-actions/configure-aws-credentials@v4
38+
uses: aws-actions/configure-aws-credentials@e7f100cf4c008499ea8adda475de1042d6975c7b # v6
3939
with:
4040
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_DEPLOY_ROLE }}
4141
role-session-name: nodejs_autoscaling_tests
@@ -56,7 +56,7 @@ jobs:
5656
- name: "Get Github Action IP"
5757
if: always()
5858
id: ip
59-
uses: haythem/public-ip@v1.3
59+
uses: haythem/public-ip@bdddd92c198b0955f0b494a8ebeac529754262ff # v1.3
6060
- name: "Remove Github Action IP"
6161
if: always()
6262
run: |
@@ -68,7 +68,7 @@ jobs:
6868
2>&1 > /dev/null;
6969
- name: Archive results
7070
if: always()
71-
uses: actions/upload-artifact@v4
71+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
7272
with:
7373
name: autoscaling-report
7474
path: ./tests/integration/container/reports

common/lib/authentication/aws_secrets_manager_plugin.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class AwsSecretsManagerPlugin extends AbstractConnectionPlugin implements
3737
private static readonly TELEMETRY_UPDATE_SECRETS = "fetch credentials";
3838
private static readonly TELEMETRY_FETCH_CREDENTIALS_COUNTER = "secretsManager.fetchCredentials.count";
3939
private static SUBSCRIBED_METHODS: Set<string> = new Set<string>(["connect", "forceConnect"]);
40-
private static SECRETS_ARN_PATTERN: RegExp = new RegExp("^arn:aws:secretsmanager:(?<region>[^:\\n]*):[^:\\n]*:([^:/\\n]*[:/])?(.*)$");
40+
private static SECRETS_ARN_PATTERN: RegExp = new RegExp("^arn:aws[^:]*:secretsmanager:(?<region>[^:\\n]*):[^:\\n]*:([^:/\\n]*[:/])?(.*)$");
4141
private readonly pluginService: PluginService;
4242
private readonly fetchCredentialsCounter;
4343
private readonly expirationSec: number;
@@ -129,20 +129,18 @@ export class AwsSecretsManagerPlugin extends AbstractConnectionPlugin implements
129129
this.pluginService.updateConfigWithProperties(props);
130130
return await connectFunc();
131131
} catch (error) {
132-
if (error instanceof Error) {
133-
if ((error.message.includes("password authentication failed") || error.message.includes("Access denied")) && !secretWasFetched) {
134-
// Login unsuccessful with cached credentials
135-
// Try to re-fetch credentials and try again
136-
137-
secretWasFetched = await this.updateSecret(true);
138-
if (secretWasFetched) {
139-
WrapperProperties.USER.set(props, this.secret?.username ?? "");
140-
WrapperProperties.PASSWORD.set(props, this.secret?.password ?? "");
141-
return await connectFunc();
142-
}
132+
if ((error.message.includes("password authentication failed") || error.message.includes("Access denied")) && !secretWasFetched) {
133+
// Login unsuccessful with cached credentials
134+
// Try to re-fetch credentials and try again
135+
136+
secretWasFetched = await this.updateSecret(true);
137+
if (secretWasFetched) {
138+
WrapperProperties.USER.set(props, this.secret?.username ?? "");
139+
WrapperProperties.PASSWORD.set(props, this.secret?.password ?? "");
140+
return await connectFunc();
143141
}
144-
logger.debug(Messages.get("AwsSecretsManagerConnectionPlugin.unhandledError", error.name, error.message));
145142
}
143+
logger.debug(Messages.get("AwsSecretsManagerConnectionPlugin.unhandledError", `${error.name}: ${error.message}`));
146144
throw error;
147145
}
148146
}

common/lib/authentication/aws_secrets_manager_plugin_factory.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@
1515
*/
1616

1717
import { ConnectionPluginFactory } from "../plugin_factory";
18-
import { PluginService } from "../plugin_service";
1918
import { ConnectionPlugin } from "../connection_plugin";
2019
import { AwsWrapperError } from "../utils/errors";
2120
import { Messages } from "../utils/messages";
21+
import { FullServicesContainer } from "../utils/full_services_container";
2222

2323
export class AwsSecretsManagerPluginFactory extends ConnectionPluginFactory {
2424
private static awsSecretsManagerPlugin: any;
2525

26-
async getInstance(pluginService: PluginService, properties: Map<string, any>): Promise<ConnectionPlugin> {
26+
async getInstance(servicesContainer: FullServicesContainer, properties: Map<string, any>): Promise<ConnectionPlugin> {
2727
try {
2828
if (!AwsSecretsManagerPluginFactory.awsSecretsManagerPlugin) {
2929
AwsSecretsManagerPluginFactory.awsSecretsManagerPlugin = await import("./aws_secrets_manager_plugin");
3030
}
31-
return new AwsSecretsManagerPluginFactory.awsSecretsManagerPlugin.AwsSecretsManagerPlugin(pluginService, new Map(properties));
31+
return new AwsSecretsManagerPluginFactory.awsSecretsManagerPlugin.AwsSecretsManagerPlugin(servicesContainer.pluginService, new Map(properties));
3232
} catch (error: any) {
3333
if (error.code === "MODULE_NOT_FOUND") {
3434
throw new AwsWrapperError(Messages.get("ConnectionPluginChainBuilder.errorImportingPlugin", error.message, "AwsSecretsManagerPlugin"));

common/lib/authentication/iam_authentication_plugin.ts

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,26 @@ import { IamAuthUtils, TokenInfo } from "../utils/iam_auth_utils";
2626
import { ClientWrapper } from "../client_wrapper";
2727
import { RegionUtils } from "../utils/region_utils";
2828
import { CanReleaseResources } from "../can_release_resources";
29+
import { RdsUrlType } from "../utils/rds_url_type";
30+
import { RdsUtils } from "../utils/rds_utils";
31+
import { GDBRegionUtils } from "../utils/gdb_region_utils";
2932

3033
export class IamAuthenticationPlugin extends AbstractConnectionPlugin implements CanReleaseResources {
3134
private static readonly SUBSCRIBED_METHODS = new Set<string>(["connect", "forceConnect"]);
3235
protected static readonly tokenCache = new Map<string, TokenInfo>();
3336
private readonly telemetryFactory;
3437
private readonly fetchTokenCounter;
35-
private pluginService: PluginService;
38+
private readonly pluginService: PluginService;
39+
private readonly rdsUtils: RdsUtils = new RdsUtils();
40+
protected regionUtils: RegionUtils;
41+
protected readonly iamAuthUtils: IamAuthUtils;
3642

37-
constructor(pluginService: PluginService) {
43+
constructor(pluginService: PluginService, iamAuthUtils: IamAuthUtils = new IamAuthUtils()) {
3844
super();
3945
this.pluginService = pluginService;
4046
this.telemetryFactory = this.pluginService.getTelemetryFactory();
4147
this.fetchTokenCounter = this.telemetryFactory.createCounter("iam.fetchTokenCount");
48+
this.iamAuthUtils = iamAuthUtils;
4249
}
4350

4451
getSubscribedMethods(): Set<string> {
@@ -74,14 +81,22 @@ export class IamAuthenticationPlugin extends AbstractConnectionPlugin implements
7481
throw new AwsWrapperError(`${WrapperProperties.USER.name} is null or empty`);
7582
}
7683

77-
const host = IamAuthUtils.getIamHost(props, hostInfo);
78-
const region: string = RegionUtils.getRegion(props.get(WrapperProperties.IAM_REGION.name), host);
79-
const port = IamAuthUtils.getIamPort(props, hostInfo, this.pluginService.getCurrentClient().defaultPort);
84+
const host = this.iamAuthUtils.getIamHost(props, hostInfo);
85+
const port = this.iamAuthUtils.getIamPort(props, hostInfo, this.pluginService.getCurrentClient().defaultPort);
86+
87+
const type: RdsUrlType = this.rdsUtils.identifyRdsType(host.host);
88+
this.regionUtils = type == RdsUrlType.RDS_GLOBAL_WRITER_CLUSTER ? new GDBRegionUtils() : new RegionUtils();
89+
const region: string | null = await this.regionUtils.getRegion(WrapperProperties.IAM_REGION.name, host, props);
90+
91+
if (!region) {
92+
throw new AwsWrapperError(Messages.get("SamlAuthPlugin.unableToDetermineRegion", WrapperProperties.IAM_REGION.name));
93+
}
94+
8095
const tokenExpirationSec = WrapperProperties.IAM_TOKEN_EXPIRATION.get(props);
8196
if (tokenExpirationSec < 0) {
8297
throw new AwsWrapperError(Messages.get("AuthenticationToken.tokenExpirationLessThanZero"));
8398
}
84-
const cacheKey: string = IamAuthUtils.getCacheKey(port, user, host, region);
99+
const cacheKey: string = this.iamAuthUtils.getCacheKey(port, user, host.host, region);
85100

86101
const tokenInfo = IamAuthenticationPlugin.tokenCache.get(cacheKey);
87102
const isCachedToken: boolean = tokenInfo !== undefined && !tokenInfo.isExpired();
@@ -91,8 +106,8 @@ export class IamAuthenticationPlugin extends AbstractConnectionPlugin implements
91106
WrapperProperties.PASSWORD.set(props, tokenInfo.token);
92107
} else {
93108
const tokenExpiry: number = Date.now() + tokenExpirationSec * 1000;
94-
const token = await IamAuthUtils.generateAuthenticationToken(
95-
host,
109+
const token = await this.iamAuthUtils.generateAuthenticationToken(
110+
host.host,
96111
port,
97112
region,
98113
user,
@@ -118,8 +133,8 @@ export class IamAuthenticationPlugin extends AbstractConnectionPlugin implements
118133
// Try to generate a new token and try to connect again
119134

120135
const tokenExpiry: number = Date.now() + tokenExpirationSec * 1000;
121-
const token = await IamAuthUtils.generateAuthenticationToken(
122-
host,
136+
const token = await this.iamAuthUtils.generateAuthenticationToken(
137+
host.host,
123138
port,
124139
region,
125140
user,

0 commit comments

Comments
 (0)