mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-29 15:44:26 +00:00
Fix typing (don't assume that 'docker-toolbelt' uses Bluebird promises)
Change-type: patch
This commit is contained in:
parent
3199f15662
commit
099d755900
@ -365,8 +365,7 @@ export const pushAndUpdateServiceImages = function (
|
||||
Promise.all(
|
||||
images.map(({ serviceImage, localImage, props, logs }, index) =>
|
||||
Promise.all([
|
||||
// @ts-ignore
|
||||
localImage.inspect().get('Size'),
|
||||
localImage.inspect().then((img) => img.Size),
|
||||
retry(
|
||||
// @ts-ignore
|
||||
() => progress.push(localImage.name, reporters[index], opts),
|
||||
|
@ -30,13 +30,18 @@ const getBuilderLogPushEndpoint = function (baseUrl, buildId, owner, app) {
|
||||
return `https://builder.${baseUrl}/v1/pushLogs?${args}`;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {import('docker-toolbelt')} docker
|
||||
* @param {string} imageId
|
||||
* @param {string} bufferFile
|
||||
*/
|
||||
const bufferImage = function (docker, imageId, bufferFile) {
|
||||
const streamUtils = require('./streams');
|
||||
|
||||
const image = docker.getImage(imageId);
|
||||
const imageMetadata = image.inspect();
|
||||
const sizePromise = image.inspect().then((img) => img.Size);
|
||||
|
||||
return Promise.all([image.get(), imageMetadata.get('Size')]).then(
|
||||
return Promise.all([image.get(), sizePromise]).then(
|
||||
([imageStream, imageSize]) =>
|
||||
streamUtils.buffer(imageStream, bufferFile).then((bufferedStream) => {
|
||||
// @ts-ignore adding an extra property
|
||||
@ -150,14 +155,17 @@ const uploadLogs = function (logs, token, url, buildId, username, appName) {
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
opts must be a hash with the following keys:
|
||||
|
||||
- appName: the name of the app to deploy to
|
||||
- imageName: the name of the image to deploy
|
||||
- buildLogs: a string with build output
|
||||
- shouldUploadLogs
|
||||
*/
|
||||
/**
|
||||
* @param {import('docker-toolbelt')} docker
|
||||
* @param {import('./logger')} logger
|
||||
* @param {string} token
|
||||
* @param {string} username
|
||||
* @param {string} url
|
||||
* @param {{appName: string; imageName: string; buildLogs: string; shouldUploadLogs: boolean}} opts
|
||||
* - appName: the name of the app to deploy to
|
||||
* - imageName: the name of the image to deploy
|
||||
* - buildLogs: a string with build output
|
||||
*/
|
||||
export const deployLegacy = async function (
|
||||
docker,
|
||||
logger,
|
||||
|
Loading…
x
Reference in New Issue
Block a user