Skip to content

Commit

Permalink
await promises for each registry
Browse files Browse the repository at this point in the history
  • Loading branch information
tada5hi committed Mar 30, 2022
1 parent 18c445a commit e52368a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ for (let i = 0; i < sum; i++) {
try {
spinner.start('Push images');

const pushPromises: Promise<any>[] = [];
for (let i = 0; i < registries.length; i++) {
const authConfig : AuthConfig = {
serveraddress: registries[i].host,
Expand All @@ -209,6 +208,8 @@ for (let i = 0; i < sum; i++) {
};

try {
const pushPromises: Promise<any>[] = [];

for (let j = 0; j < images.length; j++) {
const repository = `${registries[i].host}/${images[j]}:latest`;
const image = docker.getImage(repository);
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit e52368a

Please sign in to comment.