Skip to content

Commit cabe278

Browse files
committed
Set VolumeConfigurations to be null by default
1 parent d83db92 commit cabe278

File tree

2 files changed

+58
-58
lines changed

2 files changed

+58
-58
lines changed

dist/index.js

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ async function runTask(ecs, clusterName, taskDefArn, waitForMinutes, enableECSMa
5555
if(assignPublicIP != "" && (subnetIds != "" || securityGroupIds != "")){
5656
awsvpcConfiguration["assignPublicIp"] = assignPublicIP
5757
}
58-
let volumeConfigurations;
58+
let volumeConfigurations = null;
5959
let taskManagedEBSVolumeObject;
6060

6161
if (runTaskManagedEBSVolumeName != '') {
@@ -203,7 +203,7 @@ async function updateEcsService(ecs, clusterName, service, taskDefArn, waitForSe
203203
const serviceManagedEBSVolumeName = core.getInput('service-managed-ebs-volume-name', { required: false }) || '';
204204
const serviceManagedEBSVolume = core.getInput('service-managed-ebs-volume', { required: false }) || '{}';
205205

206-
let volumeConfigurations;
206+
let volumeConfigurations = null;
207207
let serviceManagedEbsVolumeObject;
208208

209209
if (serviceManagedEBSVolumeName != '') {
@@ -326,9 +326,9 @@ function removeIgnoredAttributes(taskDef) {
326326
for (var attribute of IGNORED_TASK_DEFINITION_ATTRIBUTES) {
327327
if (taskDef[attribute]) {
328328
core.warning(`Ignoring property '${attribute}' in the task definition file. ` +
329-
'This property is returned by the Amazon ECS DescribeTaskDefinition API and may be shown in the ECS console, ' +
330-
'but it is not a valid field when registering a new task definition. ' +
331-
'This field can be safely removed from your task definition file.');
329+
'This property is returned by the Amazon ECS DescribeTaskDefinition API and may be shown in the ECS console, ' +
330+
'but it is not a valid field when registering a new task definition. ' +
331+
'This field can be safely removed from your task definition file.');
332332
delete taskDef[attribute];
333333
}
334334
}
@@ -337,29 +337,29 @@ function removeIgnoredAttributes(taskDef) {
337337
}
338338

339339
function maintainValidObjects(taskDef) {
340-
if (validateProxyConfigurations(taskDef)) {
341-
taskDef.proxyConfiguration.properties.forEach((property, index, arr) => {
342-
if (!('value' in property)) {
343-
arr[index].value = '';
344-
}
345-
if (!('name' in property)) {
346-
arr[index].name = '';
347-
}
348-
});
349-
}
350-
351-
if(taskDef && taskDef.containerDefinitions){
352-
taskDef.containerDefinitions.forEach((container) => {
353-
if(container.environment){
354-
container.environment.forEach((property, index, arr) => {
355-
if (!('value' in property)) {
356-
arr[index].value = '';
357-
}
340+
if (validateProxyConfigurations(taskDef)) {
341+
taskDef.proxyConfiguration.properties.forEach((property, index, arr) => {
342+
if (!('value' in property)) {
343+
arr[index].value = '';
344+
}
345+
if (!('name' in property)) {
346+
arr[index].name = '';
347+
}
358348
});
359-
}
360-
});
361-
}
362-
return taskDef;
349+
}
350+
351+
if(taskDef && taskDef.containerDefinitions){
352+
taskDef.containerDefinitions.forEach((container) => {
353+
if(container.environment){
354+
container.environment.forEach((property, index, arr) => {
355+
if (!('value' in property)) {
356+
arr[index].value = '';
357+
}
358+
});
359+
}
360+
});
361+
}
362+
return taskDef;
363363
}
364364

365365
function validateProxyConfigurations(taskDef){
@@ -391,8 +391,8 @@ async function createCodeDeployDeployment(codedeploy, clusterName, service, task
391391

392392
// Insert the task def ARN into the appspec file
393393
const appSpecPath = path.isAbsolute(codeDeployAppSpecFile) ?
394-
codeDeployAppSpecFile :
395-
path.join(process.env.GITHUB_WORKSPACE, codeDeployAppSpecFile);
394+
codeDeployAppSpecFile :
395+
path.join(process.env.GITHUB_WORKSPACE, codeDeployAppSpecFile);
396396
const fileContents = fs.readFileSync(appSpecPath, 'utf8');
397397
const appSpecContents = yaml.parse(fileContents);
398398

index.js

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ async function runTask(ecs, clusterName, taskDefArn, waitForMinutes, enableECSMa
4949
if(assignPublicIP != "" && (subnetIds != "" || securityGroupIds != "")){
5050
awsvpcConfiguration["assignPublicIp"] = assignPublicIP
5151
}
52-
let volumeConfigurations;
52+
let volumeConfigurations = null;
5353
let taskManagedEBSVolumeObject;
5454

5555
if (runTaskManagedEBSVolumeName != '') {
@@ -197,7 +197,7 @@ async function updateEcsService(ecs, clusterName, service, taskDefArn, waitForSe
197197
const serviceManagedEBSVolumeName = core.getInput('service-managed-ebs-volume-name', { required: false }) || '';
198198
const serviceManagedEBSVolume = core.getInput('service-managed-ebs-volume', { required: false }) || '{}';
199199

200-
let volumeConfigurations;
200+
let volumeConfigurations = null;
201201
let serviceManagedEbsVolumeObject;
202202

203203
if (serviceManagedEBSVolumeName != '') {
@@ -320,9 +320,9 @@ function removeIgnoredAttributes(taskDef) {
320320
for (var attribute of IGNORED_TASK_DEFINITION_ATTRIBUTES) {
321321
if (taskDef[attribute]) {
322322
core.warning(`Ignoring property '${attribute}' in the task definition file. ` +
323-
'This property is returned by the Amazon ECS DescribeTaskDefinition API and may be shown in the ECS console, ' +
324-
'but it is not a valid field when registering a new task definition. ' +
325-
'This field can be safely removed from your task definition file.');
323+
'This property is returned by the Amazon ECS DescribeTaskDefinition API and may be shown in the ECS console, ' +
324+
'but it is not a valid field when registering a new task definition. ' +
325+
'This field can be safely removed from your task definition file.');
326326
delete taskDef[attribute];
327327
}
328328
}
@@ -331,29 +331,29 @@ function removeIgnoredAttributes(taskDef) {
331331
}
332332

333333
function maintainValidObjects(taskDef) {
334-
if (validateProxyConfigurations(taskDef)) {
335-
taskDef.proxyConfiguration.properties.forEach((property, index, arr) => {
336-
if (!('value' in property)) {
337-
arr[index].value = '';
338-
}
339-
if (!('name' in property)) {
340-
arr[index].name = '';
341-
}
342-
});
343-
}
344-
345-
if(taskDef && taskDef.containerDefinitions){
346-
taskDef.containerDefinitions.forEach((container) => {
347-
if(container.environment){
348-
container.environment.forEach((property, index, arr) => {
349-
if (!('value' in property)) {
350-
arr[index].value = '';
351-
}
334+
if (validateProxyConfigurations(taskDef)) {
335+
taskDef.proxyConfiguration.properties.forEach((property, index, arr) => {
336+
if (!('value' in property)) {
337+
arr[index].value = '';
338+
}
339+
if (!('name' in property)) {
340+
arr[index].name = '';
341+
}
352342
});
353-
}
354-
});
355-
}
356-
return taskDef;
343+
}
344+
345+
if(taskDef && taskDef.containerDefinitions){
346+
taskDef.containerDefinitions.forEach((container) => {
347+
if(container.environment){
348+
container.environment.forEach((property, index, arr) => {
349+
if (!('value' in property)) {
350+
arr[index].value = '';
351+
}
352+
});
353+
}
354+
});
355+
}
356+
return taskDef;
357357
}
358358

359359
function validateProxyConfigurations(taskDef){
@@ -385,8 +385,8 @@ async function createCodeDeployDeployment(codedeploy, clusterName, service, task
385385

386386
// Insert the task def ARN into the appspec file
387387
const appSpecPath = path.isAbsolute(codeDeployAppSpecFile) ?
388-
codeDeployAppSpecFile :
389-
path.join(process.env.GITHUB_WORKSPACE, codeDeployAppSpecFile);
388+
codeDeployAppSpecFile :
389+
path.join(process.env.GITHUB_WORKSPACE, codeDeployAppSpecFile);
390390
const fileContents = fs.readFileSync(appSpecPath, 'utf8');
391391
const appSpecContents = yaml.parse(fileContents);
392392

0 commit comments

Comments
 (0)