Skip to content

Commit f0b83b2

Browse files
authored
Increasing auto select family attempt timeout (#205)
1 parent 4e95aaf commit f0b83b2

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

.github/actions/build/action.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
name: Builds
22
description: Builds the repository and assumes the AWS IAM role for testing
3+
inputs:
4+
aws-region:
5+
description: Region where the credentials will be assumed
6+
required: false
7+
default: us-east-1
38
runs:
49
using: composite
510
steps:
@@ -24,4 +29,4 @@ runs:
2429
uses: aws-actions/configure-aws-credentials@v4
2530
with:
2631
role-to-assume: ${{ steps.role-to-assume.outputs.arn }}
27-
aws-region: us-east-1
32+
aws-region: ${{ inputs.aws-region }}

.github/workflows/tests.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,20 @@ jobs:
132132
secret-ids: JsonSecret
133133
- name: Assert Default Is No Json Secrets
134134
run: npm run integration-test __integration_tests__/parse_json_secrets.test.ts
135+
136+
af-south-1-integration-test:
137+
runs-on: ubuntu-latest
138+
needs: unit-tests
139+
steps:
140+
- name: Checkout
141+
uses: actions/checkout@v4
142+
- name: Build
143+
uses: ./.github/actions/build
144+
with:
145+
aws-region: af-south-1
146+
- name: Act
147+
uses: ./
148+
with:
149+
secret-ids: JsonSecret
150+
- name: Assert
151+
run: npm run integration-test __integration_tests__/parse_json_secrets.test.ts

src/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import * as core from '@actions/core'
1+
import * as core from '@actions/core';
2+
import { setDefaultAutoSelectFamilyAttemptTimeout } from 'net';
23
import { SecretsManagerClient } from "@aws-sdk/client-secrets-manager";
34
import {
45
buildSecretsList,
@@ -13,6 +14,13 @@ import { CLEANUP_NAME } from "./constants";
1314

1415
export async function run(): Promise<void> {
1516
try {
17+
// Node 20 introduced automatic family selection for dual-stack endpoints. When the runner
18+
// sits far away from the secrets manager endpoint it sometimes timeouts on negotiation between
19+
// A and AAAA records. This behaviour was described in the https://github.com/nodejs/node/issues/54359
20+
// The default value is 250ms, increasing to 1s. The integration tests stops beeing flaky with this
21+
// value.
22+
setDefaultAutoSelectFamilyAttemptTimeout(1000);
23+
1624
// Default client region is set by configure-aws-credentials
1725
const client : SecretsManagerClient = new SecretsManagerClient({region: process.env.AWS_DEFAULT_REGION, customUserAgent: "github-action"});
1826
const secretConfigInputs: string[] = [...new Set(core.getMultilineInput('secret-ids'))];

0 commit comments

Comments
 (0)