From 55b2b5a467586467d8b8288b561a41d0f9ce8fb2 Mon Sep 17 00:00:00 2001 From: Cameron Diver Date: Mon, 28 Oct 2019 17:50:02 +0000 Subject: [PATCH] Fix potentialy undefined build task when livepushing Change-type: patch Signed-off-by: Cameron Diver --- lib/utils/device/deploy.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/utils/device/deploy.ts b/lib/utils/device/deploy.ts index 72ec41e1..ad63c4d0 100644 --- a/lib/utils/device/deploy.ts +++ b/lib/utils/device/deploy.ts @@ -508,7 +508,16 @@ export function generateTargetState( }; opts.environment = _.merge(opts.environment, env[name]); - const contract = keyedBuildTasks[name].contract; + // This function can be called with a subset of the + // build tasks, when a single dockerfile has changed + // when livepushing, so check the build task exists for + // this composition entry (everything else in this + // function comes from the composition which doesn't + // change) + let contract = null; + if (name in keyedBuildTasks) { + contract = keyedBuildTasks[name].contract; + } services[idx] = { ...defaults,