Skip to content

Commit cfd717d

Browse files
committed
var-update-trigger: Updates only devices that should be running the release that the image env var is part of
Change-type: patch
1 parent 58849cb commit cfd717d

File tree

1 file changed

+16
-28
lines changed

1 file changed

+16
-28
lines changed

src/features/vars-schema/hooks/vars-update-trigger.ts

+16-28
Original file line numberDiff line numberDiff line change
@@ -319,21 +319,17 @@ addEnvHooks('device_service_environment_variable', async (args) => {
319319
addEnvHooks('image_environment_variable', async (args) => {
320320
if (args.req.body.release_image != null) {
321321
return {
322-
image_install: {
322+
should_be_running__release: {
323323
$any: {
324-
$alias: 'ii',
324+
$alias: 'r',
325325
$expr: {
326-
installs__image: {
326+
status: 'success',
327+
release_image: {
327328
$any: {
328-
$alias: 'i',
329+
$alias: 'ri',
329330
$expr: {
330-
i: {
331-
release_image: {
332-
$any: {
333-
$alias: 'ri',
334-
$expr: { ri: { id: args.req.body.release_image } },
335-
},
336-
},
331+
ri: {
332+
id: args.req.body.release_image,
337333
},
338334
},
339335
},
@@ -351,28 +347,20 @@ addEnvHooks('image_environment_variable', async (args) => {
351347
return [
352348
envVarIds,
353349
(envVarIdsChunk) => ({
354-
image_install: {
350+
should_be_running__release: {
355351
$any: {
356-
$alias: 'ii',
352+
$alias: 'r',
357353
$expr: {
358-
installs__image: {
354+
status: 'success',
355+
release_image: {
359356
$any: {
360-
$alias: 'i',
357+
$alias: 'ri',
361358
$expr: {
362-
i: {
363-
release_image: {
359+
ri: {
360+
image_environment_variable: {
364361
$any: {
365-
$alias: 'ri',
366-
$expr: {
367-
ri: {
368-
image_environment_variable: {
369-
$any: {
370-
$alias: 'e',
371-
$expr: { e: { id: { $in: envVarIdsChunk } } },
372-
},
373-
},
374-
},
375-
},
362+
$alias: 'e',
363+
$expr: { e: { id: { $in: envVarIdsChunk } } },
376364
},
377365
},
378366
},

0 commit comments

Comments
 (0)