Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/aurora_performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,25 @@ jobs:

steps:
- name: Clone repository
uses: actions/checkout@v4
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
fetch-depth: 50

- name: "Set up JDK 8"
uses: actions/setup-java@v3
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
distribution: "corretto"
java-version: 8
- name: Set up Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "20.x"
node-version: "22.x"
- name: Install dependencies
run: npm install --no-save

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

- name: "Remove Github Action IP"
if: always()
Expand All @@ -73,7 +73,7 @@ jobs:

- name: Archive Performance results
if: always()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ matrix.db }}-performance-results
path: ./tests/integration/container/reports
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependabot_auto_merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve PR
Expand Down
99 changes: 85 additions & 14 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- main
- chore/remove-aliases
paths-ignore:
- '**/*.md'
- '**/*.jpg'
Expand Down Expand Up @@ -48,8 +49,8 @@ jobs:
environment: integration-tests
steps:
- run: echo "Fork PR approved by maintainer"
run-integration-tests:
name: Run Integration Tests
run-integration-tests-default:
name: Run Integration Tests (Default)
needs: [ approve, approve-fork ]
if: |
always() &&
Expand All @@ -59,29 +60,28 @@ jobs:
strategy:
fail-fast: false
matrix:
versions: [ "default", "latest" ]
dbEngine: ["aurora-mysql", "aurora-postgres", "multi-az-mysql", "multi-az-postgres" ]
dbEngine: ["aurora-mysql", "aurora-postgres"]

steps:
- name: 'Clone repository'
uses: actions/checkout@v4
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: "Set up JDK 8"
uses: actions/setup-java@v3
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
distribution: "corretto"
java-version: 8
- name: Set up Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "20.x"
node-version: "22.x"
- name: Install dependencies
run: npm install --no-save

- name: Configure AWS Credentials
id: creds
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@e7f100cf4c008499ea8adda475de1042d6975c7b # v6
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_DEPLOY_ROLE }}
role-session-name: nodejs_int_default_tests
Expand All @@ -97,13 +97,13 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ steps.creds.outputs.aws-access-key-id }}
AWS_SECRET_ACCESS_KEY: ${{ steps.creds.outputs.aws-secret-access-key }}
AWS_SESSION_TOKEN: ${{ steps.creds.outputs.aws-session-token }}
AURORA_MYSQL_DB_ENGINE_VERSION: ${{ matrix.dbEngine }}
AURORA_PG_DB_ENGINE_VERSION: ${{ matrix.versions }}
AURORA_MYSQL_DB_ENGINE_VERSION: default
AURORA_PG_DB_ENGINE_VERSION: default

- name: "Get Github Action IP"
if: always()
id: ip
uses: haythem/public-ip@v1.3
uses: haythem/public-ip@bdddd92c198b0955f0b494a8ebeac529754262ff # v1.3

- name: "Remove Github Action IP"
if: always()
Expand All @@ -117,8 +117,79 @@ jobs:

- name: Archive results
if: always()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: integration-report-default-${{ matrix.dbEngine }}-${{ matrix.versions}}
name: integration-report-default-${{ matrix.dbEngine }}
path: ./tests/integration/container/reports
retention-days: 5

run-integration-tests-latest:
name: Run Integration Tests (Latest)
runs-on: ubuntu-latest
needs: run-integration-tests-default
if: |
always() &&
needs.run-integration-tests-default.result == 'success'
strategy:
fail-fast: false
matrix:
dbEngine: ["aurora-mysql", "aurora-postgres" ]

steps:
- name: Clone repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: "Set up JDK 8"
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
distribution: "corretto"
java-version: 8
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "22.x"
- name: Install dependencies
run: npm install --no-save

- name: Configure AWS Credentials
id: creds
uses: aws-actions/configure-aws-credentials@e7f100cf4c008499ea8adda475de1042d6975c7b # v6
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_DEPLOY_ROLE }}
role-session-name: nodejs_int_latest_tests
role-duration-seconds: 21600
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
output-credentials: true

- name: Run Integration Tests
run: |
./gradlew --no-parallel --no-daemon test-${{ matrix.dbEngine }} --info
env:
RDS_DB_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
AWS_ACCESS_KEY_ID: ${{ steps.creds.outputs.aws-access-key-id }}
AWS_SECRET_ACCESS_KEY: ${{ steps.creds.outputs.aws-secret-access-key }}
AWS_SESSION_TOKEN: ${{ steps.creds.outputs.aws-session-token }}
AURORA_MYSQL_DB_ENGINE_VERSION: latest
AURORA_PG_DB_ENGINE_VERSION: latest

- name: "Get Github Action IP"
if: always()
id: ip
uses: haythem/public-ip@bdddd92c198b0955f0b494a8ebeac529754262ff # v1.3

- name: "Remove Github Action IP"
if: always()
run: |
aws ec2 revoke-security-group-ingress \
--group-name default \
--protocol -1 \
--port -1 \
--cidr ${{ steps.ip.outputs.ipv4 }}/32 \
2>&1 > /dev/null;

- name: Archive results
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: integration-report-latest-${{ matrix.dbEngine }}
path: ./tests/integration/container/reports
retention-days: 5
7 changes: 4 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
pull_request:
branches:
- "*"
- dev/v3

permissions:
contents: read
Expand All @@ -15,11 +16,11 @@ jobs:
run-checks-and-unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Set up Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "20.x"
node-version: "22.x"
- name: Install dependencies
run: npm install --no-save
- name: Run eslint - linting
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
packages: write
steps:
- name: "Clone Repository"
uses: actions/checkout@v4
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: "Set up Node.js"
uses: actions/setup-node@v4
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "20.x"
node-version: "22.x"
registry-url: "https://registry.npmjs.org"
- name: "Install dependencies"
run: npm install --no-save
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release_draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: "Clone Repository"
uses: actions/checkout@v4
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: "Set up Node.js"
uses: actions/setup-node@v4
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "20.x"
node-version: "22.x"
- name: "Install dependencies"
run: npm install --no-save
- name: "Run eslint - linting"
Expand All @@ -46,7 +46,7 @@ jobs:
touch RELEASE_DETAILS.md
echo "$RELEASE_DETAILS" > RELEASE_DETAILS.md
- name: "Upload to Draft Release"
uses: ncipollo/release-action@v1
uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1
with:
draft: true
name: "AWS Advanced NodeJS Wrapper - v${{ env.RELEASE_VERSION }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/remove-old-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

steps:
- name: Remove Old Artifacts
uses: c-hive/gha-remove-artifacts@v1
uses: c-hive/gha-remove-artifacts@44fc7acaf1b3d0987da0e8d4707a989d80e9554b # v1
with:
age: "1 week"
skip-tags: true
14 changes: 7 additions & 7 deletions .github/workflows/run-autoscaling-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ jobs:
dbEngine: [ "mysql", "postgres" ]
steps:
- name: Clone repository
uses: actions/checkout@v4
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
fetch-depth: 50
- name: "Set up JDK 8"
uses: actions/setup-java@v3
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
distribution: "corretto"
java-version: 8
- name: Set up Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "20.x"
node-version: "22.x"
- name: Configure AWS credentials
id: creds
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@e7f100cf4c008499ea8adda475de1042d6975c7b # v6
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_DEPLOY_ROLE }}
role-session-name: nodejs_autoscaling_tests
Expand All @@ -56,7 +56,7 @@ jobs:
- name: "Get Github Action IP"
if: always()
id: ip
uses: haythem/public-ip@v1.3
uses: haythem/public-ip@bdddd92c198b0955f0b494a8ebeac529754262ff # v1.3
- name: "Remove Github Action IP"
if: always()
run: |
Expand All @@ -68,7 +68,7 @@ jobs:
2>&1 > /dev/null;
- name: Archive results
if: always()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: autoscaling-report
path: ./tests/integration/container/reports
Expand Down
24 changes: 11 additions & 13 deletions common/lib/authentication/aws_secrets_manager_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class AwsSecretsManagerPlugin extends AbstractConnectionPlugin implements
private static readonly TELEMETRY_UPDATE_SECRETS = "fetch credentials";
private static readonly TELEMETRY_FETCH_CREDENTIALS_COUNTER = "secretsManager.fetchCredentials.count";
private static SUBSCRIBED_METHODS: Set<string> = new Set<string>(["connect", "forceConnect"]);
private static SECRETS_ARN_PATTERN: RegExp = new RegExp("^arn:aws:secretsmanager:(?<region>[^:\\n]*):[^:\\n]*:([^:/\\n]*[:/])?(.*)$");
private static SECRETS_ARN_PATTERN: RegExp = new RegExp("^arn:aws[^:]*:secretsmanager:(?<region>[^:\\n]*):[^:\\n]*:([^:/\\n]*[:/])?(.*)$");
private readonly pluginService: PluginService;
private readonly fetchCredentialsCounter;
private readonly expirationSec: number;
Expand Down Expand Up @@ -129,20 +129,18 @@ export class AwsSecretsManagerPlugin extends AbstractConnectionPlugin implements
this.pluginService.updateConfigWithProperties(props);
return await connectFunc();
} catch (error) {
if (error instanceof Error) {
if ((error.message.includes("password authentication failed") || error.message.includes("Access denied")) && !secretWasFetched) {
// Login unsuccessful with cached credentials
// Try to re-fetch credentials and try again

secretWasFetched = await this.updateSecret(true);
if (secretWasFetched) {
WrapperProperties.USER.set(props, this.secret?.username ?? "");
WrapperProperties.PASSWORD.set(props, this.secret?.password ?? "");
return await connectFunc();
}
if ((error.message.includes("password authentication failed") || error.message.includes("Access denied")) && !secretWasFetched) {
// Login unsuccessful with cached credentials
// Try to re-fetch credentials and try again

secretWasFetched = await this.updateSecret(true);
if (secretWasFetched) {
WrapperProperties.USER.set(props, this.secret?.username ?? "");
WrapperProperties.PASSWORD.set(props, this.secret?.password ?? "");
return await connectFunc();
}
logger.debug(Messages.get("AwsSecretsManagerConnectionPlugin.unhandledError", error.name, error.message));
}
logger.debug(Messages.get("AwsSecretsManagerConnectionPlugin.unhandledError", error.name, error.message));
throw error;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@
*/

import { ConnectionPluginFactory } from "../plugin_factory";
import { PluginService } from "../plugin_service";
import { ConnectionPlugin } from "../connection_plugin";
import { AwsWrapperError } from "../utils/errors";
import { Messages } from "../utils/messages";
import { FullServicesContainer } from "../utils/full_services_container";

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

async getInstance(pluginService: PluginService, properties: Map<string, any>): Promise<ConnectionPlugin> {
async getInstance(servicesContainer: FullServicesContainer, properties: Map<string, any>): Promise<ConnectionPlugin> {
try {
if (!AwsSecretsManagerPluginFactory.awsSecretsManagerPlugin) {
AwsSecretsManagerPluginFactory.awsSecretsManagerPlugin = await import("./aws_secrets_manager_plugin");
}
return new AwsSecretsManagerPluginFactory.awsSecretsManagerPlugin.AwsSecretsManagerPlugin(pluginService, new Map(properties));
return new AwsSecretsManagerPluginFactory.awsSecretsManagerPlugin.AwsSecretsManagerPlugin(servicesContainer.pluginService, new Map(properties));
} catch (error: any) {
if (error.code === "MODULE_NOT_FOUND") {
throw new AwsWrapperError(Messages.get("ConnectionPluginChainBuilder.errorImportingPlugin", error.message, "AwsSecretsManagerPlugin"));
Expand Down
Loading
Loading