Skip to content

Commit

Permalink
Update balena-compose-parse to 3.0.0
Browse files Browse the repository at this point in the history
Update balena-compose-parse from 2.1.3 to 3.0.0

Changelog-entry: push/build/deploy: Support 'condition: service_started' in 'depends_on' service configuration in docker-compose.yml
Change-type: minor
Signed-off-by: Robert Günzler <[email protected]>
  • Loading branch information
robertgzr committed Dec 1, 2021
1 parent c125e0b commit 208cbcb
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 49 deletions.
2 changes: 1 addition & 1 deletion lib/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

import { flags } from '@oclif/command';
import type { ImageDescriptor } from 'resin-compose-parse';
import type { ImageDescriptor } from '@balena/compose-parse';

import Command from '../command';
import { ExpectedError } from '../errors';
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/compose-types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

import type { Composition, ImageDescriptor } from 'resin-compose-parse';
import type { Composition, ImageDescriptor } from '@balena/compose-parse';
import type { Pack } from 'tar-stream';

interface Image {
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function createProject(
imageTag = '',
) {
const yml = require('js-yaml');
const compose = require('resin-compose-parse');
const compose = require('@balena/compose-parse');

// both methods below may throw.
const rawComposition = yml.load(composeStr);
Expand Down Expand Up @@ -180,7 +180,7 @@ export async function originalTarDirectory(dir, param) {
* @param {string} auth
* @param {number} userId
* @param {number} appId
* @param {import('resin-compose-parse').Composition} composition
* @param {import('@balena/compose-parse').Composition} composition
* @param {boolean} draft
* @param {string|undefined} semver
* @param {string|undefined} contract
Expand Down
14 changes: 7 additions & 7 deletions lib/utils/compose_ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import type {
BuildConfig,
Composition,
ImageDescriptor,
} from 'resin-compose-parse';
} from '@balena/compose-parse';
import type * as MultiBuild from 'resin-multibuild';
import type { Duplex, Readable } from 'stream';
import type { Pack } from 'tar-stream';
Expand Down Expand Up @@ -120,7 +120,7 @@ export async function loadProject(
image?: string,
imageTag?: string,
): Promise<ComposeProject> {
const compose = await import('resin-compose-parse');
const compose = await import('@balena/compose-parse');
const { createProject } = await import('./compose');
let composeName: string;
let composeStr: string;
Expand Down Expand Up @@ -265,7 +265,7 @@ export async function buildProject(
opts: BuildProjectOpts,
): Promise<BuiltImage[]> {
await checkBuildSecretsRequirements(opts.docker, opts.projectPath);
const compose = await import('resin-compose-parse');
const compose = await import('@balena/compose-parse');
const imageDescriptors = compose.parse(opts.composition);
const renderer = await startRenderer({ imageDescriptors, ...opts });
let buildSummaryByService: Dictionary<string> | undefined;
Expand Down Expand Up @@ -727,16 +727,16 @@ export async function getServiceDirsFromComposition(
*
* 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
* 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
* 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-parse/blob/v3.0.0/src/compose.ts#L314-L315
* This is why this implementation works when `services.service.build` is defined
* 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(
image: string | BuildConfig,
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/device/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import * as semver from 'balena-semver';
import * as Docker from 'dockerode';
import * as _ from 'lodash';
import { Composition } from 'resin-compose-parse';
import { Composition } from '@balena/compose-parse';
import {
BuildTask,
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 @@ -21,7 +21,7 @@ import * as fs from 'fs';
import Livepush, { ContainerNotRunningError } from 'livepush';
import * as _ from 'lodash';
import * as path from 'path';
import type { Composition } from 'resin-compose-parse';
import type { Composition } from '@balena/compose-parse';
import type { BuildTask } from 'resin-multibuild';

import { instanceOf } from '../../errors';
Expand Down
81 changes: 51 additions & 30 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"node_modules/balena-sdk/es2018/index.js",
"node_modules/balena-sync/build/**/*.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-parse/build/schemas/*.json"
],
"assets": [
"build/auth/pages/*.ejs",
Expand Down Expand Up @@ -194,6 +194,7 @@
"typescript": "^4.3.5"
},
"dependencies": {
"@balena/compose-parse": "^3.0.0",
"@balena/dockerignore": "^1.0.2",
"@balena/es-version": "^1.0.0",
"@oclif/command": "^1.8.0",
Expand All @@ -209,7 +210,7 @@
"balena-image-fs": "^7.0.6",
"balena-image-manager": "^7.1.0",
"balena-preload": "^11.0.0",
"balena-release": "^3.2.0",
"balena-release": "^3.3.0",
"balena-sdk": "^15.51.1",
"balena-semver": "^2.3.0",
"balena-settings-client": "^4.0.7",
Expand Down Expand Up @@ -265,7 +266,6 @@
"request": "^2.88.2",
"resin-cli-form": "^2.0.2",
"resin-cli-visuals": "^1.8.0",
"resin-compose-parse": "^2.1.3",
"resin-doodles": "^0.1.1",
"resin-multibuild": "^4.12.2",
"resin-stream-logger": "^0.1.2",
Expand Down
4 changes: 2 additions & 2 deletions repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ upstream:
url: 'https://github.com/balena-io-modules/balena-sync'
- repo: 'etcher-sdk'
url: 'https://github.com/balena-io-modules/etcher-sdk/'
- repo: 'resin-compose-parse'
url: 'https://github.com/balena-io-modules/resin-compose-parse'
- repo: 'balena-compose-parse'
url: 'https://github.com/balena-io-modules/balena-compose-parse'
2 changes: 1 addition & 1 deletion tests/utils/device/live.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ describeSS('LivepushManager::setupFilesystemWatcher', function () {

async function createMonitors(
projectPath: string,
composition: import('resin-compose-parse').Composition,
composition: import('@balena/compose-parse').Composition,
multiDockerignore: boolean,
changedPathHandler: (serviceName: string, changedPath: string) => void,
): Promise<ByService<chokidar.FSWatcher>> {
Expand Down

0 comments on commit 208cbcb

Please sign in to comment.