mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-02-06 19:19:56 +00:00
Fix usage of livepush v3 features
Change-type: patch Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
parent
aff5cd9b0d
commit
4e50d08f7b
@ -244,6 +244,7 @@ export async function makeBuildTasks(
|
|||||||
logger: Logger,
|
logger: Logger,
|
||||||
projectName: string,
|
projectName: string,
|
||||||
releaseHash: string = 'unavailable',
|
releaseHash: string = 'unavailable',
|
||||||
|
preprocessHook?: (dockerfile: string) => string,
|
||||||
): Promise<MultiBuild.BuildTask[]> {
|
): Promise<MultiBuild.BuildTask[]> {
|
||||||
const buildTasks = await MultiBuild.splitBuildStream(composition, tarStream);
|
const buildTasks = await MultiBuild.splitBuildStream(composition, tarStream);
|
||||||
|
|
||||||
@ -262,7 +263,13 @@ export async function makeBuildTasks(
|
|||||||
`Resolving services with [${deviceInfo.deviceType}|${deviceInfo.arch}]`,
|
`Resolving services with [${deviceInfo.deviceType}|${deviceInfo.arch}]`,
|
||||||
);
|
);
|
||||||
|
|
||||||
await performResolution(buildTasks, deviceInfo, projectName, releaseHash);
|
await performResolution(
|
||||||
|
buildTasks,
|
||||||
|
deviceInfo,
|
||||||
|
projectName,
|
||||||
|
releaseHash,
|
||||||
|
preprocessHook,
|
||||||
|
);
|
||||||
|
|
||||||
logger.logDebug('Found project types:');
|
logger.logDebug('Found project types:');
|
||||||
_.each(buildTasks, task => {
|
_.each(buildTasks, task => {
|
||||||
@ -281,6 +288,7 @@ async function performResolution(
|
|||||||
deviceInfo: DeviceInfo,
|
deviceInfo: DeviceInfo,
|
||||||
appName: string,
|
appName: string,
|
||||||
releaseHash: string,
|
releaseHash: string,
|
||||||
|
preprocessHook?: (dockerfile: string) => string,
|
||||||
): Promise<MultiBuild.BuildTask[]> {
|
): Promise<MultiBuild.BuildTask[]> {
|
||||||
const { cloneTarStream } = require('tar-utils');
|
const { cloneTarStream } = require('tar-utils');
|
||||||
|
|
||||||
@ -294,6 +302,7 @@ async function performResolution(
|
|||||||
BALENA_RELEASE_HASH: releaseHash,
|
BALENA_RELEASE_HASH: releaseHash,
|
||||||
BALENA_APP_NAME: appName,
|
BALENA_APP_NAME: appName,
|
||||||
},
|
},
|
||||||
|
preprocessHook,
|
||||||
);
|
);
|
||||||
// Do one task at a time (Bluebird.each instead of Bluebird.all)
|
// Do one task at a time (Bluebird.each instead of Bluebird.all)
|
||||||
// in order to reduce peak memory usage. Resolves to buildTasks.
|
// in order to reduce peak memory usage. Resolves to buildTasks.
|
||||||
|
@ -309,6 +309,13 @@ export async function performBuilds(
|
|||||||
logger,
|
logger,
|
||||||
LOCAL_APPNAME,
|
LOCAL_APPNAME,
|
||||||
LOCAL_RELEASEHASH,
|
LOCAL_RELEASEHASH,
|
||||||
|
content => {
|
||||||
|
if (!opts.nolive) {
|
||||||
|
return LivepushManager.preprocessDockerfile(content);
|
||||||
|
} else {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
logger.logDebug('Probing remote daemon for cache images');
|
logger.logDebug('Probing remote daemon for cache images');
|
||||||
@ -403,6 +410,13 @@ export async function rebuildSingleTask(
|
|||||||
logger,
|
logger,
|
||||||
LOCAL_APPNAME,
|
LOCAL_APPNAME,
|
||||||
LOCAL_RELEASEHASH,
|
LOCAL_RELEASEHASH,
|
||||||
|
content => {
|
||||||
|
if (!opts.nolive) {
|
||||||
|
return LivepushManager.preprocessDockerfile(content);
|
||||||
|
} else {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
{ serviceName },
|
{ serviceName },
|
||||||
);
|
);
|
||||||
|
@ -208,6 +208,10 @@ export class LivepushManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static preprocessDockerfile(content: string): string {
|
||||||
|
return new Dockerfile(content).generateLiveDockerfile();
|
||||||
|
}
|
||||||
|
|
||||||
private static getMultistageImageIDs(buildLogs: BuildLogs): StageImageIDs {
|
private static getMultistageImageIDs(buildLogs: BuildLogs): StageImageIDs {
|
||||||
const stageIds: StageImageIDs = {};
|
const stageIds: StageImageIDs = {};
|
||||||
_.each(buildLogs, (log, serviceName) => {
|
_.each(buildLogs, (log, serviceName) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user