@balena/open-balena-api 30.1.0-build-service-install-as-async-job-f06e3878c984b1d08abbd9230755a136c13cf86e-1 → 30.1.0-build-logs-reading-90db3c529994359a25ab65a121c9119cf9c098ec-1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/features/ci-cd/hooks/service-installs.js +14 -44
- package/dist/features/ci-cd/hooks/service-installs.js.map +1 -1
- package/dist/features/device-logs/lib/config.d.ts +1 -0
- package/dist/features/device-logs/lib/config.js +2 -1
- package/dist/features/device-logs/lib/config.js.map +1 -1
- package/dist/features/device-logs/lib/read.js +9 -7
- package/dist/features/device-logs/lib/read.js.map +1 -1
- package/dist/features/device-logs/lib/store.js +1 -8
- package/dist/features/device-logs/lib/store.js.map +1 -1
- package/dist/lib/config.d.ts +8 -8
- package/dist/lib/config.js +9 -18
- package/dist/lib/config.js.map +1 -1
- package/dist/tasks.d.ts +1 -1
- package/dist/tasks.js +1 -1
- package/dist/tasks.js.map +1 -1
- package/package.json +2 -2
- package/dist/features/ci-cd/tasks/index.d.ts +0 -1
- package/dist/features/ci-cd/tasks/index.js +0 -2
- package/dist/features/ci-cd/tasks/index.js.map +0 -1
- package/dist/features/ci-cd/tasks/service-installs.d.ts +0 -3
- package/dist/features/ci-cd/tasks/service-installs.js +0 -152
- package/dist/features/ci-cd/tasks/service-installs.js.map +0 -1
@@ -1,39 +1,9 @@
|
|
1
1
|
import _ from 'lodash';
|
2
2
|
import { sbvrUtils, hooks, permissions } from '@balena/pinejs';
|
3
|
-
|
4
|
-
import { ASYNC_TASK_CREATE_SERVICE_INSTALLS_BATCH_SIZE, ASYNC_TASK_CREATE_SERVICE_INSTALLS_ENABLED, ASYNC_TASKS_ENABLED, } from '../../../lib/config.js';
|
5
|
-
const createServiceInstallsAsync = async (api, deviceFilterOrIds, tx) => {
|
6
|
-
const deviceIds = Array.isArray(deviceFilterOrIds)
|
7
|
-
? deviceFilterOrIds
|
8
|
-
: (await api.get({
|
9
|
-
resource: 'device',
|
10
|
-
options: {
|
11
|
-
$select: 'id',
|
12
|
-
$filter: deviceFilterOrIds,
|
13
|
-
},
|
14
|
-
})).map(({ id }) => id);
|
15
|
-
await Promise.all(_.chunk(deviceIds, ASYNC_TASK_CREATE_SERVICE_INSTALLS_BATCH_SIZE).map(async (deviceBatch) => {
|
16
|
-
return await sbvrUtils.api.tasks.post({
|
17
|
-
resource: 'task',
|
18
|
-
passthrough: { req: permissions.root, tx },
|
19
|
-
body: {
|
20
|
-
key: randomUUID(),
|
21
|
-
is_executed_by__handler: 'create_service_installs',
|
22
|
-
is_executed_with__parameter_set: {
|
23
|
-
devices: deviceBatch,
|
24
|
-
},
|
25
|
-
},
|
26
|
-
});
|
27
|
-
}));
|
28
|
-
};
|
29
|
-
const createReleaseServiceInstalls = async (api, deviceFilterOrIds, releaseFilter, tx) => {
|
3
|
+
const createReleaseServiceInstalls = async (api, deviceFilterOrIds, releaseFilter) => {
|
30
4
|
if (Array.isArray(deviceFilterOrIds) && deviceFilterOrIds.length === 0) {
|
31
5
|
return;
|
32
6
|
}
|
33
|
-
if (ASYNC_TASKS_ENABLED && ASYNC_TASK_CREATE_SERVICE_INSTALLS_ENABLED) {
|
34
|
-
await createServiceInstallsAsync(api, deviceFilterOrIds, tx);
|
35
|
-
return;
|
36
|
-
}
|
37
7
|
const services = await api.get({
|
38
8
|
resource: 'service',
|
39
9
|
options: {
|
@@ -128,14 +98,14 @@ const createReleaseServiceInstalls = async (api, deviceFilterOrIds, releaseFilte
|
|
128
98
|
}));
|
129
99
|
}));
|
130
100
|
};
|
131
|
-
const createAppServiceInstalls = async (api, appId, deviceIds
|
101
|
+
const createAppServiceInstalls = async (api, appId, deviceIds) => createReleaseServiceInstalls(api, deviceIds, {
|
132
102
|
should_be_running_on__application: {
|
133
103
|
$any: {
|
134
104
|
$alias: 'a',
|
135
105
|
$expr: { a: { id: appId } },
|
136
106
|
},
|
137
107
|
},
|
138
|
-
}
|
108
|
+
});
|
139
109
|
const deleteServiceInstallsForCurrentApp = (api, newAppId, deviceIds) => api.delete({
|
140
110
|
resource: 'service_install',
|
141
111
|
options: {
|
@@ -171,7 +141,7 @@ const deleteServiceInstallsForCurrentApp = (api, newAppId, deviceIds) => api.del
|
|
171
141
|
},
|
172
142
|
});
|
173
143
|
hooks.addPureHook('PATCH', 'resin', 'application', {
|
174
|
-
POSTRUN: async ({ api, request
|
144
|
+
POSTRUN: async ({ api, request }) => {
|
175
145
|
const affectedIds = request.affectedIds;
|
176
146
|
if (request.values.should_be_running__release != null &&
|
177
147
|
affectedIds.length !== 0) {
|
@@ -181,7 +151,7 @@ hooks.addPureHook('PATCH', 'resin', 'application', {
|
|
181
151
|
is_pinned_on__release: null,
|
182
152
|
}, {
|
183
153
|
id: request.values.should_be_running__release,
|
184
|
-
}
|
154
|
+
});
|
185
155
|
}
|
186
156
|
},
|
187
157
|
});
|
@@ -194,13 +164,13 @@ hooks.addPureHook('POST', 'resin', 'device', {
|
|
194
164
|
const rootApi = api.clone({ passthrough: { tx, req: permissions.root } });
|
195
165
|
const app = request.values.belongs_to__application;
|
196
166
|
if (app != null) {
|
197
|
-
await createAppServiceInstalls(rootApi, app, [deviceId]
|
167
|
+
await createAppServiceInstalls(rootApi, app, [deviceId]);
|
198
168
|
}
|
199
169
|
const release = request.values.is_pinned_on__release;
|
200
170
|
if (release != null) {
|
201
171
|
await createReleaseServiceInstalls(api, [deviceId], {
|
202
172
|
id: release,
|
203
|
-
}
|
173
|
+
});
|
204
174
|
}
|
205
175
|
},
|
206
176
|
});
|
@@ -215,12 +185,12 @@ hooks.addPureHook('PATCH', 'resin', 'device', {
|
|
215
185
|
const affectedIds = await sbvrUtils.getAffectedIds(args);
|
216
186
|
if (affectedIds.length !== 0) {
|
217
187
|
await deleteServiceInstallsForCurrentApp(args.api, newAppId, affectedIds);
|
218
|
-
await createAppServiceInstalls(args.api, newAppId, affectedIds
|
188
|
+
await createAppServiceInstalls(args.api, newAppId, affectedIds);
|
219
189
|
}
|
220
190
|
},
|
221
191
|
});
|
222
192
|
hooks.addPureHook('PATCH', 'resin', 'device', {
|
223
|
-
POSTRUN: async ({ api, request
|
193
|
+
POSTRUN: async ({ api, request }) => {
|
224
194
|
const affectedIds = request.affectedIds;
|
225
195
|
if (request.values.is_pinned_on__release !== undefined &&
|
226
196
|
affectedIds.length !== 0) {
|
@@ -229,7 +199,7 @@ hooks.addPureHook('PATCH', 'resin', 'device', {
|
|
229
199
|
if (request.values.is_pinned_on__release != null) {
|
230
200
|
await createReleaseServiceInstalls(api, affectedIds, {
|
231
201
|
id: request.values.is_pinned_on__release,
|
232
|
-
}
|
202
|
+
});
|
233
203
|
}
|
234
204
|
else {
|
235
205
|
const devices = (await api.get({
|
@@ -242,7 +212,7 @@ hooks.addPureHook('PATCH', 'resin', 'device', {
|
|
242
212
|
},
|
243
213
|
}));
|
244
214
|
const devicesByApp = _.groupBy(devices, (d) => d.belongs_to__application.__id);
|
245
|
-
await Promise.all(Object.keys(devicesByApp).map((appId) => createAppServiceInstalls(api, devicesByApp[appId][0].belongs_to__application.__id, devicesByApp[appId].map((d) => d.id)
|
215
|
+
await Promise.all(Object.keys(devicesByApp).map((appId) => createAppServiceInstalls(api, devicesByApp[appId][0].belongs_to__application.__id, devicesByApp[appId].map((d) => d.id))));
|
246
216
|
}
|
247
217
|
}
|
248
218
|
},
|
@@ -262,19 +232,19 @@ const addSystemAppServiceInstallHooks = (fieldName) => {
|
|
262
232
|
});
|
263
233
|
await createReleaseServiceInstalls(rootApi, [deviceId], {
|
264
234
|
id: releaseId,
|
265
|
-
}
|
235
|
+
});
|
266
236
|
}
|
267
237
|
},
|
268
238
|
});
|
269
239
|
hooks.addPureHook('PATCH', 'resin', 'device', {
|
270
|
-
POSTRUN: async ({ api, request
|
240
|
+
POSTRUN: async ({ api, request }) => {
|
271
241
|
const affectedIds = request.affectedIds;
|
272
242
|
const releaseId = request.values[fieldName];
|
273
243
|
// Create supervisor/hostApp service installs when the supervisor/hostApp is pinned on device update
|
274
244
|
if (releaseId != null && affectedIds.length !== 0) {
|
275
245
|
await createReleaseServiceInstalls(api, affectedIds, {
|
276
246
|
id: releaseId,
|
277
|
-
}
|
247
|
+
});
|
278
248
|
}
|
279
249
|
},
|
280
250
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"service-installs.js","sourceRoot":"","sources":["../../../../src/features/ci-cd/hooks/service-installs.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
1
|
+
{"version":3,"file":"service-installs.js","sourceRoot":"","sources":["../../../../src/features/ci-cd/hooks/service-installs.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAI/D,MAAM,4BAA4B,GAAG,KAAK,EACzC,GAA+B,EAC/B,iBAAuD,EACvD,aAAsC,EACtB,EAAE;IAClB,IAAI,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxE,OAAO;IACR,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC;QAC9B,QAAQ,EAAE,SAAS;QACnB,OAAO,EAAE;YACR,OAAO,EAAE,IAAI;YACb,OAAO,EAAE;gBACR,kBAAkB,EAAE;oBACnB,IAAI,EAAE;wBACL,MAAM,EAAE,GAAG;wBACX,KAAK,EAAE;4BACN,CAAC,EAAE;gCACF,mBAAmB,EAAE;oCACpB,IAAI,EAAE;wCACL,MAAM,EAAE,KAAK;wCACb,KAAK,EAAE;4CACN,GAAG,EAAE;gDACJ,OAAO,EAAE;oDACR,IAAI,EAAE;wDACL,MAAM,EAAE,GAAG;wDACX,KAAK,EAAE,EAAE,CAAC,EAAE,aAAa,EAAE;qDAC3B;iDACD;6CACD;yCACD;qCAC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B,CAAC,GAAG,EAAE,WAAW,EAAE;oBACpD,EAAE,EAAE,SAAS;iBACb,CAAC,CAAC;YACJ,CAAC;QACF,CAAC;KACD,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,KAAK,MAAM,SAAS,IAAI;IACvB,+BAA+B;IAC/B,gCAAgC;CACvB,EAAE,CAAC;IACZ,+BAA+B,CAAC,SAAS,CAAC,CAAC;AAC5C,CAAC"}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import type { DeviceLogsBackend, LogContext } from './struct.js';
|
2
2
|
export declare const LOKI_ENABLED: boolean | "" | undefined;
|
3
3
|
export declare const shouldPublishToLoki: () => boolean | "" | undefined;
|
4
|
+
export declare const shouldReadFromLoki: () => boolean | "" | undefined;
|
4
5
|
export declare function addRetentionLimit(ctx: Omit<LogContext, 'retention_limit'>): LogContext;
|
5
6
|
export declare const getBackend: () => DeviceLogsBackend;
|
6
7
|
export declare const getLokiBackend: () => Promise<DeviceLogsBackend>;
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import _ from 'lodash';
|
2
2
|
import { RedisBackend } from './backends/redis.js';
|
3
|
-
import { LOGS_DEFAULT_RETENTION_LIMIT, LOKI_READ_HOST, LOKI_WRITE_HOST, LOKI_WRITE_PCT, } from '../../../lib/config.js';
|
3
|
+
import { LOGS_DEFAULT_RETENTION_LIMIT, LOKI_READ_HOST, LOKI_READ_PCT, LOKI_WRITE_HOST, LOKI_WRITE_PCT, } from '../../../lib/config.js';
|
4
4
|
export const LOKI_ENABLED = LOKI_READ_HOST && LOKI_WRITE_HOST && LOKI_WRITE_PCT > 0;
|
5
5
|
export const shouldPublishToLoki = () => LOKI_ENABLED && LOKI_WRITE_PCT > Math.random() * 100;
|
6
|
+
export const shouldReadFromLoki = () => LOKI_ENABLED && LOKI_READ_PCT > Math.random() * 100;
|
6
7
|
export function addRetentionLimit(ctx) {
|
7
8
|
return {
|
8
9
|
...ctx,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../src/features/device-logs/lib/config.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EACN,4BAA4B,EAC5B,cAAc,EACd,eAAe,EACf,cAAc,GACd,MAAM,wBAAwB,CAAC;AAEhC,MAAM,CAAC,MAAM,YAAY,GACxB,cAAc,IAAI,eAAe,IAAI,cAAc,GAAG,CAAC,CAAC;AACzD,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE,CACvC,YAAY,IAAI,cAAc,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC;
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../src/features/device-logs/lib/config.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EACN,4BAA4B,EAC5B,cAAc,EACd,aAAa,EACb,eAAe,EACf,cAAc,GACd,MAAM,wBAAwB,CAAC;AAEhC,MAAM,CAAC,MAAM,YAAY,GACxB,cAAc,IAAI,eAAe,IAAI,cAAc,GAAG,CAAC,CAAC;AACzD,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE,CACvC,YAAY,IAAI,cAAc,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC;AACtD,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE,CACtC,YAAY,IAAI,aAAa,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC;AAErD,MAAM,UAAU,iBAAiB,CAChC,GAAwC;IAExC,OAAO;QACN,GAAG,GAAG;QACN,eAAe,EAAE,4BAA4B;KAC7C,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,GAAsB,EAAE,CAAC,IAAI,YAAY,EAAE,CAAC,CAAC;AAE9E,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,IAAgC,EAAE;IAC3E,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAC3D,OAAO,IAAI,WAAW,EAAE,CAAC;AAC1B,CAAC,CAAC,CAAC"}
|
@@ -3,11 +3,12 @@ import _ from 'lodash';
|
|
3
3
|
import { sbvrUtils, errors } from '@balena/pinejs';
|
4
4
|
import { captureException, handleHttpErrors, } from '../../../infra/error-handling/index.js';
|
5
5
|
import { StreamState } from './struct.js';
|
6
|
-
import { addRetentionLimit, getBackend } from './config.js';
|
6
|
+
import { addRetentionLimit, getBackend, getLokiBackend, shouldReadFromLoki, } from './config.js';
|
7
7
|
import { getNanoTimestamp } from '../../../lib/utils.js';
|
8
8
|
import { LOGS_DEFAULT_HISTORY_COUNT, LOGS_DEFAULT_SUBSCRIPTION_COUNT, LOGS_HEARTBEAT_INTERVAL, LOGS_READ_STREAM_FLUSH_INTERVAL, NDJSON_CTYPE, } from '../../../lib/config.js';
|
9
9
|
const { NotFoundError } = errors;
|
10
10
|
const { api } = sbvrUtils;
|
11
|
+
const getReadBackend = async () => shouldReadFromLoki() ? await getLokiBackend() : getBackend();
|
11
12
|
export const read = (onLogReadStreamInitialized) => async (req, res) => {
|
12
13
|
try {
|
13
14
|
const ctx = await getReadContext(req);
|
@@ -16,7 +17,7 @@ export const read = (onLogReadStreamInitialized) => async (req, res) => {
|
|
16
17
|
onLogReadStreamInitialized?.(req);
|
17
18
|
}
|
18
19
|
else {
|
19
|
-
const logs = await getHistory(ctx, req, LOGS_DEFAULT_HISTORY_COUNT);
|
20
|
+
const logs = await getHistory(await getReadBackend(), ctx, req, LOGS_DEFAULT_HISTORY_COUNT);
|
20
21
|
res.json(logs);
|
21
22
|
}
|
22
23
|
}
|
@@ -29,6 +30,7 @@ export const read = (onLogReadStreamInitialized) => async (req, res) => {
|
|
29
30
|
}
|
30
31
|
};
|
31
32
|
async function handleStreamingRead(ctx, req, res) {
|
33
|
+
const backend = await getReadBackend();
|
32
34
|
let state = StreamState.Buffering;
|
33
35
|
let dropped = 0;
|
34
36
|
const buffer = [];
|
@@ -90,7 +92,7 @@ async function handleStreamingRead(ctx, req, res) {
|
|
90
92
|
function close() {
|
91
93
|
if (state !== StreamState.Closed) {
|
92
94
|
state = StreamState.Closed;
|
93
|
-
|
95
|
+
backend.unsubscribe(ctx, onLog);
|
94
96
|
}
|
95
97
|
clearInterval(heartbeatInterval);
|
96
98
|
heartbeatInterval = undefined;
|
@@ -98,9 +100,9 @@ async function handleStreamingRead(ctx, req, res) {
|
|
98
100
|
onFinished(req, close);
|
99
101
|
onFinished(res, close);
|
100
102
|
// Subscribe in parallel so we don't miss logs in between
|
101
|
-
|
103
|
+
backend.subscribe(ctx, onLog);
|
102
104
|
try {
|
103
|
-
let logs = await getHistory(ctx, req, LOGS_DEFAULT_SUBSCRIPTION_COUNT);
|
105
|
+
let logs = await getHistory(backend, ctx, req, LOGS_DEFAULT_SUBSCRIPTION_COUNT);
|
104
106
|
// We need this cast as typescript narrows to `StreamState.Buffering`
|
105
107
|
// because it ignores that during the `await` break it can be changed
|
106
108
|
// TODO: remove this once typescript removes the incorrect narrowing
|
@@ -147,14 +149,14 @@ function getCount(countParam, defaultCount) {
|
|
147
149
|
return defaultCount;
|
148
150
|
}
|
149
151
|
}
|
150
|
-
function getHistory(ctx, { query }, defaultCount) {
|
152
|
+
function getHistory(backend, ctx, { query }, defaultCount) {
|
151
153
|
const count = getCount(query.count, defaultCount);
|
152
154
|
// Optimize the case where the caller doesn't need any history
|
153
155
|
if (!count) {
|
154
156
|
return [];
|
155
157
|
}
|
156
158
|
// TODO: Implement `?since` filter here too in the next phase
|
157
|
-
return
|
159
|
+
return backend.history(ctx, count);
|
158
160
|
}
|
159
161
|
async function getReadContext(req) {
|
160
162
|
const { uuid } = req.params;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../../../src/features/device-logs/lib/read.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EACN,gBAAgB,EAChB,gBAAgB,GAChB,MAAM,wCAAwC,CAAC;AAGhD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,
|
1
|
+
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../../../src/features/device-logs/lib/read.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EACN,gBAAgB,EAChB,gBAAgB,GAChB,MAAM,wCAAwC,CAAC;AAGhD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EACN,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,kBAAkB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EACN,0BAA0B,EAC1B,+BAA+B,EAC/B,uBAAuB,EACvB,+BAA+B,EAC/B,YAAY,GACZ,MAAM,wBAAwB,CAAC;AAEhC,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,CAAC;AACjC,MAAM,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC;AAE1B,MAAM,cAAc,GAAG,KAAK,IAAI,EAAE,CACjC,kBAAkB,EAAE,CAAC,CAAC,CAAC,MAAM,cAAc,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;AAE9D,MAAM,CAAC,MAAM,IAAI,GAChB,CACC,0BAAsE,EACrD,E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,GAAG,QAAQ,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAE7C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC;QAChC,OAAO,WAAW,CAAC;IACpB,CAAC;SAAM,CAAC;QACP,OAAO,YAAY,CAAC;IACrB,CAAC;AACF,CAAC;AAED,SAAS,UAAU,CAClB,OAA0B,EAC1B,GAAe,EACf,EAAE,KAAK,EAAW,EAClB,YAAoB;IAEpB,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,KAA2B,EAAE,YAAY,CAAC,CAAC;IAExE,8DAA8D;IAC9D,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,OAAO,EAAE,CAAC;IACX,CAAC;IAED,6DAA6D;IAC7D,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACpC,CAAC;AAED,KAAK,UAAU,cAAc,CAAC,GAAY;IACzC,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC;IAC5B,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC;QAClC,QAAQ,EAAE,QAAQ;QAClB,EAAE,EAAE,EAAE,IAAI,EAAE;QACZ,WAAW,EAAE,EAAE,GAAG,EAAE;QACpB,OAAO,EAAE;YACR,OAAO,EAAE,CAAC,IAAI,CAAC;SACf;KACD,CAAC,CAAC;IAEH,IAAI,CAAC,MAAM,EAAE,CAAC;QACb,MAAM,IAAI,aAAa,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,iBAAiB,CAAC;QACxB,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,IAAI;KACJ,CAAC,CAAC;AACJ,CAAC"}
|
@@ -59,14 +59,7 @@ export const store = async (req, res) => {
|
|
59
59
|
if (logs.length) {
|
60
60
|
const ctx = await getWriteContext(req);
|
61
61
|
// start publishing to both backends
|
62
|
-
await
|
63
|
-
getBackend().publish(ctx, logs),
|
64
|
-
shouldPublishToLoki()
|
65
|
-
? (await getLokiBackend()).publish(ctx, logs).catch((err) => {
|
66
|
-
captureException(err, 'Failed to publish logs to Loki');
|
67
|
-
})
|
68
|
-
: undefined,
|
69
|
-
]);
|
62
|
+
await publishBackend(getBackend(), ctx, logs);
|
70
63
|
}
|
71
64
|
res.status(201).end();
|
72
65
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../../../src/features/device-logs/lib/store.ts"],"names":[],"mappings":"AAQA,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EACN,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,GACd,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACN,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,YAAY,EACZ,mBAAmB,GACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EACN,oCAAoC,EACpC,uCAAuC,EACvC,0BAA0B,EAC1B,uBAAuB,EACvB,YAAY,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,kBAAkB,EAClB,uBAAuB,GACvB,MAAM,+BAA+B,CAAC;AAEvC,MAAM,EACL,iBAAiB,EACjB,uBAAuB,EACvB,yBAAyB,GACzB,GAAG,MAAM,CAAC;AACX,MAAM,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC;AAE1B,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;AAEpC,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE;IAC7B,MAAM,gBAAgB,GAAG,kBAAkB,CAC1C,KAAK,EACJ,IAAY,EACZ,GAA8B,EAC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,KAAK,EAAE,CAAC;YAC/B,MAAM,IAAI,iBAAiB,EAAE,CAAC;QAC/B,CAAC;QACD,OAAO,eAAe,CAAC;IACxB,CAAC,CAAC;AACH,CAAC,CAAC,EAAE,CAAC;AAEL,MAAM,CAAC,MAAM,KAAK,GAAmB,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;IAC1E,IAAI,CAAC;QACJ,MAAM,IAAI,GAAoB,GAAG,CAAC,IAAI,CAAC;QACvC,MAAM,IAAI,GAAgB,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACvD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,GAAG,GAAG,MAAM,eAAe,CAAC,GAAG,CAAC,CAAC;YACvC,oCAAoC;YACpC,MAAM,
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../../../src/features/device-logs/lib/store.ts"],"names":[],"mappings":"AAQA,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EACN,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,GACd,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACN,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,YAAY,EACZ,mBAAmB,GACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EACN,oCAAoC,EACpC,uCAAuC,EACvC,0BAA0B,EAC1B,uBAAuB,EACvB,YAAY,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,kBAAkB,EAClB,uBAAuB,GACvB,MAAM,+BAA+B,CAAC;AAEvC,MAAM,EACL,iBAAiB,EACjB,uBAAuB,EACvB,yBAAyB,GACzB,GAAG,MAAM,CAA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,EAAE,IAAI;wBACd,OAAO,EAAE,uBAAuB,WAAW,kCAAkC;qBAC7E,CAAC,CAAC;gBACJ,CAAC;gBACD,4DAA4D;gBAC5D,MAAM,cAAc,GAAG,cAAc,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;gBAC5D,mBAAmB;gBACnB,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;gBAClB,gDAAgD;gBAChD,IAAI,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC;oBACpB,GAAG,CAAC,MAAM,EAAE,CAAC;gBACd,CAAC;gBACD,kCAAkC;gBAClC,MAAM,cAAc,CAAC;YACtB,CAAC;YACD,gBAAgB,GAAG,KAAK,CAAC;YAEzB,wEAAwE;YACxE,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACvB,QAAQ,EAAE,CAAC;YACZ,CAAC;QACF,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QAClC,CAAC;IACF,CAAC;IACD,SAAS,QAAQ;QAChB,IAAI,gBAAgB,KAAK,KAAK,EAAE,CAAC;YAChC,OAAO;QACR,CAAC;QACD,8DAA8D;QAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS;YAC9B,CAAC,CAAC,0BAA0B;YAC5B,CAAC,CAAC,uCAAuC,CAAC;QAC3C,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QAC9B,gBAAgB,GAAG,IAAI,CAAC;IACzB,CAAC;AACF,CAAC"}
|
package/dist/lib/config.d.ts
CHANGED
@@ -17,7 +17,7 @@ export declare let API_HEARTBEAT_STATE_TIMEOUT_SECONDS: number;
|
|
17
17
|
export declare let API_HEARTBEAT_STATE_ONLINE_UPDATE_CACHE_TIMEOUT: number | null;
|
18
18
|
export declare const API_VPN_SERVICE_API_KEY: string;
|
19
19
|
export declare const VPN_CONNECT_PROXY_PORT: number;
|
20
|
-
export declare
|
20
|
+
export declare const ASYNC_TASKS_ENABLED: boolean;
|
21
21
|
export declare const AUTH_RESINOS_REGISTRY_CODE: string | undefined;
|
22
22
|
export declare const COOKIE_SESSION_SECRET: string;
|
23
23
|
/**
|
@@ -96,6 +96,12 @@ export declare const LOKI_READ_HOST: string | undefined;
|
|
96
96
|
export declare const LOKI_WRITE_PORT: number;
|
97
97
|
export declare const LOKI_READ_PORT: number;
|
98
98
|
export declare const LOKI_WRITE_PCT: number;
|
99
|
+
/**
|
100
|
+
* This is the percent of log read requests that will go to loki, however the number of logs fetched from loki
|
101
|
+
* will vary based upon the type of those read requests, eg it could be a long streaming request or a one-off fetch
|
102
|
+
* Note: It is recommended to only set this if `LOKI_WRITE_PCT` is at 100
|
103
|
+
*/
|
104
|
+
export declare const LOKI_READ_PCT: number;
|
99
105
|
export declare const NDJSON_CTYPE = "application/x-ndjson";
|
100
106
|
export declare const LOGS_HEARTBEAT_INTERVAL = 58000;
|
101
107
|
export declare const LOGS_DEFAULT_HISTORY_COUNT = 1000;
|
@@ -108,10 +114,7 @@ export declare const LOGS_STREAM_FLUSH_INTERVAL: number;
|
|
108
114
|
export declare const LOGS_BACKEND_UNAVAILABLE_FLUSH_INTERVAL: number;
|
109
115
|
export declare const LOGS_WRITE_BUFFER_LIMIT: number;
|
110
116
|
export declare const PINEJS_QUEUE_CONCURRENCY: number;
|
111
|
-
export declare
|
112
|
-
export declare let ASYNC_TASK_CREATE_SERVICE_INSTALLS_ENABLED: boolean;
|
113
|
-
export declare const ASYNC_TASK_CREATE_SERVICE_INSTALLS_BATCH_SIZE: number;
|
114
|
-
export declare const ASYNC_TASK_CREATE_SERVICE_INSTALLS_MAX_TIME_MS: number;
|
117
|
+
export declare const PINEJS_QUEUE_INTERVAL_MS: number;
|
115
118
|
export declare const REGISTRY2_HOST: string;
|
116
119
|
export declare const SENTRY_DSN: string | undefined;
|
117
120
|
export declare const SUPERUSER_EMAIL: string;
|
@@ -169,8 +172,5 @@ export declare const TEST_MOCK_ONLY: {
|
|
169
172
|
DEFAULT_SUPERVISOR_POLL_INTERVAL: number;
|
170
173
|
API_HEARTBEAT_STATE_TIMEOUT_SECONDS: number;
|
171
174
|
API_HEARTBEAT_STATE_ONLINE_UPDATE_CACHE_TIMEOUT: number | null;
|
172
|
-
ASYNC_TASKS_ENABLED: boolean;
|
173
|
-
ASYNC_TASK_CREATE_SERVICE_INSTALLS_ENABLED: boolean;
|
174
|
-
PINEJS_QUEUE_INTERVAL_MS: number;
|
175
175
|
};
|
176
176
|
export {};
|
package/dist/lib/config.js
CHANGED
@@ -58,7 +58,7 @@ export let API_HEARTBEAT_STATE_TIMEOUT_SECONDS = intVar('API_HEARTBEAT_STATE_TIM
|
|
58
58
|
export let API_HEARTBEAT_STATE_ONLINE_UPDATE_CACHE_TIMEOUT = intVar('API_HEARTBEAT_STATE_ONLINE_UPDATE_CACHE_TIMEOUT', null);
|
59
59
|
export const API_VPN_SERVICE_API_KEY = requiredVar('API_VPN_SERVICE_API_KEY');
|
60
60
|
export const VPN_CONNECT_PROXY_PORT = intVar('VPN_CONNECT_PROXY_PORT', 3128);
|
61
|
-
export
|
61
|
+
export const ASYNC_TASKS_ENABLED = boolVar('ASYNC_TASKS_ENABLED', false);
|
62
62
|
export const AUTH_RESINOS_REGISTRY_CODE = optionalVar('AUTH_RESINOS_REGISTRY_CODE');
|
63
63
|
export const COOKIE_SESSION_SECRET = requiredVar('COOKIE_SESSION_SECRET');
|
64
64
|
/**
|
@@ -108,7 +108,7 @@ export const DEVICE_CONFIG_SSH_AUTHORIZED_KEYS = optionalVar('DEVICE_CONFIG_SSH_
|
|
108
108
|
export const EXTERNAL_HTTP_TIMEOUT_MS = intVar('EXTERNAL_HTTP_TIMEOUT_MS', 25 * SECONDS);
|
109
109
|
export const IMAGE_STORAGE_BUCKET = requiredVar('IMAGE_STORAGE_BUCKET');
|
110
110
|
export const IMAGE_STORAGE_ENDPOINT = requiredVar('IMAGE_STORAGE_ENDPOINT');
|
111
|
-
export const IMAGE_STORAGE_PREFIX =
|
111
|
+
export const IMAGE_STORAGE_PREFIX = optionalVar('IMAGE_STORAGE_PREFIX', 'images');
|
112
112
|
export const IMAGE_STORAGE_ACCESS_KEY = optionalVar('IMAGE_STORAGE_ACCESS_KEY');
|
113
113
|
export const IMAGE_STORAGE_SECRET_KEY = optionalVar('IMAGE_STORAGE_SECRET_KEY');
|
114
114
|
export const IMAGE_STORAGE_FORCE_PATH_STYLE = boolVar('IMAGE_STORAGE_FORCE_PATH_STYLE', false);
|
@@ -180,6 +180,12 @@ export const LOKI_WRITE_PORT = intVar('LOKI_WRITE_PORT', LOKI_PORT);
|
|
180
180
|
export const LOKI_READ_PORT = intVar('LOKI_READ_PORT', LOKI_PORT);
|
181
181
|
// control the percent of logs written to Loki while scaling up
|
182
182
|
export const LOKI_WRITE_PCT = intVar('LOKI_WRITE_PCT', 0);
|
183
|
+
/**
|
184
|
+
* This is the percent of log read requests that will go to loki, however the number of logs fetched from loki
|
185
|
+
* will vary based upon the type of those read requests, eg it could be a long streaming request or a one-off fetch
|
186
|
+
* Note: It is recommended to only set this if `LOKI_WRITE_PCT` is at 100
|
187
|
+
*/
|
188
|
+
export const LOKI_READ_PCT = intVar('LOKI_READ_PCT', 0);
|
183
189
|
export const NDJSON_CTYPE = 'application/x-ndjson';
|
184
190
|
// Logs read config
|
185
191
|
export const LOGS_HEARTBEAT_INTERVAL = 58000;
|
@@ -195,10 +201,7 @@ export const LOGS_STREAM_FLUSH_INTERVAL = intVar('LOGS_STREAM_FLUSH_INTERVAL', 5
|
|
195
201
|
export const LOGS_BACKEND_UNAVAILABLE_FLUSH_INTERVAL = intVar('LOGS_BACKEND_UNAVAILABLE_FLUSH_INTERVAL', 5000);
|
196
202
|
export const LOGS_WRITE_BUFFER_LIMIT = intVar('LOGS_WRITE_BUFFER_LIMIT', 50);
|
197
203
|
export const PINEJS_QUEUE_CONCURRENCY = intVar('PINEJS_QUEUE_CONCURRENCY', 1);
|
198
|
-
export
|
199
|
-
export let ASYNC_TASK_CREATE_SERVICE_INSTALLS_ENABLED = boolVar('ASYNC_TASK_CREATE_SERVICE_INSTALLS_ENABLED', false);
|
200
|
-
export const ASYNC_TASK_CREATE_SERVICE_INSTALLS_BATCH_SIZE = intVar('ASYNC_TASK_CREATE_SERVICE_INSTALLS_BATCH_SIZE', 2000);
|
201
|
-
export const ASYNC_TASK_CREATE_SERVICE_INSTALLS_MAX_TIME_MS = intVar('ASYNC_TASK_CREATE_SERVICE_INSTALLS_MAX_TIME_MS', 30 * 1000);
|
204
|
+
export const PINEJS_QUEUE_INTERVAL_MS = intVar('PINEJS_QUEUE_INTERVAL_MS', 1000);
|
202
205
|
export const REGISTRY2_HOST = requiredVar('REGISTRY2_HOST');
|
203
206
|
export const SENTRY_DSN = optionalVar('SENTRY_DSN');
|
204
207
|
export const SUPERUSER_EMAIL = optionalVar('SUPERUSER_EMAIL', '');
|
@@ -324,17 +327,5 @@ export const TEST_MOCK_ONLY = {
|
|
324
327
|
guardTestMockOnly();
|
325
328
|
API_HEARTBEAT_STATE_ONLINE_UPDATE_CACHE_TIMEOUT = v;
|
326
329
|
},
|
327
|
-
set ASYNC_TASKS_ENABLED(v) {
|
328
|
-
guardTestMockOnly();
|
329
|
-
ASYNC_TASKS_ENABLED = v;
|
330
|
-
},
|
331
|
-
set ASYNC_TASK_CREATE_SERVICE_INSTALLS_ENABLED(v) {
|
332
|
-
guardTestMockOnly();
|
333
|
-
ASYNC_TASK_CREATE_SERVICE_INSTALLS_ENABLED = v;
|
334
|
-
},
|
335
|
-
set PINEJS_QUEUE_INTERVAL_MS(v) {
|
336
|
-
guardTestMockOnly();
|
337
|
-
PINEJS_QUEUE_INTERVAL_MS = v;
|
338
|
-
},
|
339
330
|
};
|
340
331
|
//# sourceMappingURL=config.js.map
|
package/dist/lib/config.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mapp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,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzC,QAAQ,KAAK,CAAC,MAAM,EAAE,CAAC;QACtB,KAAK,CAAC;YACL,OAAO;gBACN,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;aAClB,CAAC;QACH,KAAK,CAAC;YACL,OAAO;gBACN,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;gBAClB,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;aAClB,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,KAAK,CACd,IAAI,OAAO,sGAAsG,CACjH,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACrC,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,MAAM,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACtE,CAAC;AACF,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC7B,IAAI,gCAAgC,CACnC,CAA0C;QAE1C,iBAAiB,EAAE,CAAC;QACpB,gCAAgC,GAAG,CAAC,CAAC;IACtC,CAAC;IACD,IAAI,mCAAmC,CACtC,CAA6C;QAE7C,iBAAiB,EAAE,CAAC;QACpB,mCAAmC,GAAG,CAAC,CAAC;IACzC,CAAC;IACD,IAAI,+CAA+C,CAClD,CAAyD;QAEzD,iBAAiB,EAAE,CAAC;QACpB,+CAA+C,GAAG,CAAC,CAAC;IACrD,CAAC;CACD,CAAC"}
|
package/dist/tasks.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
export {};
|
package/dist/tasks.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
1
|
+
export {};
|
2
2
|
//# sourceMappingURL=tasks.js.map
|
package/dist/tasks.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../src/tasks.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../src/tasks.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@balena/open-balena-api",
|
3
3
|
"description": "Internet of things, Made Simple",
|
4
|
-
"version": "30.1.0-build-
|
4
|
+
"version": "30.1.0-build-logs-reading-90db3c529994359a25ab65a121c9119cf9c098ec-1",
|
5
5
|
"license": "AGPL-3.0",
|
6
6
|
"repository": {
|
7
7
|
"type": "git",
|
@@ -167,6 +167,6 @@
|
|
167
167
|
"loader": "ts-node/esm/transpile-only"
|
168
168
|
},
|
169
169
|
"versionist": {
|
170
|
-
"publishedAt": "2024-10-
|
170
|
+
"publishedAt": "2024-10-23T15:37:43.238Z"
|
171
171
|
}
|
172
172
|
}
|
@@ -1 +0,0 @@
|
|
1
|
-
import './service-installs.js';
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/features/ci-cd/tasks/index.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAC"}
|
@@ -1,152 +0,0 @@
|
|
1
|
-
import { tasks, sbvrUtils, permissions } from '@balena/pinejs';
|
2
|
-
import _ from 'lodash';
|
3
|
-
import { randomUUID } from 'node:crypto';
|
4
|
-
import { ASYNC_TASK_CREATE_SERVICE_INSTALLS_MAX_TIME_MS } from '../../../lib/config.js';
|
5
|
-
const schema = {
|
6
|
-
type: 'object',
|
7
|
-
properties: {
|
8
|
-
devices: {
|
9
|
-
type: 'array',
|
10
|
-
items: { type: 'number' },
|
11
|
-
},
|
12
|
-
},
|
13
|
-
required: ['devices'],
|
14
|
-
};
|
15
|
-
const { api } = sbvrUtils;
|
16
|
-
tasks.addTaskHandler('create_service_installs', async (options) => {
|
17
|
-
try {
|
18
|
-
const totalSiCreated = await createServiceInstalls(options.params);
|
19
|
-
console.info(`[service-install-task] Created ${totalSiCreated} service installs`);
|
20
|
-
return {
|
21
|
-
status: 'succeeded',
|
22
|
-
};
|
23
|
-
}
|
24
|
-
catch (e) {
|
25
|
-
console.error(`[service-install-task] Error creating service installs: ${e}`);
|
26
|
-
return {
|
27
|
-
error: `${e}`,
|
28
|
-
status: 'failed',
|
29
|
-
};
|
30
|
-
}
|
31
|
-
}, schema);
|
32
|
-
const createServiceInstalls = async ({ devices, }) => {
|
33
|
-
const startTime = Date.now();
|
34
|
-
const releaseExpand = {
|
35
|
-
$select: 'id',
|
36
|
-
$expand: {
|
37
|
-
contains__image: {
|
38
|
-
$select: 'id',
|
39
|
-
$expand: {
|
40
|
-
image: {
|
41
|
-
$select: 'is_a_build_of__service',
|
42
|
-
},
|
43
|
-
},
|
44
|
-
},
|
45
|
-
},
|
46
|
-
};
|
47
|
-
const deviceWithServices = await api.resin.get({
|
48
|
-
resource: 'device',
|
49
|
-
passthrough: { req: permissions.rootRead },
|
50
|
-
options: {
|
51
|
-
$select: 'id',
|
52
|
-
$expand: {
|
53
|
-
should_be_running__release: releaseExpand,
|
54
|
-
should_be_managed_by__release: releaseExpand,
|
55
|
-
should_be_operated_by__release: releaseExpand,
|
56
|
-
},
|
57
|
-
$filter: {
|
58
|
-
id: { $in: devices },
|
59
|
-
},
|
60
|
-
},
|
61
|
-
});
|
62
|
-
const serviceIds = [
|
63
|
-
...new Set(deviceWithServices.flatMap((device) => [
|
64
|
-
...device.should_be_running__release,
|
65
|
-
...device.should_be_managed_by__release,
|
66
|
-
...device.should_be_operated_by__release,
|
67
|
-
].flatMap((release) => release.contains__image.flatMap((image) => image.image.map((img) => img.is_a_build_of__service.__id))))),
|
68
|
-
];
|
69
|
-
const missingServiceFilters = serviceIds.map((serviceId) => ({
|
70
|
-
$not: {
|
71
|
-
service_install: {
|
72
|
-
$any: {
|
73
|
-
$alias: 'si',
|
74
|
-
$expr: {
|
75
|
-
si: {
|
76
|
-
installs__service: serviceId,
|
77
|
-
},
|
78
|
-
},
|
79
|
-
},
|
80
|
-
},
|
81
|
-
},
|
82
|
-
}));
|
83
|
-
if (missingServiceFilters.length === 0) {
|
84
|
-
console.info('[service-install-task] No service installs to create');
|
85
|
-
return 0;
|
86
|
-
}
|
87
|
-
const devicesToAddServiceInstalls = await api.resin.get({
|
88
|
-
resource: 'device',
|
89
|
-
passthrough: { req: permissions.rootRead },
|
90
|
-
options: {
|
91
|
-
$select: 'id',
|
92
|
-
$expand: {
|
93
|
-
service_install: {
|
94
|
-
$select: 'installs__service',
|
95
|
-
$filter: {
|
96
|
-
installs__service: { $in: serviceIds },
|
97
|
-
},
|
98
|
-
},
|
99
|
-
},
|
100
|
-
$filter: {
|
101
|
-
id: { $in: devices },
|
102
|
-
...(missingServiceFilters.length === 1
|
103
|
-
? missingServiceFilters[0]
|
104
|
-
: {
|
105
|
-
$or: missingServiceFilters,
|
106
|
-
}),
|
107
|
-
},
|
108
|
-
},
|
109
|
-
});
|
110
|
-
// This is already batched at one level, does it make sense to batch it again?
|
111
|
-
const remainingDevices = new Set(devices);
|
112
|
-
let totalSiCreated = 0;
|
113
|
-
return await sbvrUtils.db.transaction(async (tx) => {
|
114
|
-
for (const device of devicesToAddServiceInstalls) {
|
115
|
-
if (Date.now() - startTime >
|
116
|
-
ASYNC_TASK_CREATE_SERVICE_INSTALLS_MAX_TIME_MS) {
|
117
|
-
await api.tasks.post({
|
118
|
-
resource: 'task',
|
119
|
-
passthrough: { req: permissions.root, tx },
|
120
|
-
body: {
|
121
|
-
key: randomUUID(),
|
122
|
-
is_executed_by__handler: 'create_service_installs',
|
123
|
-
is_executed_with__parameter_set: {
|
124
|
-
devices: Array.from(remainingDevices),
|
125
|
-
},
|
126
|
-
},
|
127
|
-
});
|
128
|
-
console.info('[service-install-task] Task took too long. Created a new task for the remaining devices');
|
129
|
-
return totalSiCreated;
|
130
|
-
}
|
131
|
-
// Use existingServiceIds as a Set for faster lookups on the follow up filter
|
132
|
-
const existingServiceIds = device.service_install.map((si) => si.installs__service.__id);
|
133
|
-
const deviceServiceIds = _.difference(serviceIds, existingServiceIds);
|
134
|
-
await Promise.all(deviceServiceIds.map(async (serviceId) => {
|
135
|
-
// Create a service_install for this pair of service and device
|
136
|
-
await api.resin.post({
|
137
|
-
resource: 'service_install',
|
138
|
-
passthrough: { req: permissions.root, tx },
|
139
|
-
body: {
|
140
|
-
device: device.id,
|
141
|
-
installs__service: serviceId,
|
142
|
-
},
|
143
|
-
options: { returnResource: false },
|
144
|
-
});
|
145
|
-
}));
|
146
|
-
totalSiCreated += deviceServiceIds.length;
|
147
|
-
remainingDevices.delete(device.id);
|
148
|
-
}
|
149
|
-
return totalSiCreated;
|
150
|
-
});
|
151
|
-
};
|
152
|
-
//# sourceMappingURL=service-installs.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"service-installs.js","sourceRoot":"","sources":["../../../../src/features/ci-cd/tasks/service-installs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,8CAA8C,EAAE,MAAM,wBAAwB,CAAC;AAExF,MAAM,MAAM,GAAG;IACd,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACX,OAAO,EAAE;YACR,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SACzB;KACD;IACD,QAAQ,EAAE,CAAC,SAAS,CAAC;CACrB,CAAC;AAEF,MAAM,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC;AAM1B,KAAK,CAAC,cAAc,CACnB,yBAAyB,EACzB,KAAK,EAAE,OAAO,EAAE,EAAE;IACjB,IAAI,CAAC;QACJ,MAAM,cAAc,GAAG,MAAM,qBAAqB,CACjD,OAAO,CAAC,MAAyC,CACjD,CAAC;QACF,OAAO,CAAC,IAAI,CACX,kCAAkC,cAAc,mBAAmB,CACnE,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