From 208cbcb5479748b198b2b4d50bf614ca66630c99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20G=C3=BCnzler?= Date: Fri, 22 Oct 2021 16:26:53 +0200 Subject: [PATCH] Update balena-compose-parse to 3.0.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- lib/commands/deploy.ts | 2 +- lib/utils/compose-types.d.ts | 2 +- lib/utils/compose.js | 4 +- lib/utils/compose_ts.ts | 14 +++--- lib/utils/device/deploy.ts | 2 +- lib/utils/device/live.ts | 2 +- npm-shrinkwrap.json | 81 +++++++++++++++++++++------------ package.json | 6 +-- repo.yml | 4 +- tests/utils/device/live.spec.ts | 2 +- 10 files changed, 70 insertions(+), 49 deletions(-) diff --git a/lib/commands/deploy.ts b/lib/commands/deploy.ts index 098e85de6a..8cb07e874a 100644 --- a/lib/commands/deploy.ts +++ b/lib/commands/deploy.ts @@ -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'; diff --git a/lib/utils/compose-types.d.ts b/lib/utils/compose-types.d.ts index 8ed3c22558..f4eb8d1122 100644 --- a/lib/utils/compose-types.d.ts +++ b/lib/utils/compose-types.d.ts @@ -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 { diff --git a/lib/utils/compose.js b/lib/utils/compose.js index e2e30dbbdf..efb523b74d 100644 --- a/lib/utils/compose.js +++ b/lib/utils/compose.js @@ -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); @@ -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 diff --git a/lib/utils/compose_ts.ts b/lib/utils/compose_ts.ts index 5f08357632..099c692882 100644 --- a/lib/utils/compose_ts.ts +++ b/lib/utils/compose_ts.ts @@ -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'; @@ -120,7 +120,7 @@ export async function loadProject( image?: string, imageTag?: string, ): Promise { - 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; @@ -265,7 +265,7 @@ export async function buildProject( opts: BuildProjectOpts, ): Promise { 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 | undefined; @@ -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, diff --git a/lib/utils/device/deploy.ts b/lib/utils/device/deploy.ts index 53d16732a5..0abbd4b806 100644 --- a/lib/utils/device/deploy.ts +++ b/lib/utils/device/deploy.ts @@ -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, diff --git a/lib/utils/device/live.ts b/lib/utils/device/live.ts index 642f3710b8..5f2abe357b 100644 --- a/lib/utils/device/live.ts +++ b/lib/utils/device/live.ts @@ -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'; diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index b7cb356343..46b13576e5 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1235,6 +1235,25 @@ "sax": "^1.2.4" } }, + "@balena/compose-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@balena/compose-parse/-/compose-parse-3.0.0.tgz", + "integrity": "sha512-Wd2DSwcjtj+Nt7z2P9dqt2C8jHZWPxNhVGOsAgyxBfDP61s8v49iv8trb/3cPaGupwM3JZx2FJ8yIj0YJWfwoA==", + "requires": { + "@types/lodash": "^4.14.86", + "@types/node": "^8.0.55", + "ajv": "^6.0.1", + "lodash": "^4.17.4", + "typed-error": "^3.0.0" + }, + "dependencies": { + "@types/node": { + "version": "8.10.66", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.66.tgz", + "integrity": "sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw==" + } + } + }, "@balena/dockerignore": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-1.0.2.tgz", @@ -3950,16 +3969,16 @@ } }, "balena-release": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/balena-release/-/balena-release-3.2.0.tgz", - "integrity": "sha512-jwmAjIZCJ5I46/yQNN+dA73RWlre0+jBVmo2QeJl1pK83obTLyifJeWNVf5irzP8KFE7WQzo9ICK1cCpLtygFA==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/balena-release/-/balena-release-3.3.0.tgz", + "integrity": "sha512-Ult7Tdg12ASCphDze6wkqrh3nx3bEkHsXF8jFz6vJ/HNmcojOJlZxlgbQbnhxxTsJa045QCW3wXvqgPFf06ckQ==", "requires": { + "@balena/compose-parse": "^3.0.0", "@types/bluebird": "^3.5.18", "@types/node": "^8.0.55", "@types/request": "^2.0.8", "bluebird": "^3.5.1", "pinejs-client-request": "^7.1.0", - "resin-compose-parse": "^2.0.0", "typed-error": "^3.0.0" }, "dependencies": { @@ -8145,9 +8164,9 @@ "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" }, "fp-ts": { - "version": "2.11.3", - "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.11.3.tgz", - "integrity": "sha512-qHI5iaVSFNFmdl6yDensWfFMk32iafAINCnqx8m486DV1+Jht/bTnA9CyahL+Xm7h2y3erinviVBIAWvv5bPYw==" + "version": "2.11.5", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.11.5.tgz", + "integrity": "sha512-OqlwJq1BdpB83BZXTqI+dNcA6uYk6qk4u9Cgnt64Y+XS7dwdbp/mobx8S2KXf2AXH+scNmA/UVK3SEFHR3vHZA==" }, "fragment-cache": { "version": "0.2.1", @@ -15263,9 +15282,9 @@ } }, "resin-compose-parse": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/resin-compose-parse/-/resin-compose-parse-2.1.3.tgz", - "integrity": "sha512-X5WQo+OHoPe+FV8JliGzSIL4glLX0PPFvtnopppYef1UqKcJm+GHaiEZBOj3C7vIEDqQrsNrKXY/BpadlOFiWA==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/resin-compose-parse/-/resin-compose-parse-2.4.0.tgz", + "integrity": "sha512-JldqZbHp+YWSC7UwIrI5ZZJwNPln+28a+nIM2cDMVIJliE8ofQFLTwEQzvvh8SoLqJgGh9cXtKEA7vkS3V9W7A==", "requires": { "@types/lodash": "^4.14.86", "@types/node": "^8.0.55", @@ -15625,17 +15644,6 @@ "ms": "^2.1.1" } }, - "docker-modem": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/docker-modem/-/docker-modem-1.0.9.tgz", - "integrity": "sha512-lVjqCSCIAUDZPAZIeyM125HXfNvOmYYInciphNrLrylUtKyW66meAjSPXWchKVzoIYZx69TPnAepVSSkeawoIw==", - "requires": { - "JSONStream": "1.3.2", - "debug": "^3.2.6", - "readable-stream": "~1.0.26-4", - "split-ca": "^1.0.0" - } - }, "dockerode": { "version": "2.5.8", "resolved": "https://registry.npmjs.org/dockerode/-/dockerode-2.5.8.tgz", @@ -15644,6 +15652,19 @@ "concat-stream": "~1.6.2", "docker-modem": "^1.0.8", "tar-fs": "~1.16.3" + }, + "dependencies": { + "docker-modem": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/docker-modem/-/docker-modem-1.0.9.tgz", + "integrity": "sha512-lVjqCSCIAUDZPAZIeyM125HXfNvOmYYInciphNrLrylUtKyW66meAjSPXWchKVzoIYZx69TPnAepVSSkeawoIw==", + "requires": { + "JSONStream": "1.3.2", + "debug": "^3.2.6", + "readable-stream": "~1.0.26-4", + "split-ca": "^1.0.0" + } + } } }, "isarray": { @@ -15659,15 +15680,6 @@ "argparse": "^2.0.1" } }, - "pump": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/pump/-/pump-1.0.3.tgz", - "integrity": "sha512-8k0JupWme55+9tCVE+FS5ULT3K6AbgqrGa58lTT49RpyfwwcGedHqaC5LlQNdEAumn/wFsu6aPwkuPMioy8kqw==", - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, "readable-stream": { "version": "1.0.34", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", @@ -15708,6 +15720,15 @@ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, + "pump": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/pump/-/pump-1.0.3.tgz", + "integrity": "sha512-8k0JupWme55+9tCVE+FS5ULT3K6AbgqrGa58lTT49RpyfwwcGedHqaC5LlQNdEAumn/wFsu6aPwkuPMioy8kqw==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, "readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", diff --git a/package.json b/package.json index 3a291d42e2..0d3bc8f67c 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", @@ -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", @@ -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", diff --git a/repo.yml b/repo.yml index 909cee6c41..7e783599c7 100644 --- a/repo.yml +++ b/repo.yml @@ -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' diff --git a/tests/utils/device/live.spec.ts b/tests/utils/device/live.spec.ts index e8947e3cd7..066897bca3 100644 --- a/tests/utils/device/live.spec.ts +++ b/tests/utils/device/live.spec.ts @@ -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> {