Skip to content

Commit

Permalink
v1.0.2 - make the docker push sequential to prevent the "blob upload …
Browse files Browse the repository at this point in the history
…unknown" error

also fixes so that if the command errors out, the process error's out as well
  • Loading branch information
ammmze committed Dec 10, 2018
1 parent 0c88eac commit 87c4160
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mashupmill/docker-scripts",
"version": "1.0.1",
"version": "1.0.2",
"description": "",
"main": "lib/index.js",
"homepage": "https://github.com/MashupMill/npm-docker-scripts#readme",
Expand Down
6 changes: 5 additions & 1 deletion src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@

import docker from './index';

docker(process.argv);
docker(process.argv).catch(e => {
const status = e && e.status;
console.error("Failed to run", e);
process.exit(status || 1);
});
17 changes: 13 additions & 4 deletions src/commands/push.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,17 @@ export default async ({ registry, image, tagVersion, tagBranch, tag = [], userna
await exec.strict(`docker login --username ${username} --password ${password} ${registry}`);
}

return await Promise.all(tags.map(async (tag) => {
const command = `docker push ${getDockerImageName({ registry, image, tag })}`;
return await exec.strict(command);
}));
const results = [];
for (let i = 0; i < tags.length; i++) {
const tag = tags[i];
const fullName = getDockerImageName({registry, image, tag});
const command = `docker push ${fullName}`;
try {
results.push(await exec.strict(command));
} catch (e) {
console.error(`Failed to push ${fullName}`);
throw e;
}
}
return results;
}

0 comments on commit 87c4160

Please sign in to comment.