From e52368a4018b73e517073cfe11a1f40a64625f70 Mon Sep 17 00:00:00 2001 From: tada5hi Date: Wed, 30 Mar 2022 18:50:58 +0200 Subject: [PATCH] await promises for each registry --- src/index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 10564e4..7d5111f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -200,7 +200,6 @@ for (let i = 0; i < sum; i++) { try { spinner.start('Push images'); - const pushPromises: Promise[] = []; for (let i = 0; i < registries.length; i++) { const authConfig : AuthConfig = { serveraddress: registries[i].host, @@ -209,6 +208,8 @@ for (let i = 0; i < sum; i++) { }; try { + const pushPromises: Promise[] = []; + for (let j = 0; j < images.length; j++) { const repository = `${registries[i].host}/${images[j]}:latest`; const image = docker.getImage(repository); @@ -242,13 +243,13 @@ for (let i = 0; i < sum; i++) { ); })); } + + await Promise.all(pushPromises); } catch (e) { spinner.fail(`Push to registry ${registries[i].host} failed`); } } - await Promise.all(pushPromises); - spinner.succeed('Pushed'); } catch (e) { if (e instanceof Error) {