skip downloading image if image present locally

if we use build service app locally (without push), then we can skip
the download altogether.
This commit is contained in:
Girish Ramakrishnan
2020-10-19 22:11:23 -07:00
parent 9d1bb29a00
commit 546e381325
2 changed files with 12 additions and 5 deletions

View File

@@ -170,13 +170,19 @@ function downloadImage(manifest, callback) {
debug('downloadImage %s', manifest.dockerImage);
var attempt = 1;
const image = gConnection.getImage(manifest.dockerImage);
async.retry({ times: 10, interval: 5000, errorFilter: e => e.reason !== BoxError.NOT_FOUND }, function (retryCallback) {
debug('Downloading image %s. attempt: %s', manifest.dockerImage, attempt++);
image.inspect(function (error, result) {
if (!error && result) return callback(null); // image is already present locally
pullImage(manifest, retryCallback);
}, callback);
let attempt = 1;
async.retry({ times: 10, interval: 5000, errorFilter: e => e.reason !== BoxError.NOT_FOUND }, function (retryCallback) {
debug('Downloading image %s. attempt: %s', manifest.dockerImage, attempt++);
pullImage(manifest, retryCallback);
}, callback);
});
}
function getBindsSync(app) {