balena-cli 23.2.14-build-update-compose-tar-dependencies-8decbe453ca1f661f606bfb12ed61e774d54276a-1 → 23.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -100
- package/build/commands/device/restart.js +4 -2
- package/build/commands/device/restart.js.map +1 -1
- package/build/utils/compose.d.ts +1 -1
- package/build/utils/compose.js +8 -8
- package/build/utils/compose.js.map +1 -1
- package/build/utils/compose_ts.d.ts +2 -2
- package/build/utils/compose_ts.js +9 -8
- package/build/utils/compose_ts.js.map +1 -1
- package/build/utils/patterns.js +3 -3
- package/build/utils/patterns.js.map +1 -1
- package/npm-shrinkwrap.json +126 -64
- package/oclif.manifest.json +130 -130
- package/package.json +6 -6
- package/src/commands/device/restart.ts +4 -2
- package/src/utils/compose-types.d.ts +12 -12
- package/src/utils/compose.ts +10 -15
- package/src/utils/compose_ts.ts +14 -12
- package/src/utils/patterns.ts +3 -3
|
@@ -15,9 +15,12 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
import type
|
|
18
|
+
import type {
|
|
19
|
+
ImageModel,
|
|
20
|
+
ReleaseModel,
|
|
21
|
+
} from '@balena/compose/dist/release/models';
|
|
22
|
+
import type { Composition, ImageDescriptor } from '@balena/compose/dist/parse';
|
|
19
23
|
import type { Pack } from 'tar-stream';
|
|
20
|
-
import type { BalenaModel } from 'balena-sdk';
|
|
21
24
|
|
|
22
25
|
interface Image {
|
|
23
26
|
context: string;
|
|
@@ -39,10 +42,7 @@ export interface BuiltImage {
|
|
|
39
42
|
|
|
40
43
|
export interface TaggedImage {
|
|
41
44
|
localImage: import('dockerode').Image;
|
|
42
|
-
serviceImage:
|
|
43
|
-
BalenaModel['image']['Read'],
|
|
44
|
-
'created_at' | 'is_a_build_of__service'
|
|
45
|
-
>;
|
|
45
|
+
serviceImage: import('@balena/compose/dist/release/models').ImageModel;
|
|
46
46
|
serviceName: string;
|
|
47
47
|
logs: string;
|
|
48
48
|
props: BuiltImage.props;
|
|
@@ -75,14 +75,14 @@ export interface ComposeCliFlags {
|
|
|
75
75
|
export interface ComposeProject {
|
|
76
76
|
path: string;
|
|
77
77
|
name: string;
|
|
78
|
-
composition:
|
|
79
|
-
descriptors:
|
|
78
|
+
composition: Composition;
|
|
79
|
+
descriptors: ImageDescriptor[];
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
export interface Release {
|
|
83
|
-
client: compose.release.Request['client'];
|
|
83
|
+
client: import('@balena/compose').release.Request['client'];
|
|
84
84
|
release: Pick<
|
|
85
|
-
|
|
85
|
+
ReleaseModel,
|
|
86
86
|
| 'id'
|
|
87
87
|
| 'status'
|
|
88
88
|
| 'commit'
|
|
@@ -95,12 +95,12 @@ export interface Release {
|
|
|
95
95
|
| 'end_timestamp'
|
|
96
96
|
>;
|
|
97
97
|
serviceImages: Dictionary<
|
|
98
|
-
Omit<
|
|
98
|
+
Omit<ImageModel, 'created_at' | 'is_a_build_of__service'>
|
|
99
99
|
>;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
interface TarDirectoryOptions {
|
|
103
|
-
composition?:
|
|
103
|
+
composition?: Composition;
|
|
104
104
|
convertEol?: boolean;
|
|
105
105
|
multiDockerignore?: boolean;
|
|
106
106
|
preFinalizeCallback?: (pack: Pack) => void | Promise<void>;
|
package/src/utils/compose.ts
CHANGED
|
@@ -128,7 +128,7 @@ export const createRelease = async function (
|
|
|
128
128
|
composition: Composition,
|
|
129
129
|
draft: boolean,
|
|
130
130
|
semver: string | undefined,
|
|
131
|
-
contract: import('@balena/compose/dist/release').
|
|
131
|
+
contract: import('@balena/compose/dist/release/models').ReleaseModel['contract'],
|
|
132
132
|
imgDescriptors: ImageDescriptor[],
|
|
133
133
|
): Promise<Release> {
|
|
134
134
|
const crypto = require('crypto') as typeof import('crypto');
|
|
@@ -156,7 +156,7 @@ export const createRelease = async function (
|
|
|
156
156
|
);
|
|
157
157
|
|
|
158
158
|
const { id: userId } = await sdk.auth.getUserInfo();
|
|
159
|
-
const { release, serviceImages
|
|
159
|
+
const { release, serviceImages } = await releaseMod.create({
|
|
160
160
|
client: pinejsClient,
|
|
161
161
|
user: userId,
|
|
162
162
|
application: appId,
|
|
@@ -169,19 +169,14 @@ export const createRelease = async function (
|
|
|
169
169
|
imgDescriptors,
|
|
170
170
|
});
|
|
171
171
|
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
return [key, si];
|
|
181
|
-
}
|
|
182
|
-
return [key, serviceImage];
|
|
183
|
-
}),
|
|
184
|
-
);
|
|
172
|
+
for (const serviceImage of Object.values(serviceImages)) {
|
|
173
|
+
if ('created_at' in serviceImage) {
|
|
174
|
+
delete serviceImage.created_at;
|
|
175
|
+
}
|
|
176
|
+
if ('is_a_build_of__service' in serviceImage) {
|
|
177
|
+
delete serviceImage.is_a_build_of__service;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
185
180
|
|
|
186
181
|
return {
|
|
187
182
|
client: pinejsClient,
|
package/src/utils/compose_ts.ts
CHANGED
|
@@ -37,7 +37,6 @@ import type {
|
|
|
37
37
|
BuiltImage,
|
|
38
38
|
ComposeOpts,
|
|
39
39
|
ComposeProject,
|
|
40
|
-
Release,
|
|
41
40
|
TaggedImage,
|
|
42
41
|
TarDirectoryOptions,
|
|
43
42
|
} from './compose-types';
|
|
@@ -45,6 +44,7 @@ import type { DeviceInfo } from './device/api';
|
|
|
45
44
|
import { getBalenaSdk, getCliUx, stripIndent } from './lazy';
|
|
46
45
|
import Logger = require('./logger');
|
|
47
46
|
import { exists } from './which';
|
|
47
|
+
import { pick } from './helpers';
|
|
48
48
|
|
|
49
49
|
const allowedContractTypes = ['sw.application', 'sw.block'];
|
|
50
50
|
|
|
@@ -1274,7 +1274,7 @@ async function pushAndUpdateServiceImages(
|
|
|
1274
1274
|
token: string,
|
|
1275
1275
|
images: TaggedImage[],
|
|
1276
1276
|
afterEach: (
|
|
1277
|
-
serviceImage:
|
|
1277
|
+
serviceImage: import('@balena/compose/dist/release/models').ImageModel,
|
|
1278
1278
|
props: object,
|
|
1279
1279
|
) => Promise<void>,
|
|
1280
1280
|
) {
|
|
@@ -1338,7 +1338,7 @@ async function pushAndUpdateServiceImages(
|
|
|
1338
1338
|
if (props.endTime) {
|
|
1339
1339
|
serviceImage.end_timestamp = props.endTime;
|
|
1340
1340
|
}
|
|
1341
|
-
serviceImage.push_timestamp = new Date()
|
|
1341
|
+
serviceImage.push_timestamp = new Date();
|
|
1342
1342
|
serviceImage.status = 'success';
|
|
1343
1343
|
} catch (error) {
|
|
1344
1344
|
serviceImage.error_message = '' + error;
|
|
@@ -1378,23 +1378,23 @@ async function pushServiceImages(
|
|
|
1378
1378
|
logger.logDebug(
|
|
1379
1379
|
`Saving image ${serviceImage.is_stored_at__image_location}`,
|
|
1380
1380
|
);
|
|
1381
|
+
if (skipLogUpload) {
|
|
1382
|
+
delete serviceImage.build_log;
|
|
1383
|
+
}
|
|
1381
1384
|
|
|
1382
1385
|
// These are the only update-able image fields in bC atm, and passing
|
|
1383
1386
|
// the whole image object in v7+ would result the allowlist to reject the request.
|
|
1384
|
-
const
|
|
1387
|
+
const imagePayload = pick(serviceImage, [
|
|
1385
1388
|
'end_timestamp',
|
|
1386
1389
|
'project_type',
|
|
1387
1390
|
'error_message',
|
|
1391
|
+
'build_log',
|
|
1388
1392
|
'push_timestamp',
|
|
1389
1393
|
'status',
|
|
1390
1394
|
'content_hash',
|
|
1391
1395
|
'dockerfile',
|
|
1392
1396
|
'image_size',
|
|
1393
|
-
];
|
|
1394
|
-
if (!skipLogUpload) {
|
|
1395
|
-
imagePayloadFields.push('build_log');
|
|
1396
|
-
}
|
|
1397
|
-
const imagePayload = _.pick(serviceImage, imagePayloadFields);
|
|
1397
|
+
]);
|
|
1398
1398
|
|
|
1399
1399
|
if (
|
|
1400
1400
|
typeof imagePayload.error_message === 'string' &&
|
|
@@ -1425,7 +1425,7 @@ export async function deployProject(
|
|
|
1425
1425
|
projectPath: string,
|
|
1426
1426
|
isDraft: boolean,
|
|
1427
1427
|
imgDescriptors: ImageDescriptor[],
|
|
1428
|
-
): Promise<
|
|
1428
|
+
): Promise<import('@balena/compose/dist/release/models').ReleaseModel> {
|
|
1429
1429
|
const releaseMod = await import('@balena/compose/dist/release');
|
|
1430
1430
|
const { createRelease, tagServiceImages } = await import('./compose');
|
|
1431
1431
|
const tty = (await import('./tty'))(process.stdout);
|
|
@@ -1496,7 +1496,7 @@ export async function deployProject(
|
|
|
1496
1496
|
}
|
|
1497
1497
|
} finally {
|
|
1498
1498
|
await runSpinner(tty, spinner, `${prefix}Saving release...`, async () => {
|
|
1499
|
-
release.end_timestamp = new Date()
|
|
1499
|
+
release.end_timestamp = new Date();
|
|
1500
1500
|
if (release.id != null) {
|
|
1501
1501
|
await releaseMod.updateRelease(pineClient, release.id, {
|
|
1502
1502
|
status: release.status,
|
|
@@ -1552,7 +1552,9 @@ export function createRunLoop(tick: (...args: any[]) => void) {
|
|
|
1552
1552
|
|
|
1553
1553
|
async function getContractContent(
|
|
1554
1554
|
filePath: string,
|
|
1555
|
-
): Promise<
|
|
1555
|
+
): Promise<
|
|
1556
|
+
import('@balena/compose/dist/release/models').ReleaseModel['contract']
|
|
1557
|
+
> {
|
|
1556
1558
|
let fileContentAsString;
|
|
1557
1559
|
try {
|
|
1558
1560
|
fileContentAsString = await fs.readFile(filePath, 'utf8');
|
package/src/utils/patterns.ts
CHANGED
|
@@ -294,10 +294,10 @@ export async function getOnlineTargetDeviceUuid(
|
|
|
294
294
|
`Trying to fetch device by UUID ${fleetOrDevice} (${typeof fleetOrDevice})`,
|
|
295
295
|
);
|
|
296
296
|
const device = await sdk.models.device.get(fleetOrDevice, {
|
|
297
|
-
$select: ['uuid', '
|
|
297
|
+
$select: ['uuid', 'is_connected_to_vpn'],
|
|
298
298
|
});
|
|
299
299
|
|
|
300
|
-
if (!device.
|
|
300
|
+
if (!device.is_connected_to_vpn) {
|
|
301
301
|
throw new ExpectedError(
|
|
302
302
|
`Device with UUID ${fleetOrDevice} is disconnected`,
|
|
303
303
|
);
|
|
@@ -325,7 +325,7 @@ export async function getOnlineTargetDeviceUuid(
|
|
|
325
325
|
$expand: {
|
|
326
326
|
owns__device: {
|
|
327
327
|
$select: ['device_name', 'uuid'],
|
|
328
|
-
$filter: {
|
|
328
|
+
$filter: { is_connected_to_vpn: true },
|
|
329
329
|
$orderby: { device_name: 'asc' },
|
|
330
330
|
},
|
|
331
331
|
},
|