feat(techdocs): add support for AWS S3 retries in publisher (#28446)

This change is to allow a configurable retry in Backstage TechDocs AWS S3 publisher.

It introduces a new possible option for techdocs-cli publish called --awsMaxAttempts. This configuration when specified as a number translates to maxAttempts that is compatible with aws-sdk/client-s3 (JavaScript v3) S3Client class. The change will not break existing configuration setups - maxAttempts is optional and fallbacks to already existing defaults if not specified.

Signed-off-by: Laimis Juzeliūnas <asnelaimis@gmail.com>
This commit is contained in:
Laimis Juzeliūnas
2025-01-14 20:15:16 +02:00
committed by GitHub
parent f06fdd875c
commit 8de3d2d53d
6 changed files with 21 additions and 0 deletions
@@ -164,12 +164,18 @@ export class AwsS3Publish implements PublisherBase {
'techdocs.publisher.awsS3.s3ForcePathStyle',
);
// AWS MAX ATTEMPTS is an optional config. If missing, default value of 3 is used
const maxAttempts = config.getOptionalNumber(
'techdocs.publisher.awsS3.maxAttempts',
);
const storageClient = new S3Client({
customUserAgent: 'backstage-aws-techdocs-s3-publisher',
credentialDefaultProvider: () => sdkCredentialProvider,
...(region && { region }),
...(endpoint && { endpoint }),
...(forcePathStyle && { forcePathStyle }),
...(maxAttempts && { maxAttempts }),
...(httpsProxy && {
requestHandler: new NodeHttpHandler({
httpsAgent: new HttpsProxyAgent({ proxy: httpsProxy }),