diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index 04af17c..69b9af7 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -1,5 +1,10 @@ name: Builds description: Builds the repository and assumes the AWS IAM role for testing +inputs: + aws-region: + description: Region where the credentials will be assumed + required: false + default: us-east-1 runs: using: composite steps: @@ -24,4 +29,4 @@ runs: uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: ${{ steps.role-to-assume.outputs.arn }} - aws-region: us-east-1 \ No newline at end of file + aws-region: ${{ inputs.aws-region }} \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c3e1842..fc57308 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -132,3 +132,20 @@ jobs: secret-ids: JsonSecret - name: Assert Default Is No Json Secrets run: npm run integration-test __integration_tests__/parse_json_secrets.test.ts + + af-south-1-integration-test: + runs-on: ubuntu-latest + needs: unit-tests + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Build + uses: ./.github/actions/build + with: + aws-region: af-south-1 + - name: Act + uses: ./ + with: + secret-ids: JsonSecret + - name: Assert + run: npm run integration-test __integration_tests__/parse_json_secrets.test.ts diff --git a/src/index.ts b/src/index.ts index 4e0cd6e..e4f598b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,5 @@ -import * as core from '@actions/core' +import * as core from '@actions/core'; +import { setDefaultAutoSelectFamilyAttemptTimeout } from 'net'; import { SecretsManagerClient } from "@aws-sdk/client-secrets-manager"; import { buildSecretsList, @@ -13,6 +14,13 @@ import { CLEANUP_NAME } from "./constants"; export async function run(): Promise { try { + // Node 20 introduced automatic family selection for dual-stack endpoints. When the runner + // sits far away from the secrets manager endpoint it sometimes timeouts on negotiation between + // A and AAAA records. This behaviour was described in the https://github.com/nodejs/node/issues/54359 + // The default value is 250ms, increasing to 1s. The integration tests stops beeing flaky with this + // value. + setDefaultAutoSelectFamilyAttemptTimeout(1000); + // Default client region is set by configure-aws-credentials const client : SecretsManagerClient = new SecretsManagerClient({region: process.env.AWS_DEFAULT_REGION, customUserAgent: "github-action"}); const secretConfigInputs: string[] = [...new Set(core.getMultilineInput('secret-ids'))];