Merge pull request #1488 from balena-io/fix-undefined-contract

Fix potentialy undefined build task when livepushing
This commit is contained in:
CameronDiver 2019-10-29 10:48:43 +00:00 committed by GitHub
commit 0671ee0bef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,