Update resin-multibuild and add app and release template vars

Change-type: minor
Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
Cameron Diver 2020-02-18 10:21:12 +07:00
parent 278d7fd02c
commit 95c93d24da
No known key found for this signature in database
GPG Key ID: 49690ED87032539F
5 changed files with 45 additions and 25 deletions

View File

@ -195,7 +195,7 @@ exports.buildProject = (
# Tar up the directory, ready for the build stream # Tar up the directory, ready for the build stream
tarDirectory(projectPath, { convertEol }) tarDirectory(projectPath, { convertEol })
.then (tarStream) -> .then (tarStream) ->
Promise.resolve(makeBuildTasks(composition, tarStream, { arch, deviceType }, logger)) Promise.resolve(makeBuildTasks(composition, tarStream, { arch, deviceType }, logger, projectName))
.map (task) -> .map (task) ->
d = imageDescriptorsByServiceName[task.serviceName] d = imageDescriptorsByServiceName[task.serviceName]

View File

@ -242,6 +242,8 @@ export async function makeBuildTasks(
tarStream: Readable, tarStream: Readable,
deviceInfo: DeviceInfo, deviceInfo: DeviceInfo,
logger: Logger, logger: Logger,
projectName: string,
releaseHash: string = 'unavailable',
): Promise<MultiBuild.BuildTask[]> { ): Promise<MultiBuild.BuildTask[]> {
const buildTasks = await MultiBuild.splitBuildStream(composition, tarStream); const buildTasks = await MultiBuild.splitBuildStream(composition, tarStream);
@ -260,7 +262,7 @@ export async function makeBuildTasks(
`Resolving services with [${deviceInfo.deviceType}|${deviceInfo.arch}]`, `Resolving services with [${deviceInfo.deviceType}|${deviceInfo.arch}]`,
); );
await performResolution(buildTasks, deviceInfo); await performResolution(buildTasks, deviceInfo, projectName, releaseHash);
logger.logDebug('Found project types:'); logger.logDebug('Found project types:');
_.each(buildTasks, task => { _.each(buildTasks, task => {
@ -277,6 +279,8 @@ export async function makeBuildTasks(
async function performResolution( async function performResolution(
tasks: MultiBuild.BuildTask[], tasks: MultiBuild.BuildTask[],
deviceInfo: DeviceInfo, deviceInfo: DeviceInfo,
appName: string,
releaseHash: string,
): Promise<MultiBuild.BuildTask[]> { ): Promise<MultiBuild.BuildTask[]> {
const { cloneTarStream } = require('tar-utils'); const { cloneTarStream } = require('tar-utils');
@ -286,6 +290,10 @@ async function performResolution(
deviceInfo.arch, deviceInfo.arch,
deviceInfo.deviceType, deviceInfo.deviceType,
{ error: [reject] }, { error: [reject] },
{
BALENA_RELEASE_HASH: releaseHash,
BALENA_APP_NAME: appName,
},
); );
// 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.

View File

@ -42,6 +42,9 @@ import { DeviceAPIError } from './errors';
import LivepushManager from './live'; import LivepushManager from './live';
import { displayBuildLog } from './logs'; import { displayBuildLog } from './logs';
const LOCAL_APPNAME = 'localapp';
const LOCAL_RELEASEHASH = 'localrelease';
// Define the logger here so the debug output // Define the logger here so the debug output
// can be used everywhere // can be used everywhere
const globalLogger = Logger.getLogger(); const globalLogger = Logger.getLogger();
@ -304,6 +307,8 @@ export async function performBuilds(
tarStream, tarStream,
deviceInfo, deviceInfo,
logger, logger,
LOCAL_APPNAME,
LOCAL_RELEASEHASH,
); );
logger.logDebug('Probing remote daemon for cache images'); logger.logDebug('Probing remote daemon for cache images');
@ -391,7 +396,14 @@ export async function rebuildSingleTask(
const tarStream = await tarDirectory(source); const tarStream = await tarDirectory(source);
const task = _.find( const task = _.find(
await makeBuildTasks(composition, tarStream, deviceInfo, logger), await makeBuildTasks(
composition,
tarStream,
deviceInfo,
logger,
LOCAL_APPNAME,
LOCAL_RELEASEHASH,
),
{ serviceName }, { serviceName },
); );
@ -549,8 +561,8 @@ export function generateTargetState(
targetState.local.apps = { targetState.local.apps = {
1: { 1: {
name: 'localapp', name: LOCAL_APPNAME,
commit: 'localrelease', commit: LOCAL_RELEASEHASH,
releaseId: '1', releaseId: '1',
services, services,
volumes: composition.volumes || {}, volumes: composition.volumes || {},

38
npm-shrinkwrap.json generated
View File

@ -5702,9 +5702,9 @@
"integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ="
}, },
"fp-ts": { "fp-ts": {
"version": "2.4.2", "version": "2.5.0",
"resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.4.2.tgz", "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.5.0.tgz",
"integrity": "sha512-/6dNmbu2CRhwR+/OpjLYT3OAlIlyrnY1qjbGDeyYkisTqQfbIdWL1P4sn28yKhcBLcfIvjo9614sfo0EKscOMA==" "integrity": "sha512-xkC9ZKl/i2cU+8FAsdyLcTvPRXphp42FcK5WmZpB47VXb4gggC3DHlVDKNLdbC+U8zz6yp1b0bj0mZg0axmZYQ=="
}, },
"fragment-cache": { "fragment-cache": {
"version": "0.2.1", "version": "0.2.1",
@ -7738,9 +7738,9 @@
"dev": true "dev": true
}, },
"io-ts": { "io-ts": {
"version": "2.0.6", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/io-ts/-/io-ts-2.0.6.tgz", "resolved": "https://registry.npmjs.org/io-ts/-/io-ts-2.1.1.tgz",
"integrity": "sha512-WNfGzm4csMVwL4hX6QlpQWu65SV6GmOUtDo259GKlLYH1cC5bpOENgYHqQIRJ9uR3FuU1RQKDke5STwHZAn3KA==" "integrity": "sha512-6mDCiTc/0uNtC8M1u/kcNiw5JUTlREFCGV7pjcbrQrUDguLkOpuzb4wbJcU78G74QvkhQdvT3F3dAupycXN95g=="
}, },
"io-ts-reporters": { "io-ts-reporters": {
"version": "1.0.0", "version": "1.0.0",
@ -15399,9 +15399,9 @@
"dev": true "dev": true
}, },
"resin-bundle-resolve": { "resin-bundle-resolve": {
"version": "4.1.3", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/resin-bundle-resolve/-/resin-bundle-resolve-4.1.3.tgz", "resolved": "https://registry.npmjs.org/resin-bundle-resolve/-/resin-bundle-resolve-4.2.0.tgz",
"integrity": "sha512-3/1ZmDQuf/Nmwlqx0fY0kaJV99Kcj+GBP3azwghYvkRGzDgbX7aBnA+C6pMZylIsP+TPu5bcqJDRip1aKq0XVw==", "integrity": "sha512-zACrgV73TRqsmeRyMz051yxEC85qqkUH+Fi6NAxcLfFh0LWFiZkEYNhHZmh+qBYyampDF2u7Vwm0oO/Rll8iDg==",
"requires": { "requires": {
"@types/tar-stream": "^1.6.0", "@types/tar-stream": "^1.6.0",
"bluebird": "^3.5.4", "bluebird": "^3.5.4",
@ -15424,9 +15424,9 @@
} }
}, },
"readable-stream": { "readable-stream": {
"version": "3.5.0", "version": "3.6.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.5.0.tgz", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
"integrity": "sha512-gSz026xs2LfxBPudDuI41V1lka8cxg64E66SGe78zJlsUofOg/yqwezdIcdfwik6B4h8LFmWPA9ef9X3FiNFLA==", "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
"requires": { "requires": {
"inherits": "^2.0.3", "inherits": "^2.0.3",
"string_decoder": "^1.1.1", "string_decoder": "^1.1.1",
@ -15970,9 +15970,9 @@
} }
}, },
"resin-multibuild": { "resin-multibuild": {
"version": "4.3.4", "version": "4.4.0",
"resolved": "https://registry.npmjs.org/resin-multibuild/-/resin-multibuild-4.3.4.tgz", "resolved": "https://registry.npmjs.org/resin-multibuild/-/resin-multibuild-4.4.0.tgz",
"integrity": "sha512-9CGuxvnEFP3h3kcBJb2UUr37DwTEEjTf8LduVRLyB9PVSp5sq+aj71/qhSbluvPfAUWodR7KtgnNa4ENYKe/WA==", "integrity": "sha512-iC8oMvgsfFn7lCELkDHjavy4Me5MuhDxYkjcQv0P3p0uUbHeZV+XAScOPDpLyR9PTxTLvhXGg4DRPG28tN3SfA==",
"requires": { "requires": {
"@types/bluebird": "3.5.20", "@types/bluebird": "3.5.20",
"@types/dockerode": "2.5.5", "@types/dockerode": "2.5.5",
@ -15989,7 +15989,7 @@
"io-ts-reporters": "^1.0.0", "io-ts-reporters": "^1.0.0",
"js-yaml": "^3.13.1", "js-yaml": "^3.13.1",
"lodash": "^4.17.4", "lodash": "^4.17.4",
"resin-bundle-resolve": "^4.1.3", "resin-bundle-resolve": "^4.2.0",
"resin-compose-parse": "^2.0.4", "resin-compose-parse": "^2.0.4",
"resin-docker-build": "^1.1.2", "resin-docker-build": "^1.1.2",
"tar-stream": "^2.0.1", "tar-stream": "^2.0.1",
@ -16020,9 +16020,9 @@
} }
}, },
"readable-stream": { "readable-stream": {
"version": "3.5.0", "version": "3.6.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.5.0.tgz", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
"integrity": "sha512-gSz026xs2LfxBPudDuI41V1lka8cxg64E66SGe78zJlsUofOg/yqwezdIcdfwik6B4h8LFmWPA9ef9X3FiNFLA==", "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
"requires": { "requires": {
"inherits": "^2.0.3", "inherits": "^2.0.3",
"string_decoder": "^1.1.1", "string_decoder": "^1.1.1",

View File

@ -225,7 +225,7 @@
"resin-compose-parse": "^2.1.0", "resin-compose-parse": "^2.1.0",
"resin-doodles": "^0.1.1", "resin-doodles": "^0.1.1",
"resin-image-fs": "^5.0.8", "resin-image-fs": "^5.0.8",
"resin-multibuild": "^4.3.4", "resin-multibuild": "^4.4.0",
"resin-release": "^1.2.0", "resin-release": "^1.2.0",
"resin-semver": "^1.6.0", "resin-semver": "^1.6.0",
"resin-stream-logger": "^0.1.2", "resin-stream-logger": "^0.1.2",