Skip to content

Commit

Permalink
Update balena-multibuild to 5.1.0
Browse files Browse the repository at this point in the history
Update balena-multibuild from 4.12.2 to 5.1.0

Changelog-entry: push/build/deploy: Support new docker-compose.yml build parameters: extra_hosts, shm_size, target, cache_from
Change-type: minor
Signed-off-by: Robert Günzler <[email protected]>
  • Loading branch information
robertgzr committed Dec 1, 2021
1 parent 208cbcb commit 42aa15f
Show file tree
Hide file tree
Showing 13 changed files with 228 additions and 382 deletions.
2 changes: 1 addition & 1 deletion lib/commands/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { dockerignoreHelp, registrySecretsHelp } from '../utils/messages';
import type { BalenaSDK } from 'balena-sdk';
import { ExpectedError, instanceOf } from '../errors';
import { isV13 } from '../utils/version';
import { RegistrySecrets } from 'resin-multibuild';
import { RegistrySecrets } from '@balena/multibuild';
import { lowercaseIfSlug } from '../utils/normalization';
import {
applyReleaseTagKeysAndValues,
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export async function originalTarDirectory(dir, param) {
const streamToPromise = require('stream-to-promise');
const { printGitignoreWarn } = require('./compose_ts');
const { FileIgnorer, IgnoreFileType } = require('./ignore');
const { toPosixPath } = require('resin-multibuild').PathUtils;
const { toPosixPath } = require('@balena/multibuild').PathUtils;
let readFile;
if (process.platform === 'win32') {
const { readFileWithEolConversion } = require('./eol-conversion');
Expand Down Expand Up @@ -301,7 +301,7 @@ export const getPreviousRepos = (sdk, logger, appID) =>
// grab all images from the latest release, return all image locations in the registry
if (release.length > 0) {
const images = release[0].contains__image;
const { getRegistryAndName } = require('resin-multibuild');
const { getRegistryAndName } = require('@balena/multibuild');
return Promise.all(
images.map(function (d) {
const imageName = d.image[0].is_stored_at__image_location || '';
Expand Down
16 changes: 8 additions & 8 deletions lib/utils/compose_ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import type {
Composition,
ImageDescriptor,
} from '@balena/compose-parse';
import type * as MultiBuild from 'resin-multibuild';
import type * as MultiBuild from '@balena/multibuild';
import type { Duplex, Readable } from 'stream';
import type { Pack } from 'tar-stream';

Expand Down Expand Up @@ -336,7 +336,7 @@ async function $buildProject(
logger.logDebug('Prepared tasks; building...');

const { BALENA_ENGINE_TMP_PATH } = await import('../config');
const builder = await import('resin-multibuild');
const builder = await import('@balena/multibuild');

const builtImages = await builder.performBuilds(
tasks,
Expand Down Expand Up @@ -485,7 +485,7 @@ async function qemuTransposeBuildStream({
}

const transpose = await import('docker-qemu-transpose');
const { toPosixPath } = (await import('resin-multibuild')).PathUtils;
const { toPosixPath } = (await import('@balena/multibuild')).PathUtils;

const transposeOptions: TransposeOptions = {
hostQemuPath: toPosixPath(binPath),
Expand Down Expand Up @@ -786,7 +786,7 @@ async function newTarDirectory(
require('assert').strict.equal(nogitignore, true);
}
const { filterFilesWithDockerignore } = await import('./ignore');
const { toPosixPath } = (await import('resin-multibuild')).PathUtils;
const { toPosixPath } = (await import('@balena/multibuild')).PathUtils;

let readFile: (file: string) => Promise<Buffer>;
if (process.platform === 'win32') {
Expand Down Expand Up @@ -1010,7 +1010,7 @@ async function parseRegistrySecrets(
throw new ExpectedError('Filename must end with .json, .yml or .yaml');
}
const raw = (await fs.readFile(secretsFilename)).toString();
const multiBuild = await import('resin-multibuild');
const multiBuild = await import('@balena/multibuild');
const registrySecrets =
new multiBuild.RegistrySecretValidator().validateRegistrySecrets(
isYaml ? require('js-yaml').load(raw) : JSON.parse(raw),
Expand Down Expand Up @@ -1039,7 +1039,7 @@ export async function makeBuildTasks(
releaseHash: string = 'unavailable',
preprocessHook?: (dockerfile: string) => string,
): Promise<MultiBuild.BuildTask[]> {
const multiBuild = await import('resin-multibuild');
const multiBuild = await import('@balena/multibuild');
const buildTasks = await multiBuild.splitBuildStream(composition, tarStream);

logger.logDebug('Found build tasks:');
Expand Down Expand Up @@ -1085,7 +1085,7 @@ async function performResolution(
releaseHash: string,
preprocessHook?: (dockerfile: string) => string,
): Promise<MultiBuild.BuildTask[]> {
const multiBuild = await import('resin-multibuild');
const multiBuild = await import('@balena/multibuild');
const resolveListeners: MultiBuild.ResolveListeners = {};
const resolvePromise = new Promise<never>((_resolve, reject) => {
resolveListeners.error = [reject];
Expand Down Expand Up @@ -1150,7 +1150,7 @@ async function validateSpecifiedDockerfile(
dockerfilePath: string,
): Promise<string> {
const { contains, toNativePath, toPosixPath } = (
await import('resin-multibuild')
await import('@balena/multibuild')
).PathUtils;

const nativeProjectPath = path.normalize(projectPath);
Expand Down
27 changes: 15 additions & 12 deletions lib/utils/device/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
getAuthConfigObj,
LocalImage,
RegistrySecrets,
} from 'resin-multibuild';
} from '@balena/multibuild';
import type { Readable } from 'stream';

import { BALENA_ENGINE_TMP_PATH } from '../../config';
Expand Down Expand Up @@ -324,7 +324,7 @@ async function performBuilds(
opts: DeviceDeployOptions,
buildLogs?: Dictionary<string>,
): Promise<BuildTask[]> {
const multibuild = await import('resin-multibuild');
const multibuild = await import('@balena/multibuild');

const buildTasks = await makeBuildTasks(
composition,
Expand Down Expand Up @@ -373,7 +373,7 @@ async function performBuilds(
const imagesToRemove: string[] = [];

// Now tag any external images with the correct name that they should be,
// as this won't be done by resin-multibuild
// as this won't be done by @balena/multibuild
await Promise.all(
localImages.map(async (localImage) => {
if (localImage.external) {
Expand Down Expand Up @@ -417,7 +417,7 @@ export async function rebuildSingleTask(
// this should provide the following callback
containerIdCb?: (id: string) => void,
): Promise<string> {
const multibuild = await import('resin-multibuild');
const multibuild = await import('@balena/multibuild');
// First we run the build task, to get the new image id
let buildLogs = '';
const logHandler = (_s: string, line: string) => {
Expand Down Expand Up @@ -537,15 +537,18 @@ async function assignDockerBuildOpts(
await Promise.all(
buildTasks.map(async (task: BuildTask) => {
task.dockerOpts = {
cachefrom: images,
labels: {
'io.resin.local.image': '1',
'io.resin.local.service': task.serviceName,
...(task.dockerOpts || {}),
...{
cachefrom: images,
labels: {
'io.resin.local.image': '1',
'io.resin.local.service': task.serviceName,
},
t: generateImageName(task.serviceName),
nocache: opts.nocache,
forcerm: true,
pull: opts.pull,
},
t: getImageNameFromTask(task),
nocache: opts.nocache,
forcerm: true,
pull: opts.pull,
};
if (task.external) {
task.dockerOpts.authconfig = await getAuthConfigObj(
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/device/live.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import Livepush, { ContainerNotRunningError } from 'livepush';
import * as _ from 'lodash';
import * as path from 'path';
import type { Composition } from '@balena/compose-parse';
import type { BuildTask } from 'resin-multibuild';
import type { BuildTask } from '@balena/multibuild';

import { instanceOf } from '../../errors';
import Logger = require('../logger');
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export interface BuildOpts {
cachefrom?: string[];
nocache?: boolean;
pull?: boolean;
registryconfig?: import('resin-multibuild').RegistrySecrets;
registryconfig?: import('@balena/multibuild').RegistrySecrets;
squash?: boolean;
t?: string; // only the tag portion of the image name, e.g. 'abc' in 'myimg:abc'
}
Expand All @@ -132,7 +132,7 @@ export function generateBuildOpts(options: {
'cache-from'?: string;
nocache: boolean;
pull?: boolean;
'registry-secrets'?: import('resin-multibuild').RegistrySecrets;
'registry-secrets'?: import('@balena/multibuild').RegistrySecrets;
squash: boolean;
tag?: string;
}): BuildOpts {
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/ignore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import * as _ from 'lodash';
import { promises as fs, Stats } from 'fs';
import * as path from 'path';
import * as MultiBuild from 'resin-multibuild';
import * as MultiBuild from '@balena/multibuild';

import dockerIgnore = require('@zeit/dockerignore');
import ignore from 'ignore';
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/remote-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import type { BalenaSDK } from 'balena-sdk';
import * as JSONStream from 'JSONStream';
import * as readline from 'readline';
import * as request from 'request';
import { RegistrySecrets } from 'resin-multibuild';
import { RegistrySecrets } from '@balena/multibuild';
import type * as Stream from 'stream';
import streamToPromise = require('stream-to-promise');
import type { Pack } from 'tar-stream';
Expand Down
Loading

0 comments on commit 42aa15f

Please sign in to comment.