Skip to content

Commit

Permalink
Increasing auto select family attempt timeout (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
jirkafajfr authored Oct 11, 2024
1 parent 4e95aaf commit f0b83b2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
7 changes: 6 additions & 1 deletion .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
aws-region: ${{ inputs.aws-region }}
17 changes: 17 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 9 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -13,6 +14,13 @@ import { CLEANUP_NAME } from "./constants";

export async function run(): Promise<void> {
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'))];
Expand Down

0 comments on commit f0b83b2

Please sign in to comment.