balena-cli 23.2.15-build-update-compose-tar-dependencies-132ab39d4a4a27c2766acc7a6aee1cedfbe13a2c-1 → 23.2.15-build-mockttp-bf5ce35034d52be121edf75a0bf37797d46e3374-1

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.
@@ -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: TaggedImage['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().toISOString();
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 imagePayloadFields = [
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<Release['release']> {
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().toISOString();
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<import('@balena/compose').release.Request['contract']> {
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');
@@ -74,7 +74,9 @@ export class DeviceAPI {
74
74
  addr: string,
75
75
  port = 48484,
76
76
  ) {
77
- this.deviceAddress = `http://${addr}:${port}/`;
77
+ // Allow override for testing with mock servers
78
+ this.deviceAddress =
79
+ process.env.BALENARC_SUPERVISOR_ADDRESS ?? `http://${addr}:${port}/`;
78
80
  }
79
81
 
80
82
  // Either return nothing, or throw an error with the info