mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-24 07:46:39 +00:00
Switch to balena-compose
Removes a bunch of individual dependencies by switching to `@balena/compose` which (currently) groups and manages those dependencies together in one package. Change-type: minor
This commit is contained in:
parent
21ded85c7a
commit
c7f56d92dd
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { flags } from '@oclif/command';
|
import { flags } from '@oclif/command';
|
||||||
import type { ImageDescriptor } from 'resin-compose-parse';
|
import type { ImageDescriptor } from '@balena/compose/dist/parse';
|
||||||
|
|
||||||
import Command from '../command';
|
import Command from '../command';
|
||||||
import { ExpectedError } from '../errors';
|
import { ExpectedError } from '../errors';
|
||||||
|
@ -22,7 +22,7 @@ import { getBalenaSdk, stripIndent } from '../utils/lazy';
|
|||||||
import { dockerignoreHelp, registrySecretsHelp } from '../utils/messages';
|
import { dockerignoreHelp, registrySecretsHelp } from '../utils/messages';
|
||||||
import type { BalenaSDK } from 'balena-sdk';
|
import type { BalenaSDK } from 'balena-sdk';
|
||||||
import { ExpectedError, instanceOf } from '../errors';
|
import { ExpectedError, instanceOf } from '../errors';
|
||||||
import { RegistrySecrets } from 'resin-multibuild';
|
import { RegistrySecrets } from '@balena/compose/dist/multibuild';
|
||||||
import { lowercaseIfSlug } from '../utils/normalization';
|
import { lowercaseIfSlug } from '../utils/normalization';
|
||||||
import {
|
import {
|
||||||
applyReleaseTagKeysAndValues,
|
applyReleaseTagKeysAndValues,
|
||||||
|
13
lib/utils/compose-types.d.ts
vendored
13
lib/utils/compose-types.d.ts
vendored
@ -15,8 +15,11 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { ImageModel, ReleaseModel } from 'balena-release/build/models';
|
import type {
|
||||||
import type { Composition, ImageDescriptor } from 'resin-compose-parse';
|
ImageModel,
|
||||||
|
ReleaseModel,
|
||||||
|
} from '@balena/compose/dist/release/models';
|
||||||
|
import type { Composition, ImageDescriptor } from '@balena/compose/dist/parse';
|
||||||
import type { Pack } from 'tar-stream';
|
import type { Pack } from 'tar-stream';
|
||||||
|
|
||||||
interface Image {
|
interface Image {
|
||||||
@ -39,7 +42,7 @@ export interface BuiltImage {
|
|||||||
|
|
||||||
export interface TaggedImage {
|
export interface TaggedImage {
|
||||||
localImage: import('dockerode').Image;
|
localImage: import('dockerode').Image;
|
||||||
serviceImage: import('balena-release/build/models').ImageModel;
|
serviceImage: import('@balena/compose/dist/release/models').ImageModel;
|
||||||
serviceName: string;
|
serviceName: string;
|
||||||
logs: string;
|
logs: string;
|
||||||
props: BuiltImage.props;
|
props: BuiltImage.props;
|
||||||
@ -78,7 +81,9 @@ export interface ComposeProject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface Release {
|
export interface Release {
|
||||||
client: ReturnType<typeof import('balena-release').createClient>;
|
client: ReturnType<
|
||||||
|
typeof import('@balena/compose/dist/release').createClient
|
||||||
|
>;
|
||||||
release: Pick<
|
release: Pick<
|
||||||
ReleaseModel,
|
ReleaseModel,
|
||||||
| 'id'
|
| 'id'
|
||||||
|
@ -19,7 +19,7 @@ import type { Renderer } from './compose_ts';
|
|||||||
import type * as SDK from 'balena-sdk';
|
import type * as SDK from 'balena-sdk';
|
||||||
import type Dockerode = require('dockerode');
|
import type Dockerode = require('dockerode');
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import type { Composition, ImageDescriptor } from 'resin-compose-parse';
|
import type { Composition, ImageDescriptor } from '@balena/compose/dist/parse';
|
||||||
import type {
|
import type {
|
||||||
BuiltImage,
|
BuiltImage,
|
||||||
ComposeOpts,
|
ComposeOpts,
|
||||||
@ -64,7 +64,7 @@ export function createProject(
|
|||||||
): ComposeProject {
|
): ComposeProject {
|
||||||
const yml = require('js-yaml') as typeof import('js-yaml');
|
const yml = require('js-yaml') as typeof import('js-yaml');
|
||||||
const compose =
|
const compose =
|
||||||
require('resin-compose-parse') as typeof import('resin-compose-parse');
|
require('@balena/compose/dist/parse') as typeof import('@balena/compose/dist/parse');
|
||||||
|
|
||||||
// both methods below may throw.
|
// both methods below may throw.
|
||||||
const rawComposition = yml.load(composeStr);
|
const rawComposition = yml.load(composeStr);
|
||||||
@ -107,7 +107,7 @@ export const createRelease = async function (
|
|||||||
const _ = require('lodash') as typeof import('lodash');
|
const _ = require('lodash') as typeof import('lodash');
|
||||||
const crypto = require('crypto') as typeof import('crypto');
|
const crypto = require('crypto') as typeof import('crypto');
|
||||||
const releaseMod =
|
const releaseMod =
|
||||||
require('balena-release') as typeof import('balena-release');
|
require('@balena/compose/dist/release') as typeof import('@balena/compose/dist/release');
|
||||||
|
|
||||||
const client = releaseMod.createClient({ apiEndpoint, auth });
|
const client = releaseMod.createClient({ apiEndpoint, auth });
|
||||||
|
|
||||||
@ -214,7 +214,7 @@ export const getPreviousRepos = (
|
|||||||
image: [SDK.Image];
|
image: [SDK.Image];
|
||||||
}>;
|
}>;
|
||||||
const { getRegistryAndName } =
|
const { getRegistryAndName } =
|
||||||
require('resin-multibuild') as typeof import('resin-multibuild');
|
require('@balena/compose/dist/multibuild') as typeof import('@balena/compose/dist/multibuild');
|
||||||
return Promise.all(
|
return Promise.all(
|
||||||
images.map(function (d) {
|
images.map(function (d) {
|
||||||
const imageName = d.image[0].is_stored_at__image_location || '';
|
const imageName = d.image[0].is_stored_at__image_location || '';
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
import { flags } from '@oclif/command';
|
import { flags } from '@oclif/command';
|
||||||
import { BalenaSDK } from 'balena-sdk';
|
import { BalenaSDK } from 'balena-sdk';
|
||||||
import type { TransposeOptions } from 'docker-qemu-transpose';
|
import type { TransposeOptions } from '@balena/compose/dist/emulate';
|
||||||
import type * as Dockerode from 'dockerode';
|
import type * as Dockerode from 'dockerode';
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
import jsyaml = require('js-yaml');
|
import jsyaml = require('js-yaml');
|
||||||
@ -26,8 +26,8 @@ import type {
|
|||||||
BuildConfig,
|
BuildConfig,
|
||||||
Composition,
|
Composition,
|
||||||
ImageDescriptor,
|
ImageDescriptor,
|
||||||
} from 'resin-compose-parse';
|
} from '@balena/compose/dist/parse';
|
||||||
import type * as MultiBuild from 'resin-multibuild';
|
import type * as MultiBuild from '@balena/compose/dist/multibuild';
|
||||||
import * as semver from 'semver';
|
import * as semver from 'semver';
|
||||||
import type { Duplex, Readable } from 'stream';
|
import type { Duplex, Readable } from 'stream';
|
||||||
import type { Pack } from 'tar-stream';
|
import type { Pack } from 'tar-stream';
|
||||||
@ -118,7 +118,7 @@ export async function loadProject(
|
|||||||
image?: string,
|
image?: string,
|
||||||
imageTag?: string,
|
imageTag?: string,
|
||||||
): Promise<ComposeProject> {
|
): Promise<ComposeProject> {
|
||||||
const compose = await import('resin-compose-parse');
|
const compose = await import('@balena/compose/dist/parse');
|
||||||
const { createProject } = await import('./compose');
|
const { createProject } = await import('./compose');
|
||||||
let composeName: string;
|
let composeName: string;
|
||||||
let composeStr: string;
|
let composeStr: string;
|
||||||
@ -262,7 +262,7 @@ export async function buildProject(
|
|||||||
opts: BuildProjectOpts,
|
opts: BuildProjectOpts,
|
||||||
): Promise<BuiltImage[]> {
|
): Promise<BuiltImage[]> {
|
||||||
await checkBuildSecretsRequirements(opts.docker, opts.projectPath);
|
await checkBuildSecretsRequirements(opts.docker, opts.projectPath);
|
||||||
const compose = await import('resin-compose-parse');
|
const compose = await import('@balena/compose/dist/parse');
|
||||||
const imageDescriptors = compose.parse(opts.composition);
|
const imageDescriptors = compose.parse(opts.composition);
|
||||||
const renderer = await startRenderer({ imageDescriptors, ...opts });
|
const renderer = await startRenderer({ imageDescriptors, ...opts });
|
||||||
let buildSummaryByService: Dictionary<string> | undefined;
|
let buildSummaryByService: Dictionary<string> | undefined;
|
||||||
@ -333,7 +333,7 @@ async function $buildProject(
|
|||||||
logger.logDebug('Prepared tasks; building...');
|
logger.logDebug('Prepared tasks; building...');
|
||||||
|
|
||||||
const { BALENA_ENGINE_TMP_PATH } = await import('../config');
|
const { BALENA_ENGINE_TMP_PATH } = await import('../config');
|
||||||
const builder = await import('resin-multibuild');
|
const builder = await import('@balena/compose/dist/multibuild');
|
||||||
|
|
||||||
const builtImages = await builder.performBuilds(
|
const builtImages = await builder.performBuilds(
|
||||||
tasks,
|
tasks,
|
||||||
@ -481,8 +481,9 @@ async function qemuTransposeBuildStream({
|
|||||||
throw new Error(`No buildStream for task '${task.tag}'`);
|
throw new Error(`No buildStream for task '${task.tag}'`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const transpose = await import('docker-qemu-transpose');
|
const transpose = await import('@balena/compose/dist/emulate');
|
||||||
const { toPosixPath } = (await import('resin-multibuild')).PathUtils;
|
const { toPosixPath } = (await import('@balena/compose/dist/multibuild'))
|
||||||
|
.PathUtils;
|
||||||
|
|
||||||
const transposeOptions: TransposeOptions = {
|
const transposeOptions: TransposeOptions = {
|
||||||
hostQemuPath: toPosixPath(binPath),
|
hostQemuPath: toPosixPath(binPath),
|
||||||
@ -508,9 +509,9 @@ async function setTaskProgressHooks({
|
|||||||
inlineLogs?: boolean;
|
inlineLogs?: boolean;
|
||||||
renderer: Renderer;
|
renderer: Renderer;
|
||||||
task: BuildTaskPlus;
|
task: BuildTaskPlus;
|
||||||
transposeOptions?: import('docker-qemu-transpose').TransposeOptions;
|
transposeOptions?: import('@balena/compose/dist/emulate').TransposeOptions;
|
||||||
}) {
|
}) {
|
||||||
const transpose = await import('docker-qemu-transpose');
|
const transpose = await import('@balena/compose/dist/emulate');
|
||||||
// Get the service-specific log stream
|
// Get the service-specific log stream
|
||||||
const logStream = renderer.streams[task.serviceName];
|
const logStream = renderer.streams[task.serviceName];
|
||||||
task.logBuffer = [];
|
task.logBuffer = [];
|
||||||
@ -724,16 +725,16 @@ export async function getServiceDirsFromComposition(
|
|||||||
*
|
*
|
||||||
* The `image` argument may therefore refer to either a `build` or `image` property
|
* The `image` argument may therefore refer to either a `build` or `image` property
|
||||||
* of a service in a docker-compose.yml file, which is a bit confusing but it matches
|
* of a service in a docker-compose.yml file, which is a bit confusing but it matches
|
||||||
* the `ImageDescriptor.image` property as defined by `resin-compose-parse`.
|
* the `ImageDescriptor.image` property as defined by `@balena/compose/parse`.
|
||||||
*
|
*
|
||||||
* Note that `resin-compose-parse` "normalizes" the docker-compose.yml file such
|
* Note that `@balena/compose/parse` "normalizes" the docker-compose.yml file such
|
||||||
* that, if `services.service.build` is a string, it is converted to a BuildConfig
|
* that, if `services.service.build` is a string, it is converted to a BuildConfig
|
||||||
* object with the string value assigned to `services.service.build.context`:
|
* object with the string value assigned to `services.service.build.context`:
|
||||||
* https://github.com/balena-io-modules/resin-compose-parse/blob/v2.1.3/src/compose.ts#L166-L167
|
* https://github.com/balena-io-modules/balena-compose/blob/v0.1.0/lib/parse/compose.ts#L166-L167
|
||||||
* This is why this implementation works when `services.service.build` is defined
|
* This is why this implementation works when `services.service.build` is defined
|
||||||
* as a string in the docker-compose.yml file.
|
* as a string in the docker-compose.yml file.
|
||||||
*
|
*
|
||||||
* @param image The `ImageDescriptor.image` attribute parsed with `resin-compose-parse`
|
* @param image The `ImageDescriptor.image` attribute parsed with `@balena/compose/parse`
|
||||||
*/
|
*/
|
||||||
export function isBuildConfig(
|
export function isBuildConfig(
|
||||||
image: string | BuildConfig,
|
image: string | BuildConfig,
|
||||||
@ -759,7 +760,8 @@ export async function tarDirectory(
|
|||||||
}: TarDirectoryOptions,
|
}: TarDirectoryOptions,
|
||||||
): Promise<import('stream').Readable> {
|
): Promise<import('stream').Readable> {
|
||||||
const { filterFilesWithDockerignore } = await import('./ignore');
|
const { filterFilesWithDockerignore } = await import('./ignore');
|
||||||
const { toPosixPath } = (await import('resin-multibuild')).PathUtils;
|
const { toPosixPath } = (await import('@balena/compose/dist/multibuild'))
|
||||||
|
.PathUtils;
|
||||||
|
|
||||||
let readFile: (file: string) => Promise<Buffer>;
|
let readFile: (file: string) => Promise<Buffer>;
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
@ -941,7 +943,7 @@ async function parseRegistrySecrets(
|
|||||||
throw new ExpectedError('Filename must end with .json, .yml or .yaml');
|
throw new ExpectedError('Filename must end with .json, .yml or .yaml');
|
||||||
}
|
}
|
||||||
const raw = (await fs.readFile(secretsFilename)).toString();
|
const raw = (await fs.readFile(secretsFilename)).toString();
|
||||||
const multiBuild = await import('resin-multibuild');
|
const multiBuild = await import('@balena/compose/dist/multibuild');
|
||||||
const registrySecrets =
|
const registrySecrets =
|
||||||
new multiBuild.RegistrySecretValidator().validateRegistrySecrets(
|
new multiBuild.RegistrySecretValidator().validateRegistrySecrets(
|
||||||
isYaml ? require('js-yaml').load(raw) : JSON.parse(raw),
|
isYaml ? require('js-yaml').load(raw) : JSON.parse(raw),
|
||||||
@ -970,7 +972,7 @@ export async function makeBuildTasks(
|
|||||||
releaseHash: string = 'unavailable',
|
releaseHash: string = 'unavailable',
|
||||||
preprocessHook?: (dockerfile: string) => string,
|
preprocessHook?: (dockerfile: string) => string,
|
||||||
): Promise<MultiBuild.BuildTask[]> {
|
): Promise<MultiBuild.BuildTask[]> {
|
||||||
const multiBuild = await import('resin-multibuild');
|
const multiBuild = await import('@balena/compose/dist/multibuild');
|
||||||
const buildTasks = await multiBuild.splitBuildStream(composition, tarStream);
|
const buildTasks = await multiBuild.splitBuildStream(composition, tarStream);
|
||||||
|
|
||||||
logger.logDebug('Found build tasks:');
|
logger.logDebug('Found build tasks:');
|
||||||
@ -1016,7 +1018,7 @@ async function performResolution(
|
|||||||
releaseHash: string,
|
releaseHash: string,
|
||||||
preprocessHook?: (dockerfile: string) => string,
|
preprocessHook?: (dockerfile: string) => string,
|
||||||
): Promise<MultiBuild.BuildTask[]> {
|
): Promise<MultiBuild.BuildTask[]> {
|
||||||
const multiBuild = await import('resin-multibuild');
|
const multiBuild = await import('@balena/compose/dist/multibuild');
|
||||||
const resolveListeners: MultiBuild.ResolveListeners = {};
|
const resolveListeners: MultiBuild.ResolveListeners = {};
|
||||||
const resolvePromise = new Promise<never>((_resolve, reject) => {
|
const resolvePromise = new Promise<never>((_resolve, reject) => {
|
||||||
resolveListeners.error = [reject];
|
resolveListeners.error = [reject];
|
||||||
@ -1081,7 +1083,7 @@ async function validateSpecifiedDockerfile(
|
|||||||
dockerfilePath: string,
|
dockerfilePath: string,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const { contains, toNativePath, toPosixPath } = (
|
const { contains, toNativePath, toPosixPath } = (
|
||||||
await import('resin-multibuild')
|
await import('@balena/compose/dist/multibuild')
|
||||||
).PathUtils;
|
).PathUtils;
|
||||||
|
|
||||||
const nativeProjectPath = path.normalize(projectPath);
|
const nativeProjectPath = path.normalize(projectPath);
|
||||||
@ -1241,7 +1243,7 @@ async function pushAndUpdateServiceImages(
|
|||||||
token: string,
|
token: string,
|
||||||
images: TaggedImage[],
|
images: TaggedImage[],
|
||||||
afterEach: (
|
afterEach: (
|
||||||
serviceImage: import('balena-release/build/models').ImageModel,
|
serviceImage: import('@balena/compose/dist/release/models').ImageModel,
|
||||||
props: object,
|
props: object,
|
||||||
) => void,
|
) => void,
|
||||||
) {
|
) {
|
||||||
@ -1326,12 +1328,14 @@ async function pushAndUpdateServiceImages(
|
|||||||
async function pushServiceImages(
|
async function pushServiceImages(
|
||||||
docker: Dockerode,
|
docker: Dockerode,
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
pineClient: ReturnType<typeof import('balena-release').createClient>,
|
pineClient: ReturnType<
|
||||||
|
typeof import('@balena/compose/dist/release').createClient
|
||||||
|
>,
|
||||||
taggedImages: TaggedImage[],
|
taggedImages: TaggedImage[],
|
||||||
token: string,
|
token: string,
|
||||||
skipLogUpload: boolean,
|
skipLogUpload: boolean,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const releaseMod = await import('balena-release');
|
const releaseMod = await import('@balena/compose/dist/release');
|
||||||
logger.logInfo('Pushing images to registry...');
|
logger.logInfo('Pushing images to registry...');
|
||||||
await pushAndUpdateServiceImages(
|
await pushAndUpdateServiceImages(
|
||||||
docker,
|
docker,
|
||||||
@ -1361,8 +1365,8 @@ export async function deployProject(
|
|||||||
skipLogUpload: boolean,
|
skipLogUpload: boolean,
|
||||||
projectPath: string,
|
projectPath: string,
|
||||||
isDraft: boolean,
|
isDraft: boolean,
|
||||||
): Promise<import('balena-release/build/models').ReleaseModel> {
|
): Promise<import('@balena/compose/dist/release/models').ReleaseModel> {
|
||||||
const releaseMod = await import('balena-release');
|
const releaseMod = await import('@balena/compose/dist/release');
|
||||||
const { createRelease, tagServiceImages } = await import('./compose');
|
const { createRelease, tagServiceImages } = await import('./compose');
|
||||||
const tty = (await import('./tty'))(process.stdout);
|
const tty = (await import('./tty'))(process.stdout);
|
||||||
|
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
import * as semver from 'balena-semver';
|
import * as semver from 'balena-semver';
|
||||||
import * as Docker from 'dockerode';
|
import * as Docker from 'dockerode';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import { Composition } from 'resin-compose-parse';
|
import { Composition } from '@balena/compose/dist/parse';
|
||||||
import {
|
import {
|
||||||
BuildTask,
|
BuildTask,
|
||||||
getAuthConfigObj,
|
getAuthConfigObj,
|
||||||
LocalImage,
|
LocalImage,
|
||||||
RegistrySecrets,
|
RegistrySecrets,
|
||||||
} from 'resin-multibuild';
|
} from '@balena/compose/dist/multibuild';
|
||||||
import type { Readable } from 'stream';
|
import type { Readable } from 'stream';
|
||||||
|
|
||||||
import { BALENA_ENGINE_TMP_PATH } from '../../config';
|
import { BALENA_ENGINE_TMP_PATH } from '../../config';
|
||||||
@ -321,7 +321,7 @@ async function performBuilds(
|
|||||||
opts: DeviceDeployOptions,
|
opts: DeviceDeployOptions,
|
||||||
buildLogs?: Dictionary<string>,
|
buildLogs?: Dictionary<string>,
|
||||||
): Promise<BuildTask[]> {
|
): Promise<BuildTask[]> {
|
||||||
const multibuild = await import('resin-multibuild');
|
const multibuild = await import('@balena/compose/dist/multibuild');
|
||||||
|
|
||||||
const buildTasks = await makeBuildTasks(
|
const buildTasks = await makeBuildTasks(
|
||||||
composition,
|
composition,
|
||||||
@ -370,7 +370,7 @@ async function performBuilds(
|
|||||||
const imagesToRemove: string[] = [];
|
const imagesToRemove: string[] = [];
|
||||||
|
|
||||||
// Now tag any external images with the correct name that they should be,
|
// 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/compose/multibuild
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
localImages.map(async (localImage) => {
|
localImages.map(async (localImage) => {
|
||||||
if (localImage.external) {
|
if (localImage.external) {
|
||||||
@ -414,7 +414,7 @@ export async function rebuildSingleTask(
|
|||||||
// this should provide the following callback
|
// this should provide the following callback
|
||||||
containerIdCb?: (id: string) => void,
|
containerIdCb?: (id: string) => void,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const multibuild = await import('resin-multibuild');
|
const multibuild = await import('@balena/compose/dist/multibuild');
|
||||||
// First we run the build task, to get the new image id
|
// First we run the build task, to get the new image id
|
||||||
let buildLogs = '';
|
let buildLogs = '';
|
||||||
const logHandler = (_s: string, line: string) => {
|
const logHandler = (_s: string, line: string) => {
|
||||||
@ -533,10 +533,17 @@ async function assignDockerBuildOpts(
|
|||||||
await Promise.all(
|
await Promise.all(
|
||||||
buildTasks.map(async (task: BuildTask) => {
|
buildTasks.map(async (task: BuildTask) => {
|
||||||
task.dockerOpts = {
|
task.dockerOpts = {
|
||||||
cachefrom: images,
|
...(task.dockerOpts || {}),
|
||||||
labels: {
|
...{
|
||||||
'io.resin.local.image': '1',
|
cachefrom: images,
|
||||||
'io.resin.local.service': task.serviceName,
|
labels: {
|
||||||
|
'io.resin.local.image': '1',
|
||||||
|
'io.resin.local.service': task.serviceName,
|
||||||
|
},
|
||||||
|
t: getImageNameFromTask(task),
|
||||||
|
nocache: opts.nocache,
|
||||||
|
forcerm: true,
|
||||||
|
pull: opts.pull,
|
||||||
},
|
},
|
||||||
t: getImageNameFromTask(task),
|
t: getImageNameFromTask(task),
|
||||||
nocache: opts.nocache,
|
nocache: opts.nocache,
|
||||||
|
@ -21,8 +21,8 @@ import * as fs from 'fs';
|
|||||||
import Livepush, { ContainerNotRunningError } from 'livepush';
|
import Livepush, { ContainerNotRunningError } from 'livepush';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import type { Composition } from 'resin-compose-parse';
|
import type { Composition } from '@balena/compose/dist/parse';
|
||||||
import type { BuildTask } from 'resin-multibuild';
|
import type { BuildTask } from '@balena/compose/dist/multibuild';
|
||||||
|
|
||||||
import { instanceOf } from '../../errors';
|
import { instanceOf } from '../../errors';
|
||||||
import Logger = require('../logger');
|
import Logger = require('../logger');
|
||||||
|
@ -105,7 +105,7 @@ export interface BuildOpts {
|
|||||||
cachefrom?: string[];
|
cachefrom?: string[];
|
||||||
nocache?: boolean;
|
nocache?: boolean;
|
||||||
pull?: boolean;
|
pull?: boolean;
|
||||||
registryconfig?: import('resin-multibuild').RegistrySecrets;
|
registryconfig?: import('@balena/compose/dist/multibuild').RegistrySecrets;
|
||||||
squash?: boolean;
|
squash?: boolean;
|
||||||
t?: string; // only the tag portion of the image name, e.g. 'abc' in 'myimg:abc'
|
t?: string; // only the tag portion of the image name, e.g. 'abc' in 'myimg:abc'
|
||||||
}
|
}
|
||||||
@ -132,7 +132,7 @@ export function generateBuildOpts(options: {
|
|||||||
'cache-from'?: string;
|
'cache-from'?: string;
|
||||||
nocache: boolean;
|
nocache: boolean;
|
||||||
pull?: boolean;
|
pull?: boolean;
|
||||||
'registry-secrets'?: import('resin-multibuild').RegistrySecrets;
|
'registry-secrets'?: import('@balena/compose/dist/multibuild').RegistrySecrets;
|
||||||
squash: boolean;
|
squash: boolean;
|
||||||
tag?: string;
|
tag?: string;
|
||||||
}): BuildOpts {
|
}): BuildOpts {
|
||||||
|
@ -17,7 +17,7 @@ import type { BalenaSDK } from 'balena-sdk';
|
|||||||
import * as JSONStream from 'JSONStream';
|
import * as JSONStream from 'JSONStream';
|
||||||
import * as readline from 'readline';
|
import * as readline from 'readline';
|
||||||
import * as request from 'request';
|
import * as request from 'request';
|
||||||
import { RegistrySecrets } from 'resin-multibuild';
|
import { RegistrySecrets } from '@balena/compose/dist/multibuild';
|
||||||
import type * as Stream from 'stream';
|
import type * as Stream from 'stream';
|
||||||
import streamToPromise = require('stream-to-promise');
|
import streamToPromise = require('stream-to-promise');
|
||||||
import type { Pack } from 'tar-stream';
|
import type { Pack } from 'tar-stream';
|
||||||
|
906
npm-shrinkwrap.json
generated
906
npm-shrinkwrap.json
generated
File diff suppressed because it is too large
Load Diff
@ -29,7 +29,7 @@
|
|||||||
"node_modules/balena-sdk/es2018/index.js",
|
"node_modules/balena-sdk/es2018/index.js",
|
||||||
"node_modules/balena-sync/build/**/*.js",
|
"node_modules/balena-sync/build/**/*.js",
|
||||||
"node_modules/pinejs-client-request/node_modules/pinejs-client-core/es2018/index.js",
|
"node_modules/pinejs-client-request/node_modules/pinejs-client-core/es2018/index.js",
|
||||||
"node_modules/resin-compose-parse/build/schemas/*.json"
|
"node_modules/@balena/compose/dist/parse/schemas/*.json"
|
||||||
],
|
],
|
||||||
"assets": [
|
"assets": [
|
||||||
"build/auth/pages/*.ejs",
|
"build/auth/pages/*.ejs",
|
||||||
@ -194,6 +194,7 @@
|
|||||||
"typescript": "^4.6.4"
|
"typescript": "^4.6.4"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@balena/compose": "^2.1.0",
|
||||||
"@balena/dockerignore": "^1.0.2",
|
"@balena/dockerignore": "^1.0.2",
|
||||||
"@balena/es-version": "^1.0.1",
|
"@balena/es-version": "^1.0.1",
|
||||||
"@oclif/command": "^1.8.16",
|
"@oclif/command": "^1.8.16",
|
||||||
@ -208,7 +209,6 @@
|
|||||||
"balena-image-fs": "^7.0.6",
|
"balena-image-fs": "^7.0.6",
|
||||||
"balena-image-manager": "^8.0.0",
|
"balena-image-manager": "^8.0.0",
|
||||||
"balena-preload": "^12.1.0",
|
"balena-preload": "^12.1.0",
|
||||||
"balena-release": "^3.2.0",
|
|
||||||
"balena-sdk": "^16.22.0",
|
"balena-sdk": "^16.22.0",
|
||||||
"balena-semver": "^2.3.0",
|
"balena-semver": "^2.3.0",
|
||||||
"balena-settings-client": "^4.0.7",
|
"balena-settings-client": "^4.0.7",
|
||||||
@ -226,7 +226,6 @@
|
|||||||
"denymount": "^2.3.0",
|
"denymount": "^2.3.0",
|
||||||
"docker-modem": "3.0.0",
|
"docker-modem": "3.0.0",
|
||||||
"docker-progress": "^5.1.3",
|
"docker-progress": "^5.1.3",
|
||||||
"docker-qemu-transpose": "^1.1.1",
|
|
||||||
"dockerode": "^3.3.1",
|
"dockerode": "^3.3.1",
|
||||||
"ejs": "^3.1.6",
|
"ejs": "^3.1.6",
|
||||||
"etcher-sdk": "^6.2.1",
|
"etcher-sdk": "^6.2.1",
|
||||||
@ -264,9 +263,7 @@
|
|||||||
"request": "^2.88.2",
|
"request": "^2.88.2",
|
||||||
"resin-cli-form": "^2.0.2",
|
"resin-cli-form": "^2.0.2",
|
||||||
"resin-cli-visuals": "^1.8.0",
|
"resin-cli-visuals": "^1.8.0",
|
||||||
"resin-compose-parse": "^2.1.3",
|
|
||||||
"resin-doodles": "^0.2.0",
|
"resin-doodles": "^0.2.0",
|
||||||
"resin-multibuild": "^4.12.2",
|
|
||||||
"resin-stream-logger": "^0.1.2",
|
"resin-stream-logger": "^0.1.2",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"semver": "^7.3.5",
|
"semver": "^7.3.5",
|
||||||
|
4
repo.yml
4
repo.yml
@ -14,7 +14,7 @@ upstream:
|
|||||||
url: 'https://github.com/balena-io-modules/balena-sync'
|
url: 'https://github.com/balena-io-modules/balena-sync'
|
||||||
- repo: 'etcher-sdk'
|
- repo: 'etcher-sdk'
|
||||||
url: 'https://github.com/balena-io-modules/etcher-sdk/'
|
url: 'https://github.com/balena-io-modules/etcher-sdk/'
|
||||||
- repo: 'resin-compose-parse'
|
- repo: 'balena-compose'
|
||||||
url: 'https://github.com/balena-io-modules/resin-compose-parse'
|
url: 'https://github.com/balena-io-modules/balena-compose'
|
||||||
- repo: 'docker-progress'
|
- repo: 'docker-progress'
|
||||||
url: 'https://github.com/balena-io-modules/docker-progress'
|
url: 'https://github.com/balena-io-modules/docker-progress'
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { Request as ReleaseRequest } from 'balena-release';
|
import type { Request as ReleaseRequest } from '@balena/compose/dist/release';
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
@ -291,7 +291,7 @@ describe('balena deploy', function () {
|
|||||||
statusCode: 500,
|
statusCode: 500,
|
||||||
inspectRequest: (_uri, requestBody) => {
|
inspectRequest: (_uri, requestBody) => {
|
||||||
const imageBody = requestBody as Partial<
|
const imageBody = requestBody as Partial<
|
||||||
import('balena-release/build/models').ImageModel
|
import('@balena/compose/dist/release/models').ImageModel
|
||||||
>;
|
>;
|
||||||
expect(imageBody.status).to.equal('success');
|
expect(imageBody.status).to.equal('success');
|
||||||
},
|
},
|
||||||
@ -300,7 +300,7 @@ describe('balena deploy', function () {
|
|||||||
api.expectPatchRelease({
|
api.expectPatchRelease({
|
||||||
inspectRequest: (_uri, requestBody) => {
|
inspectRequest: (_uri, requestBody) => {
|
||||||
const releaseBody = requestBody as Partial<
|
const releaseBody = requestBody as Partial<
|
||||||
import('balena-release/build/models').ReleaseModel
|
import('@balena/compose/dist/release/models').ReleaseModel
|
||||||
>;
|
>;
|
||||||
expect(releaseBody.status).to.equal('failed');
|
expect(releaseBody.status).to.equal('failed');
|
||||||
},
|
},
|
||||||
|
@ -19,7 +19,7 @@ import { expect } from 'chai';
|
|||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import { PathUtils } from 'resin-multibuild';
|
import { PathUtils } from '@balena/compose/dist/multibuild';
|
||||||
import rewire = require('rewire');
|
import rewire = require('rewire');
|
||||||
import * as sinon from 'sinon';
|
import * as sinon from 'sinon';
|
||||||
import { Readable } from 'stream';
|
import { Readable } from 'stream';
|
||||||
|
@ -64,6 +64,12 @@
|
|||||||
The file must be distributed with executable as %2.
|
The file must be distributed with executable as %2.
|
||||||
%1: node_modules/patch-package/node_modules/open/xdg-open
|
%1: node_modules/patch-package/node_modules/open/xdg-open
|
||||||
%2: path-to-executable/xdg-open
|
%2: path-to-executable/xdg-open
|
||||||
|
> Warning Cannot resolve 'path'
|
||||||
|
node_modules/@balena/compose/dist/parse/schemas/index.js
|
||||||
|
Dynamic require may fail at run time, because the requested file
|
||||||
|
is unknown at compilation time and not included into executable.
|
||||||
|
Use a string literal as an argument for 'require', or leave it
|
||||||
|
as is and specify the resolved file name in 'scripts' option.
|
||||||
> Warning Cannot include file %1 into executable.
|
> Warning Cannot include file %1 into executable.
|
||||||
The file must be distributed with executable as %2.
|
The file must be distributed with executable as %2.
|
||||||
%1: node_modules/drivelist/build/Release/drivelist.node
|
%1: node_modules/drivelist/build/Release/drivelist.node
|
||||||
|
@ -64,6 +64,12 @@
|
|||||||
The file must be distributed with executable as %2.
|
The file must be distributed with executable as %2.
|
||||||
%1: node_modules/patch-package/node_modules/open/xdg-open
|
%1: node_modules/patch-package/node_modules/open/xdg-open
|
||||||
%2: path-to-executable/xdg-open
|
%2: path-to-executable/xdg-open
|
||||||
|
> Warning Cannot resolve 'path'
|
||||||
|
node_modules/@balena/compose/dist/parse/schemas/index.js
|
||||||
|
Dynamic require may fail at run time, because the requested file
|
||||||
|
is unknown at compilation time and not included into executable.
|
||||||
|
Use a string literal as an argument for 'require', or leave it
|
||||||
|
as is and specify the resolved file name in 'scripts' option.
|
||||||
> Warning Cannot include file %1 into executable.
|
> Warning Cannot include file %1 into executable.
|
||||||
The file must be distributed with executable as %2.
|
The file must be distributed with executable as %2.
|
||||||
%1: node_modules/drivelist/build/Release/drivelist.node
|
%1: node_modules/drivelist/build/Release/drivelist.node
|
||||||
|
@ -64,6 +64,12 @@
|
|||||||
The file must be distributed with executable as %2.
|
The file must be distributed with executable as %2.
|
||||||
%1: node_modules\patch-package\node_modules\open\xdg-open
|
%1: node_modules\patch-package\node_modules\open\xdg-open
|
||||||
%2: path-to-executable/xdg-open
|
%2: path-to-executable/xdg-open
|
||||||
|
> Warning Cannot resolve 'path'
|
||||||
|
node_modules\@balena\compose\dist\parse\schemas\index.js
|
||||||
|
Dynamic require may fail at run time, because the requested file
|
||||||
|
is unknown at compilation time and not included into executable.
|
||||||
|
Use a string literal as an argument for 'require', or leave it
|
||||||
|
as is and specify the resolved file name in 'scripts' option.
|
||||||
> Warning Cannot include file %1 into executable.
|
> Warning Cannot include file %1 into executable.
|
||||||
The file must be distributed with executable as %2.
|
The file must be distributed with executable as %2.
|
||||||
%1: node_modules\drivelist\build\Release\drivelist.node
|
%1: node_modules\drivelist\build\Release\drivelist.node
|
||||||
|
@ -79,7 +79,7 @@ describeSS('LivepushManager::setupFilesystemWatcher', function () {
|
|||||||
|
|
||||||
async function createMonitors(
|
async function createMonitors(
|
||||||
projectPath: string,
|
projectPath: string,
|
||||||
composition: import('resin-compose-parse').Composition,
|
composition: import('@balena/compose/dist/parse').Composition,
|
||||||
multiDockerignore: boolean,
|
multiDockerignore: boolean,
|
||||||
changedPathHandler: (serviceName: string, changedPath: string) => void,
|
changedPathHandler: (serviceName: string, changedPath: string) => void,
|
||||||
): Promise<ByService<chokidar.FSWatcher>> {
|
): Promise<ByService<chokidar.FSWatcher>> {
|
||||||
|
@ -17,9 +17,11 @@
|
|||||||
|
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
|
|
||||||
describe('resin-multibuild consistency', function () {
|
describe('@balena/compose/multibuild consistency', function () {
|
||||||
it('should use the same values for selected constants', async () => {
|
it('should use the same values for selected constants', async () => {
|
||||||
const { QEMU_BIN_NAME: MQEMU_BIN_NAME } = await import('resin-multibuild');
|
const { QEMU_BIN_NAME: MQEMU_BIN_NAME } = await import(
|
||||||
|
'@balena/compose/dist/multibuild'
|
||||||
|
);
|
||||||
const { QEMU_BIN_NAME } = await import('../../build/utils/qemu');
|
const { QEMU_BIN_NAME } = await import('../../build/utils/qemu');
|
||||||
expect(QEMU_BIN_NAME).to.equal(MQEMU_BIN_NAME);
|
expect(QEMU_BIN_NAME).to.equal(MQEMU_BIN_NAME);
|
||||||
});
|
});
|
||||||
|
30
typings/dockerfile-template/index.d.ts
vendored
30
typings/dockerfile-template/index.d.ts
vendored
@ -1,30 +0,0 @@
|
|||||||
/**
|
|
||||||
* @license
|
|
||||||
* Copyright 2019 Balena Ltd.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare module 'dockerfile-template' {
|
|
||||||
/**
|
|
||||||
* Variables which define what will be replaced, and what they will be replaced with.
|
|
||||||
*/
|
|
||||||
export interface TemplateVariables {
|
|
||||||
[key: string]: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function process(
|
|
||||||
content: string,
|
|
||||||
variables: TemplateVariables,
|
|
||||||
): string;
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user