Skip to content

Commit 0f33b03

Browse files
committed
Removed debug log lines
1 parent 88cc3e2 commit 0f33b03

File tree

2 files changed

+26
-66
lines changed

2 files changed

+26
-66
lines changed

dist/index.js

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

6161
if (runTaskManagedEBSVolumeName != '') {
6262
if (runTaskManagedEBSVolume != '{}') {
6363
taskManagedEBSVolumeObject = convertToManagedEbsVolumeObject(runTaskManagedEbsVolume);
64-
volumeConfigurationJSON["name"] = runTaskManagedEbsVolumeName;
65-
volumeConfigurationJSON["managedEBSVolume"] = taskManagedEbsVolumeObject;
66-
volumeConfigurations.push(volumeConfigurationJSON);
64+
volumeConfigurations = [{
65+
name: runTaskManagedEBSVolumeName,
66+
managedEBSVolume: taskManagedEBSVolumeObject
67+
}];
6768
} else {
6869
core.warning(`run-task-managed-ebs-volume-name provided without run-task-managed-ebs-volume value. Ignoring run-task-managed-ebs-volume property`);
6970
}
70-
} else {
71-
core.info(`No VolumeConfiguration Property provided for run-task-managed-ebs-volume`);
7271
}
7372

7473
const runTaskResponse = await ecs.runTask({
@@ -199,40 +198,25 @@ async function tasksExitCode(ecs, clusterName, taskArns) {
199198

200199
// Deploy to a service that uses the 'ECS' deployment controller
201200
async function updateEcsService(ecs, clusterName, service, taskDefArn, waitForService, waitForMinutes, forceNewDeployment, desiredCount, enableECSManagedTags, propagateTags) {
202-
core.debug('Updating the provided ECS service');
201+
core.debug('Updating the service');
203202

204203
const serviceManagedEbsVolumeName = core.getInput('service-managed-ebs-volume-name', { required: false }) || '';
205-
core.debug(`serviceManagedEbsVolume Name: ${serviceManagedEbsVolumeName}`);
206-
core.debug('serviceManagedEbsVolume Name.');
207204
const serviceManagedEbsVolume = core.getInput('service-managed-ebs-volume', { required: false }) || '{}';
208-
core.debug(`serviceManagedEbsVolume Value: ${serviceManagedEbsVolume}`);
209-
core.debug('serviceManagedEbsVolume Value.');
210-
211-
core.debug('Updating the service contd..');
212205

213206
let volumeConfigurations;
214207
let serviceManagedEbsVolumeObject;
215208

216209
if (serviceManagedEbsVolumeName != '') {
217-
core.debug(`Assigning VolumeConfiguration Name: ${serviceManagedEbsVolumeName}`);
218-
core.debug('Assigning VolumeConfiguration.');
219210
if (serviceManagedEbsVolume != '{}') {
220211
serviceManagedEbsVolumeObject = convertToManagedEbsVolumeObject(serviceManagedEbsVolume);
221-
core.debug(`EBS Volume Object after conversion: ${JSON.stringify(serviceManagedEbsVolumeObject)}`);
222-
223212
volumeConfigurations = [{
224213
name: serviceManagedEbsVolumeName,
225214
managedEBSVolume: serviceManagedEbsVolumeObject // Note the exact casing here
226215
}];
227-
core.debug('Assigning VolumeConfiguration Object');
228216
} else {
229217
core.warning('service-managed-ebs-volume-name provided without service-managed-ebs-volume value. Ignoring service-managed-ebs-volume property');
230218
}
231-
} else {
232-
core.debug('No VolumeConfiguration Property provided for service-managed-ebs-volume');
233219
}
234-
core.debug(`VolumeConfiguration Value: ${volumeConfigurations}`);
235-
core.debug('VolumeConfiguration Value Set.');
236220

237221
let params = {
238222
cluster: clusterName,
@@ -244,10 +228,6 @@ async function updateEcsService(ecs, clusterName, service, taskDefArn, waitForSe
244228
volumeConfigurations: volumeConfigurations
245229
};
246230

247-
core.debug(`Volume Configurations: ${JSON.stringify(volumeConfigurations, null, 2)}`);
248-
core.debug(`Managed EBS Volume Object: ${JSON.stringify(serviceManagedEbsVolumeObject, null, 2)}`);
249-
core.debug(`Final params: ${JSON.stringify(params, null, 2)}`);
250-
251231
// Add the desiredCount property only if it is defined and a number.
252232
if (!isNaN(desiredCount) && desiredCount !== undefined) {
253233
params.desiredCount = desiredCount;
@@ -346,9 +326,9 @@ function removeIgnoredAttributes(taskDef) {
346326
for (var attribute of IGNORED_TASK_DEFINITION_ATTRIBUTES) {
347327
if (taskDef[attribute]) {
348328
core.warning(`Ignoring property '${attribute}' in the task definition file. ` +
349-
'This property is returned by the Amazon ECS DescribeTaskDefinition API and may be shown in the ECS console, ' +
350-
'but it is not a valid field when registering a new task definition. ' +
351-
'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.');
352332
delete taskDef[attribute];
353333
}
354334
}
@@ -511,8 +491,8 @@ async function run() {
511491
// Register the task definition
512492
core.debug('Registering the task definition');
513493
const taskDefPath = path.isAbsolute(taskDefinitionFile) ?
514-
taskDefinitionFile :
515-
path.join(process.env.GITHUB_WORKSPACE, taskDefinitionFile);
494+
taskDefinitionFile :
495+
path.join(process.env.GITHUB_WORKSPACE, taskDefinitionFile);
516496
const fileContents = fs.readFileSync(taskDefPath, 'utf8');
517497
const taskDefContents = maintainValidObjects(removeIgnoredAttributes(cleanNullKeys(yaml.parse(fileContents))));
518498
let registerResponse;
@@ -581,7 +561,7 @@ module.exports = run;
581561

582562
/* istanbul ignore next */
583563
if (require.main === require.cache[eval('__filename')]) {
584-
run();
564+
run();
585565
}
586566

587567

index.js

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

5555
if (runTaskManagedEBSVolumeName != '') {
5656
if (runTaskManagedEBSVolume != '{}') {
5757
taskManagedEBSVolumeObject = convertToManagedEbsVolumeObject(runTaskManagedEbsVolume);
58-
volumeConfigurationJSON["name"] = runTaskManagedEbsVolumeName;
59-
volumeConfigurationJSON["managedEBSVolume"] = taskManagedEbsVolumeObject;
60-
volumeConfigurations.push(volumeConfigurationJSON);
58+
volumeConfigurations = [{
59+
name: runTaskManagedEBSVolumeName,
60+
managedEBSVolume: taskManagedEBSVolumeObject
61+
}];
6162
} else {
6263
core.warning(`run-task-managed-ebs-volume-name provided without run-task-managed-ebs-volume value. Ignoring run-task-managed-ebs-volume property`);
6364
}
64-
} else {
65-
core.info(`No VolumeConfiguration Property provided for run-task-managed-ebs-volume`);
6665
}
6766

6867
const runTaskResponse = await ecs.runTask({
@@ -193,40 +192,25 @@ async function tasksExitCode(ecs, clusterName, taskArns) {
193192

194193
// Deploy to a service that uses the 'ECS' deployment controller
195194
async function updateEcsService(ecs, clusterName, service, taskDefArn, waitForService, waitForMinutes, forceNewDeployment, desiredCount, enableECSManagedTags, propagateTags) {
196-
core.debug('Updating the provided ECS service');
195+
core.debug('Updating the service');
197196

198197
const serviceManagedEbsVolumeName = core.getInput('service-managed-ebs-volume-name', { required: false }) || '';
199-
core.debug(`serviceManagedEbsVolume Name: ${serviceManagedEbsVolumeName}`);
200-
core.debug('serviceManagedEbsVolume Name.');
201198
const serviceManagedEbsVolume = core.getInput('service-managed-ebs-volume', { required: false }) || '{}';
202-
core.debug(`serviceManagedEbsVolume Value: ${serviceManagedEbsVolume}`);
203-
core.debug('serviceManagedEbsVolume Value.');
204-
205-
core.debug('Updating the service contd..');
206199

207200
let volumeConfigurations;
208201
let serviceManagedEbsVolumeObject;
209202

210203
if (serviceManagedEbsVolumeName != '') {
211-
core.debug(`Assigning VolumeConfiguration Name: ${serviceManagedEbsVolumeName}`);
212-
core.debug('Assigning VolumeConfiguration.');
213204
if (serviceManagedEbsVolume != '{}') {
214205
serviceManagedEbsVolumeObject = convertToManagedEbsVolumeObject(serviceManagedEbsVolume);
215-
core.debug(`EBS Volume Object after conversion: ${JSON.stringify(serviceManagedEbsVolumeObject)}`);
216-
217206
volumeConfigurations = [{
218207
name: serviceManagedEbsVolumeName,
219208
managedEBSVolume: serviceManagedEbsVolumeObject // Note the exact casing here
220209
}];
221-
core.debug('Assigning VolumeConfiguration Object');
222210
} else {
223211
core.warning('service-managed-ebs-volume-name provided without service-managed-ebs-volume value. Ignoring service-managed-ebs-volume property');
224212
}
225-
} else {
226-
core.debug('No VolumeConfiguration Property provided for service-managed-ebs-volume');
227213
}
228-
core.debug(`VolumeConfiguration Value: ${volumeConfigurations}`);
229-
core.debug('VolumeConfiguration Value Set.');
230214

231215
let params = {
232216
cluster: clusterName,
@@ -238,10 +222,6 @@ async function updateEcsService(ecs, clusterName, service, taskDefArn, waitForSe
238222
volumeConfigurations: volumeConfigurations
239223
};
240224

241-
core.debug(`Volume Configurations: ${JSON.stringify(volumeConfigurations, null, 2)}`);
242-
core.debug(`Managed EBS Volume Object: ${JSON.stringify(serviceManagedEbsVolumeObject, null, 2)}`);
243-
core.debug(`Final params: ${JSON.stringify(params, null, 2)}`);
244-
245225
// Add the desiredCount property only if it is defined and a number.
246226
if (!isNaN(desiredCount) && desiredCount !== undefined) {
247227
params.desiredCount = desiredCount;
@@ -340,9 +320,9 @@ function removeIgnoredAttributes(taskDef) {
340320
for (var attribute of IGNORED_TASK_DEFINITION_ATTRIBUTES) {
341321
if (taskDef[attribute]) {
342322
core.warning(`Ignoring property '${attribute}' in the task definition file. ` +
343-
'This property is returned by the Amazon ECS DescribeTaskDefinition API and may be shown in the ECS console, ' +
344-
'but it is not a valid field when registering a new task definition. ' +
345-
'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.');
346326
delete taskDef[attribute];
347327
}
348328
}
@@ -505,8 +485,8 @@ async function run() {
505485
// Register the task definition
506486
core.debug('Registering the task definition');
507487
const taskDefPath = path.isAbsolute(taskDefinitionFile) ?
508-
taskDefinitionFile :
509-
path.join(process.env.GITHUB_WORKSPACE, taskDefinitionFile);
488+
taskDefinitionFile :
489+
path.join(process.env.GITHUB_WORKSPACE, taskDefinitionFile);
510490
const fileContents = fs.readFileSync(taskDefPath, 'utf8');
511491
const taskDefContents = maintainValidObjects(removeIgnoredAttributes(cleanNullKeys(yaml.parse(fileContents))));
512492
let registerResponse;
@@ -575,5 +555,5 @@ module.exports = run;
575555

576556
/* istanbul ignore next */
577557
if (require.main === module) {
578-
run();
558+
run();
579559
}

0 commit comments

Comments
 (0)