Merge pull request #1787 from balena-io/integrate-new-livepush

Integrate livepush v3 and live directives
This commit is contained in:
srlowe 2020-04-30 14:48:29 +02:00 committed by GitHub
commit a200bf268d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 123 additions and 25 deletions

View File

@ -10,6 +10,7 @@ import { BuildTask } from 'resin-multibuild';
import { instanceOf } from '../../errors';
import Logger = require('../logger');
import { Dockerfile } from 'livepush';
import DeviceAPI, { DeviceInfo, Status } from './api';
import {
DeviceDeployOptions,
@ -105,12 +106,12 @@ export class LivepushManager {
// We only care about builds
if (service.build != null) {
const context = path.join(this.buildContext, service.build.context);
const dockerfile = buildTask.dockerfile;
if (dockerfile == null) {
if (buildTask.dockerfile == null) {
throw new Error(
`Could not detect dockerfile for service: ${serviceName}`,
);
}
const dockerfile = new Dockerfile(buildTask.dockerfile);
if (buildTask.dockerfilePath == null) {
// this is a bit of a hack as resin-bundle-resolve
@ -135,13 +136,13 @@ export class LivepushManager {
return;
}
const livepush = await Livepush.init(
const livepush = await Livepush.init({
dockerfile,
context,
container.containerId,
this.imageIds[serviceName],
this.docker,
);
containerId: container.containerId,
stageImages: this.imageIds[serviceName],
docker: this.docker,
});
const buildVars = buildTask.buildMetadata.getBuildVarsForService(
buildTask.serviceName,
);
@ -380,13 +381,15 @@ export class LivepushManager {
buildLogs[serviceName] = buildLog;
const stageImages = LivepushManager.getMultistageImageIDs(buildLogs);
instance.livepush = await Livepush.init(
buildTask.dockerfile!,
buildTask.context!,
container.containerId,
stageImages[serviceName],
this.docker,
);
const dockerfile = new Dockerfile(buildTask.dockerfile!);
instance.livepush = await Livepush.init({
dockerfile,
context: buildTask.context!,
containerId: container.containerId,
stageImages: stageImages[serviceName],
docker: this.docker,
});
this.assignLivepushOutputHandlers(serviceName, instance.livepush);
} catch (e) {
this.logger.logError(`There was an error rebuilding the service: ${e}`);

115
npm-shrinkwrap.json generated
View File

@ -8468,22 +8468,118 @@
"integrity": "sha1-hMinKrWcRyUyFIDJdeZQg0LnCTc="
},
"livepush": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/livepush/-/livepush-2.1.0.tgz",
"integrity": "sha512-7DNYdaQjr261PHZDh7BZ/U1VlVWtMeuTDmP0EOk6jwuBBTdpGt2Yz7JEpv93ddRv7vthLH/kRUyNdTTgTd9I9Q==",
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/livepush/-/livepush-3.4.0.tgz",
"integrity": "sha512-nRxYg07kBwyutNIjhmjp0sFjk5aX0c4cXf8vmWXCJAHdmvbg+cyBQikaGMXCpoqYbMv9Pq7XdEZLhhF0baTxsQ==",
"requires": {
"bluebird": "^3.5.1",
"bluebird": "^3.7.2",
"chokidar": "^3.3.1",
"docker-file-parser": "^1.0.4",
"dockerode": "^2.5.6",
"lodash": "^4.17.10",
"lodash": "^4.17.15",
"minimatch": "^3.0.4",
"mz": "^2.7.0",
"node-watch": "^0.5.9",
"shell-escape": "^0.2.0",
"shell-quote": "^1.6.1",
"shell-quote": "^1.7.2",
"strict-event-emitter-types": "^2.0.0",
"ts-node": "^8.0.3",
"typed-error": "^3.0.1"
"ts-node": "^8.6.2",
"typed-error": "^3.2.0"
},
"dependencies": {
"anymatch": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz",
"integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==",
"requires": {
"normalize-path": "^3.0.0",
"picomatch": "^2.0.4"
}
},
"binary-extensions": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz",
"integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow=="
},
"braces": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"requires": {
"fill-range": "^7.0.1"
}
},
"chokidar": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.0.tgz",
"integrity": "sha512-aXAaho2VJtisB/1fg1+3nlLJqGOuewTzQpd/Tz0yTg2R0e4IGtshYvtjowyEumcBv2z+y4+kc75Mz7j5xJskcQ==",
"requires": {
"anymatch": "~3.1.1",
"braces": "~3.0.2",
"fsevents": "~2.1.2",
"glob-parent": "~5.1.0",
"is-binary-path": "~2.1.0",
"is-glob": "~4.0.1",
"normalize-path": "~3.0.0",
"readdirp": "~3.4.0"
}
},
"fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"requires": {
"to-regex-range": "^5.0.1"
}
},
"fsevents": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz",
"integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==",
"optional": true
},
"glob-parent": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz",
"integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==",
"requires": {
"is-glob": "^4.0.1"
}
},
"is-binary-path": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
"requires": {
"binary-extensions": "^2.0.0"
}
},
"is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="
},
"normalize-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA=="
},
"readdirp": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.4.0.tgz",
"integrity": "sha512-0xe001vZBnJEK+uKcj8qOhyAKPzIT+gStxWr3LCB0DwcXR5NZJ3IaC+yGnHCYzB/S7ov3m3EEbZI2zeNvX+hGQ==",
"requires": {
"picomatch": "^2.2.1"
}
},
"to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"requires": {
"is-number": "^7.0.0"
}
}
}
},
"load-json-file": {
@ -14073,8 +14169,7 @@
"picomatch": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.1.tgz",
"integrity": "sha512-ISBaA8xQNmwELC7eOjqFKMESB2VIqt4PPDD0nsS95b/9dZXvVKOlz9keMSnoGGKcOHXfTvDD6WMaRoSc9UuhRA==",
"dev": true
"integrity": "sha512-ISBaA8xQNmwELC7eOjqFKMESB2VIqt4PPDD0nsS95b/9dZXvVKOlz9keMSnoGGKcOHXfTvDD6WMaRoSc9UuhRA=="
},
"pify": {
"version": "3.0.0",

View File

@ -216,7 +216,7 @@
"is-root": "^2.1.0",
"js-yaml": "^3.13.1",
"klaw": "^3.0.0",
"livepush": "^2.1.0",
"livepush": "^3.4.0",
"lodash": "^4.17.15",
"minimatch": "^3.0.4",
"mixpanel": "^0.10.3",