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
@@ -196,6 +196,10 @@ export function registerCommands(program: Command) {
'--awsBucketRootPath <AWS BUCKET ROOT PATH>',
'Optional sub-directory to store files in Amazon S3',
)
.option(
'--awsMaxAttempts <AWS MAX ATTEMPTS>',
'Optional maximum number of retries for AWS S3 operations. If not specified, default value of 3 is used.',
)
.option(
'--osCredentialId <OPENSTACK SWIFT APPLICATION CREDENTIAL ID>',
'(Required for OpenStack) specify when --publisher-type openStackSwift',
@@ -95,6 +95,9 @@ export class PublisherConfig {
...(opts.awsS3ForcePathStyle && { s3ForcePathStyle: true }),
...(opts.awsS3sse && { sse: opts.awsS3sse }),
...(opts.awsProxy && { httpsProxy: opts.awsProxy }),
...(opts.awsMaxAttempts && {
maxAttempts: Number(opts.awsMaxAttempts),
}),
},
};
}