Skip to content

Commit 7b6b015

Browse files
committed
remove retry from docker-credential-asset
1 parent 89fd917 commit 7b6b015

File tree

1 file changed

+3
-26
lines changed

1 file changed

+3
-26
lines changed

packages/cdk-assets/bin/docker-credential-cdk-assets.ts

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -39,34 +39,11 @@ async function main() {
3939

4040
// Read the domain to fetch from stdin
4141
let endpoint = fs.readFileSync(0, { encoding: 'utf-8' }).trim();
42-
43-
const deadline = Date.now() + 60_000; // 60 seconds timeout
44-
let lastError: Error | undefined;
45-
46-
while (Date.now() < deadline) {
47-
try {
48-
const credentials = await fetchDockerLoginCredentials(new DefaultAwsClient(), config, endpoint);
49-
// Write the credentials back to stdout
50-
fs.writeFileSync(1, JSON.stringify(credentials));
51-
return;
52-
} catch (e: any) {
53-
lastError = e;
54-
55-
// Retry on AccessDenied errors due to eventual consistency in AWS IAM.
56-
// Newly created roles and policies may take time to propagate across regions.
57-
if (e.name === 'AccessDenied') {
58-
await new Promise(resolve => setTimeout(resolve, 5000)); // Wait 5 seconds
59-
continue;
60-
}
61-
62-
// For other errors, throw immediately
63-
throw e;
64-
}
42+
const credentials = await fetchDockerLoginCredentials(new DefaultAwsClient(), config, endpoint);
43+
// Write the credentials back to stdout
44+
fs.writeFileSync(1, JSON.stringify(credentials));
6545
}
6646

67-
throw lastError;
68-
}
69-
7047
main().catch((e) => {
7148
// eslint-disable-next-line no-console
7249
console.error(e.stack);

0 commit comments

Comments
 (0)