Skip to content

Commit

Permalink
var-update-trigger: Update only devices that should be running the re…
Browse files Browse the repository at this point in the history
…lease that the image env var is part of

Change-type: patch
  • Loading branch information
thgreasi committed Oct 17, 2024
1 parent 58849cb commit c691ec8
Showing 1 changed file with 16 additions and 28 deletions.
44 changes: 16 additions & 28 deletions src/features/vars-schema/hooks/vars-update-trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,21 +319,17 @@ addEnvHooks('device_service_environment_variable', async (args) => {
addEnvHooks('image_environment_variable', async (args) => {
if (args.req.body.release_image != null) {
return {
image_install: {
should_be_running__release: {
$any: {
$alias: 'ii',
$alias: 'r',
$expr: {
installs__image: {
status: 'success',
release_image: {
$any: {
$alias: 'i',
$alias: 'ri',
$expr: {
i: {
release_image: {
$any: {
$alias: 'ri',
$expr: { ri: { id: args.req.body.release_image } },
},
},
ri: {
id: args.req.body.release_image,
},
},
},
Expand All @@ -351,28 +347,20 @@ addEnvHooks('image_environment_variable', async (args) => {
return [
envVarIds,
(envVarIdsChunk) => ({
image_install: {
should_be_running__release: {
$any: {
$alias: 'ii',
$alias: 'r',
$expr: {
installs__image: {
status: 'success',
release_image: {
$any: {
$alias: 'i',
$alias: 'ri',
$expr: {
i: {
release_image: {
ri: {
image_environment_variable: {
$any: {
$alias: 'ri',
$expr: {
ri: {
image_environment_variable: {
$any: {
$alias: 'e',
$expr: { e: { id: { $in: envVarIdsChunk } } },
},
},
},
},
$alias: 'e',
$expr: { e: { id: { $in: envVarIdsChunk } } },
},
},
},
Expand Down

0 comments on commit c691ec8

Please sign in to comment.