UNPKG

briareus

Version:

Briareus assists with Feature Branch deploys to ECS

26 lines (19 loc) 822 B
'use strict' const _ = require('lodash'); module.exports = function (payload, cb) { let webContainer = _.find(payload.taskDefinition.containerDefinitions, { 'name': payload.webContainerName }); if (!webContainer) { return cb(new Error(`Can not find container with name '${payload.webContainerName}' as specified by the 'webContainerName' attribute in .briareus/config.json`)); } let webContainerPortMapping = _.find(webContainer.portMappings, (mapping) => { return mapping.hasOwnProperty('containerPort'); }); if (!webContainerPortMapping) { return cb(new Error(`Could not find 'containerPort' in 'portMappings' parameter of '${payload.webContainerName}' container`)); } cb(null, [ { op: 'add', path: '/webContainerPort', value: webContainerPortMapping.containerPort }, ]); }